Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

233 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VNR Keys

A comprehensive key management system with role-based access control, built with React frontend and Node.js backend.

πŸš€ Features

  • Role-based Access Control: Multiple user roles (Admin, Faculty, Operator, Responder, Security)
  • QR Code Integration: Generate and scan QR codes for key access
  • Real-time Updates: Socket.io integration for live updates
  • Secure Authentication: JWT-based authentication with email verification
  • Responsive Design: Mobile-first design with Tailwind CSS
  • API Key Management: Comprehensive API key tracking and management

πŸ—οΈ Architecture

  • Frontend: React + Vite + Tailwind CSS
  • Backend: Node.js + Express + MongoDB
  • Deployment: Vercel (Frontend) + Custom Backend Deployment
  • CI/CD: GitHub Actions with automated testing and deployment

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • MongoDB
  • Git

Local Development

  1. Clone the repository

    git clone https://github.com/gurramkarthiknetha/vnr-keys.git
    cd vnr-keys
  2. Setup Backend

    cd backend
    npm install
    cp .env.example .env  # Create and configure environment variables
    npm run dev
  3. Setup Frontend

    cd frontend
    npm install
    npm run dev
  4. Access the application

πŸ”§ CI/CD Pipeline

This project uses GitHub Actions for automated testing, building, and deployment.

Pipeline Features

  • Automated Testing: Linting, building, and syntax checking
  • Security Scanning: Dependency audits and secret detection
  • Multi-platform Deployment: Vercel (frontend) + Render (backend)
  • Dependency Updates: Automated weekly dependency updates
  • Branch Protection: Required reviews and status checks
  • Issue Tracking: Automatic issue creation for failed deployments
  • Commit Tracking: Detailed commit information and issue references
  • Deployment Monitoring: Success/failure tracking with notifications

Setup Instructions

  1. Run the setup script

    ./scripts/setup-cicd.sh
  2. Configure GitHub Secrets

    • VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID
  3. Enable Branch Protection

    • Require status checks before merging
    • Require pull request reviews

For detailed setup instructions, see CI_CD_SETUP.md.

πŸ“ Project Structure

vnr-keys/
β”œβ”€β”€ frontend/                 # React frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ services/       # API and socket services
β”‚   β”‚   β”œβ”€β”€ store/          # State management (Zustand)
β”‚   β”‚   └── utils/          # Utility functions
β”‚   └── public/             # Static assets
β”œβ”€β”€ backend/                 # Node.js backend API
β”‚   β”œβ”€β”€ controllers/        # Route controllers
β”‚   β”œβ”€β”€ models/            # MongoDB models
β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”œβ”€β”€ middleware/        # Custom middleware
β”‚   └── services/          # Business logic services
β”œβ”€β”€ .github/workflows/      # GitHub Actions workflows
└── scripts/               # Utility scripts

πŸ” Environment Variables

Backend (.env)

NODE_ENV=development
PORT=3000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLIENT_URL=http://localhost:5173

Frontend (.env)

VITE_API_URL=http://localhost:3000
VITE_SOCKET_URL=http://localhost:3000

πŸ§ͺ Testing

Frontend Tests

cd frontend
npm run lint
npm run build

Backend Tests

cd backend
node -c index.js  # Syntax check
npm test          # If tests exist

πŸ“¦ Deployment

Production Deployment

The application is automatically deployed when changes are pushed to the main branch:

  • Frontend: Deployed to Vercel
  • Backend: Deployed to Render

Manual Deployment

  1. Frontend (Vercel)

    cd frontend
    vercel --prod
  2. Backend (Render)

    • Push to main branch triggers automatic deployment
    • Or use Render dashboard for manual deployment

πŸ”’ Security Features

  • JWT-based authentication
  • Role-based access control
  • Rate limiting
  • CORS protection
  • Helmet.js security headers
  • Input validation and sanitization
  • Secure password hashing (bcrypt)

πŸ“Š Monitoring

  • GitHub Actions workflow monitoring
  • Vercel deployment analytics
  • Render service monitoring
  • Application error tracking

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Workflow

  1. Create feature branch

    git checkout -b feature/your-feature-name
  2. Make changes and test locally

    # Test frontend
    cd frontend && npm run lint && npm run build
    
    # Test backend
    cd backend && node -c index.js
  3. Push and create PR

    • Use the provided PR templates for consistent documentation
    • Include issue references in commit messages (Closes #123)
    • CI/CD pipeline will automatically run tests
    • Ensure all checks pass before merging

πŸ“‹ PR Templates

  • Comprehensive Template: .github/pull_request_template.md
  • Simple Template: .github/pull_request_template_simple.md

Both templates include:

  • Change type classification
  • Issue number and title
  • Fixes and related issues
  • Screenshots/videos section
  • Documentation updates
  • Summary and breaking changes

πŸ“ License

This project is licensed under the ISC License - see the LICENSE file for details.

πŸ†˜ Support

πŸš€ Live Demo

  • Frontend: vnr-keys.vercel.app
  • Backend: Custom deployment with environment-based configuration

License

This project is licensed under the MLT License. See the LICENSE file for more details.

Releases

Packages

Contributors

Languages