A advanced car rental platform built with NestJS, featuring microservices architecture, real-time processing, and advanced security features.
- Microservice Architecture with API Gateway
- Role-Based Access Control (RBAC)
- Advanced Car Search with Algolia Integration
- Real-time Payment Processing with Stripe
- Automated Document Verification (Driver's License) using Tesseract.js
- Automated Email Notifications
- Rate Limiting and Security Features
- Response Compression
- Redis Caching
- Message Queue System (RabbitMQ)
- Comprehensive Error Tracking
- Backend Framework: NestJS
- Database: MongoDB
- Caching: Redis
- Message Broker: RabbitMQ
- Search Engine: Algolia
- Payment Processing: Stripe
- File Upload: UploadThing
- OCR Processing: Tesseract.js
- Email Service: Gmail SMTP
- Development: MonoRepo Architecture
Method | Endpoint | Description |
---|---|---|
/api/auth/login |
User authentication | |
/api/auth/register |
User registration |
Method | Endpoint | Description |
---|---|---|
/api/users/:id/profile |
Get user profile | |
/api/users/:id/profile |
Update user profile | |
/api/users/:id |
Delete user account |
Method | Endpoint | Description |
---|---|---|
/api/cars |
Add new car | |
/api/cars/search |
Search cars | |
/api/cars/:id/status |
Update car status |
Method | Endpoint | Description |
---|---|---|
/api/rentals |
Create rental | |
/api/rentals/payment-confirmation/:id |
Get payment confirmation | |
/api/rentals/active |
Get active rentals |
car-rental-system/
βββ apps/
β βββ api-gateway/
β βββ user-service/
β βββ car-service/
β βββ rental-service/
| βββ email-service/
βββ libs/
βββ common/
βββ database/
The system sends automated emails for:
- Welcome messages
- Payment confirmations
- Rental invoices
Payment Confirmation | Invoice | Welcome Email |
---|---|---|
# Debug Mode
DEBUG_MODE=true # Enable to see expected/unexpected errors in console
# Application
APP_URL=http://localhost:3000/api
# Database
MONGODB_URI=mongodb://localhost:27017/car-rental-users
# Message Queue
RABBITMQ_URL=amqp://localhost:5672
USER_EMAIL_QUEUE_NAME=user_email_queue
USER_EMAIL_QUEUE_TTL=1 # Welcome Email (in days)
RENTAL_EMAIL_QUEUE_NAME=rental_email_queue
RENTAL_EMAIL_QUEUE_TTL=60 # Payment confirmation queue (in seconds)
# Redis Cache
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_TTL=5 # Caching time in minutes
# JWT Configuration
# Generate using: openssl rand -base64 64
JWT_SECRET_KEY=your_jwt_secret_here
# Encryption
# Generate using: openssl rand -hex 32
ENCRYPTION_KEY=your_encryption_key_here
# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=465
USER_EMAIL=your_email@gmail.com
EMAIL_PASSWORD=your_app_specific_password
# Rate Limiting
THROTTLER_TTL=60 # Time window in seconds
THROTTLER_LIMIT=30 # Maximum requests within TTL
THROTTLER_BLOCK_DURATION=300 # Block duration in seconds
# Third-Party Services
ALGOLIA_APP_ID=your_algolia_app_id
ALGOLIA_API_KEY=your_algolia_api_key
STRIPE_API_KEY=your_stripe_api_key
UPLOADTHING_TOKEN=your_uploadthing_token
# Microservices
USER_SERVICE_HOST=localhost
USER_SERVICE_PORT=1111
CAR_SERVICE_HOST=localhost
CAR_SERVICE_PORT=3434
RENT_SERVICE_HOST=localhost
RENT_SERVICE_PORT=3666
- Node.js
- MongoDB
- Redis
- RabbitMQ
- Gmail Account (for email notifications)
- Clone the repository
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env
# Update the .env file with your configurations
- Start the development server:
npm run dev:all
When DEBUG_MODE=true
, the system provides detailed error logging with color-coded console outputs:
- π΄ Microservice Exceptions (Red)
- π΅ RPC Exceptions (Blue)
- JWT Authentication
- Role-Based Access Control
- Request Rate Limiting
- Response Compression
- Encrypted Sensitive Data
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.