A modern, production-ready Express.js boilerplate with authentication, user management, admin features, and industry-standard best practices.
Author: Ishwar Sarade ishwar.sarade@gmail.com
- Modular Architecture: Clean, modular design with separated concerns
- Authentication System:
- Local login with email/password
- JWT bearer token authentication
- Google OAuth integration
- User Management: Complete user CRUD operations with profile management
- Admin Panel: Admin routes for user management and system statistics
- Soft Delete: Logical deletion with automatic filtering
- File Management: AWS S3 integration for file uploads and management
- Database Integration: MongoDB with Mongoose ODM (port 27021 for local dev)
- Email Service: Nodemailer integration with AWS SES support
- Security:
- Helmet.js for security headers
- CORS configuration
- Rate limiting (different limits for auth vs API routes)
- Request ID tracking
- Logging: Winston structured logging with file and console outputs
- Cron Jobs: Scheduled task management (including automated backups)
- Backup System: Automated MongoDB backups to S3 (gzipped)
- Docker Support: Containerized development environment
- API Versioning:
/api/v1/prefix for all routes - Code Quality: ESLint and Prettier configured
- Testing: Test structure with seed data support
- Node.js 18+ (LTS recommended)
- Docker and Docker Compose
- npm or yarn package manager
- MongoDB (via Docker or local installation)
-
Clone the repository
git clone https://github.com/heyIshwar/vx-engine.git cd vx-engine -
Install dependencies
npm install
-
Set up environment variables (Optional for quick start)
cp .env.example .env # Edit .env with your configurationNote: The development configuration (
lib/config/development_env_config.json) is pre-configured with defaults that work with Docker Compose and seed script. You can start immediately without setting up.envfile for local development. -
Set up the database
# Start MongoDB and Mongo Express using Docker Compose docker-compose up -dMongoDB will be available on
localhost:27021 -
Seed the database
npm run seed
This creates an admin user and test users:
- Admin:
admin@example.com/admin123 - Test users: See seed script output
- Admin:
-
Start the development server
npm run dev
The application will start on http://localhost:3008 (or the port specified in your configuration).
VX Engine uses environment-based configuration files located in lib/config/:
base_config.json- Base configurationdevelopment_env_config.json- Development environment settingsstaging_env_config.json- Staging environment settingsproduction_env_config.json- Production environment settings
Key environment variables (see .env.example for complete list):
# Core
NODE_ENV=development
PORT=3008
# Database
MONGODB_URI=mongodb://vxengine:vxengine123@localhost:27021/vx_engine_development
MONGODB_USERNAME=vxengine
MONGODB_PASSWORD=vxengine123
# JWT
JWT_SECRET=your-secret-key
JWT_EXPIRATION=86400
# AWS
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_REGION=us-east-1
S3_BUCKET=your-bucket
BACKUP_BUCKET=your-backup-bucket
# Email
SMTP_HOST=email-smtp.us-east-1.amazonaws.com
SMTP_PORT=587
EMAIL_FROM=noreply@example.comvx-engine/
βββ lib/ # Core libraries and utilities
β βββ config/ # Configuration files
β βββ authentication/ # Authentication strategies
β βββ errors/ # Custom error classes
β βββ validators/ # Validation utilities
βββ modules/ # Application modules
β βββ Authentication/ # Authentication module
β βββ User/ # User management
β βββ Admin/ # Admin routes
β βββ File/ # File management
βββ loaders/ # Application loaders
β βββ express.js # Express app configuration
β βββ mongoose.js # Database connection
β βββ cron.js # Cron job loader
βββ middlewares/ # Custom middlewares
β βββ admin.js # Admin authentication
β βββ soft-delete.js # Soft delete filtering
β βββ rate-limiter.js # Rate limiting
β βββ request-id.js # Request ID tracking
βββ models/ # Database models
βββ routes/ # Route definitions
βββ utils/ # Utility functions
β βββ logger.js # Winston logger
βββ scripts/ # Utility scripts
β βββ seed.js # Database seeding
β βββ backup.js # MongoDB backup
βββ crons/ # Cron job definitions
βββ tests/ # Test files
βββ postman/ # Postman collection
βββ app.js # Application entry point
βββ AppLoader.js # Application loader class
POST /api/v1/auth/login- User login (local)DELETE /api/v1/user/logout- User logout
GET /api/v1/user/- Get user profilePATCH /api/v1/user/- Update user profileGET /api/v1/user/session- Get active sessionsDELETE /api/v1/user/session/:sessionId- Delete session
GET /api/v1/admin/stats- Get system statisticsGET /api/v1/admin/users- Get all users (including soft-deleted)GET /api/v1/admin/users/:userId- Get user by IDPATCH /api/v1/admin/users/:userId/activate- Activate/deactivate userPATCH /api/v1/admin/users/:userId/restore- Restore soft-deleted userDELETE /api/v1/admin/users/:userId/hard- Hard delete user
GET /health- Health check endpointGET /ready- Readiness check (includes DB status)
The project includes Docker Compose configuration for easy development setup:
# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# View logs
docker-compose logs -f
# Restart services
docker-compose restartMongoDB runs on port 27021 (to avoid conflicts with default MongoDB port).
npm start- Start production servernpm run dev- Start development servernpm run seed- Seed database with initial datanpm run backup- Run manual backupnpm run lint- Run ESLintnpm run format- Format code with Prettiernpm test- Run tests (when configured)
POST /api/v1/auth/login
Content-Type: application/json
{
"email": "admin@example.com",
"password": "admin123"
}Response includes accessToken - use as Authorization: Bearer <token> header.
Configure Google OAuth credentials in config files and use the OAuth endpoints.
- Helmet.js: Security headers
- CORS: Cross-origin resource sharing configuration
- JWT: JSON Web Token authentication
- bcryptjs: Password hashing
- Input Validation: Joi-based request validation
- Rate Limiting: Different limits for auth and API routes
- Request ID Tracking: Unique ID for each request
Configure email settings in your environment config or .env:
SMTP_HOST=email-smtp.us-east-1.amazonaws.com
SMTP_PORT=587
SMTP_USER=your-smtp-user
SMTP_PASS=your-smtp-password
EMAIL_FROM=noreply@yourdomain.comAutomated backups run daily at 2 AM via cron job. Manual backup:
npm run backupBackups are:
- Gzipped for compression
- Uploaded to S3 (if configured)
- Stored locally in
backups/directory - Old backups automatically cleaned (keeps last 5)
Import postman/VX-Engine.postman_collection.json into Postman for easy API testing.
Set environment variables:
baseUrl:http://localhost:3008accessToken: (auto-set after login)
Run database seed first:
npm run seedThen run tests (when test framework is configured):
npm test- ESLint: Code linting (
.eslintrc.js) - Prettier: Code formatting (
.prettierrc) - EditorConfig: Consistent editor settings (
.editorconfig)
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
See CONTRIBUTING.md for detailed contribution guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check the documentation
- Review API documentation
- Open an issue on GitHub
Built with β€οΈ by Ishwar Sarade