A RESTful API for booking various activities like yoga, coding workshops, sports events, and more.
Below is an image from the project showing the API functionality:
- User Registration and Authentication
- Activity Listing with 20 pre-seeded diverse activities
- Activity Booking with capacity management
- Booking History
- JWT-based Authentication
- Input Validation
- Password Hashing
- Swagger API Documentation
- Node.js
- Express.js
- MongoDB
- JWT Authentication
- Express Validator
- Bcrypt for Password Hashing
- Swagger for API Documentation
- Node.js (v14 or higher)
- MongoDB
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd meetx-activity-booking- Install dependencies:
npm install- Create a
.envfile in the root directory with the following variables:
PORT=3000
MONGODB_URI=mongodb://localhost:27017/meetx
JWT_SECRET=your_jwt_secret_key
- Seed the database with sample activities:
node src/scripts/seed-activities.js- Start the development server:
npm run dev- POST
/api/auth/register- Register a new user - POST
/api/auth/login- Login user
- GET
/api/activities- List all activities - POST
/api/activities/book- Book an activity (requires authentication) - GET
/api/activities/my-bookings- Get user's bookings (requires authentication)
Swagger API documentation is available at: API Documentation - MeetX
If you are testing locally, you can access Swagger UI at /api-docs on your local server.
- By default, the API is configured to use the deployed MongoDB instance.
- If you prefer, you can use your local MongoDB instance by changing the
MONGODB_URIin the.envfile.
The system comes pre-seeded with 20 diverse activities including:
- Morning Yoga Session
- Coding Workshop: React Basics
- Photography Walk
- Cooking Class: Italian Cuisine
- Hiking Adventure
- Public Speaking Workshop
- Chess Tournament
- Wine Tasting Evening
- Dance Class: Salsa
- Startup Networking Event
- And more...
Each activity has:
- A descriptive title
- Detailed description
- Specific location
- Future date
- Capacity limit
- Current booking count
A Postman collection is provided in the postman directory for testing the APIs.
The API uses standard HTTP status codes:
- 200: Success
- 201: Created
- 400: Bad Request (e.g., activity is full, already booked)
- 401: Unauthorized
- 404: Not Found
- 500: Internal Server Error
- Passwords are hashed using bcrypt
- JWT tokens are used for authentication
- Input validation using express-validator
- CORS enabled
- Environment variables for sensitive data
