Backend API for DevCamper application, which is a bootcamp directory website
Open the "index.html" file in the public folder via live server- by doing so you can have a preview of all the routes used in this application and use as such. eg: api/v1/bootcamps, api/v1/users
npm install
# Run in dev mode
npm run dev
# Run in prod mode
npm start
To seed the database with users, bootcamps, courses and reviews with data from the "_data" folder, run
node seeder -d
node seeder -i
- Version: 1.0.0
- License: MIT
Here is an expected gif of the preview of routes of the index.html
A robust backend API for managing technical education programs, featuring secure authentication, role-based access control, and advanced data management capabilities.
- JWT Authentication with HTTP-only cookies
- Two-Factor Authentication (2FA) via email
- Role-Based Access Control (User, Publisher, Admin)
- Rate limiting (100 requests/15 minutes)
- Helmet security headers
- XSS protection & MongoDB sanitization
- Geospatial search by location/radius
- File upload for bootcamp photos
- CRUD operations with advanced filtering
- Average cost calculations
- Multi-tenancy support
- Curriculum management
- Scholarship availability tracking
- Automated tuition averaging
- Skill level requirements
- Relationship mapping with bootcamps
- Rating system (1-10 scale)
- Automated average rating calculations
- Unique user reviews per bootcamp
- Rich text reviews with titles
- Population of related data
- Pagination & sorting
- Query filtering (gt, gte, lt, lte, in)
- Database seeding utility
- Email integration (SMTP)
- Error handling middleware
- API documentation (Swagger/OpenAPI)
- Runtime: Node.js 18.x
- Framework: Express 4.x
- Database: MongoDB 6.x
- ODM: Mongoose 7.x
- Security:
- bcryptjs
- JWT
- Helmet
- xss-clean
- Utilities:
- Nodemailer
- Slugify
- Node Geocoder
- Express Fileupload
- Clone repository:
git clone https://github.com/ressuman/DevCamper-Bootcamp-Backend-Directory-Project.git
cd DevCamper-Bootcamp-Backend-Directory-Project
- Install dependencies:
npm install
- Configure environment:
cp config/config.env.example config/config.env
- Start server:
# Development
npm run dev
# Production
npm start
Update config/config.env
with your credentials:
NODE_ENV=development
PORT=5193
MONGO_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/dbname
JWT_SECRET=your_jwt_secret
JWT_EXPIRE=30d
SMTP_HOST=smtp.mailtrap.io
SMTP_PORT=2525
SMTP_USER=mailtrap_user
SMTP_PASSWORD=mailtrap_password
FILE_UPLOAD_PATH=./public/uploads
MAX_FILE_UPLOAD=1000000 # 1MB
Interactive documentation available via Swagger UI:
http://localhost:5193/api-docs
# Get bootcamps within 10 miles of 02108
curl -X GET "http://localhost:5193/api/v1/bootcamps/radius/02108/10"
Resource | Fields |
---|---|
Bootcamp | name, description, careers, location, photo, housing, etc. |
Course | title, description, weeks, tuition, minimumSkill, scholarshipAvailable |
User | name, email, role, password, resetPasswordToken, twoFactorCode |
Review | title, text, rating, bootcamp, user |
-
Authentication:
- JWT stored in HTTP-only cookies
- 2FA via email codes
- Password reset tokens with expiration
-
Authorization:
- Role hierarchy (User < Publisher < Admin)
- Resource ownership validation
- Protected routes middleware
-
Validation:
- Request body sanitization
- MongoDB operator injection prevention
- File type/size restrictions
-
Monitoring:
- Rate limiting
- Request logging
- Error tracking
Key Relationships:
- Bootcamp β Courses (1:M)
- Bootcamp β Reviews (1:M)
- User β Bootcamps (1:M)
- User β Courses (1:M)
- User β Reviews (1:M)
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by DevCamper project
- Bootcamp industry best practices
- Open source community contributions
This README provides:
- Clear installation/configuration instructions
- Comprehensive feature overview
- API documentation details
- Security implementation insights
- Technology stack visibility
- Database structure information
- Licensing and acknowledgments
You can enhance it further by:
- Adding actual ER diagrams
- Including screenshots of API documentation
- Adding CI/CD badges
- Expanding the testing section
- Adding deployment instructions
- Including contribution guidelines
- Adding a changelog section
Here is an expected gif/photos of the preview of the App(DevCamper Bootcamp LMS API)