Planify is a Express.js-based API designed to simplify ticket booking for stadium events. This project allows users to easily manage event bookings and integrates with MongoDB for data storage.
- Event Management: Create, update, and delete events.
- Ticket Booking: Book tickets for specific events.
- User Management: Register, authenticate, and manage users.
- Stadium Management: Create, update, and delete stadiums.
- Docker Support: Run MongoDB using Docker Compose.
Provide step-by-step instructions for setting up the project locally
- Node.js (v14 or higher)
- Docker
- Docker Compose
- Clone the repository:
git clone https://github.com/YoussefNKH/Planify.git cd Planify - Install dependencies:
npm install
- Set up environment variables:
Open the .env file and add the following variables:
PORT=3000
MONGO_URI=mongodb://mongo:27017/planify
JWT_SECRET=your_jwt_secretCreate a new event (Admin only).
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get a list of all events.
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Search events based on criteria (name, description, location, category, status).
| Parameter | Type | Description |
|---|---|---|
name |
string |
Name of the event (optional) |
location |
string |
Location of the event (optional) |
category |
string |
Category of the event (optional) |
status |
string |
Status of the event (optional) |
api_key |
string |
Required. Your API key |
Get active events.
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get events by category.
| Parameter | Type | Description |
|---|---|---|
categorie |
string |
Category of the event |
api_key |
string |
Required. Your API key |
Get fully booked events.
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get events by location.
| Parameter | Type | Description |
|---|---|---|
lieu |
string |
Location of the event |
api_key |
string |
Required. Your API key |
Get events by stadium.
| Parameter | Type | Description |
|---|---|---|
stadeId |
string |
Stadium ID |
api_key |
string |
Required. Your API key |
Get details of a specific event.
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Event ID |
api_key |
string |
Required. Your API key |
Increment the number of tickets sold for an event (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Event ID |
num_billets |
integer |
Number of tickets to increment |
api_key |
string |
Required. Your API key |
Get events within a date range.
| Parameter | Type | Description |
|---|---|---|
start_date |
string |
Start date (YYYY-MM-DD) |
end_date |
string |
End date (YYYY-MM-DD) |
api_key |
string |
Required. Your API key |
Update an event by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Event ID |
data |
object |
Required. Event data to update |
api_key |
string |
Required. Your API key |
Delete an event by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Event ID |
api_key |
string |
Required. Your API key |
Create a reservation.
| Parameter | Type | Description |
|---|---|---|
event_id |
string |
Event ID to reserve |
user_id |
string |
User ID |
tickets |
integer |
Number of tickets to reserve |
api_key |
string |
Required. Your API key |
Pay for a reservation.
| Parameter | Type | Description |
|---|---|---|
reservationId |
string |
Required. Reservation ID |
api_key |
string |
Required. Your API key |
Get all reservations (Admin only).
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get reservations by user ID.
| Parameter | Type | Description |
|---|---|---|
utilisateurId |
string |
Required. User ID |
api_key |
string |
Required. Your API key |
Get reservations by event ID.
| Parameter | Type | Description |
|---|---|---|
evenementId |
string |
Required. Event ID |
api_key |
string |
Required. Your API key |
Update a reservation.
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Reservation ID |
data |
object |
Required. Reservation data to update |
api_key |
string |
Required. Your API key |
Delete a reservation (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Reservation ID |
api_key |
string |
Required. Your API key |
Create a stadium (Admin only).
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get all stadiums.
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get a stadium by ID.
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Stadium ID |
api_key |
string |
Required. Your API key |
Get stadiums by name.
| Parameter | Type | Description |
|---|---|---|
name |
string |
Required. Stadium name |
api_key |
string |
Required. Your API key |
Get stadiums by city.
| Parameter | Type | Description |
|---|---|---|
city |
string |
Required. City name |
api_key |
string |
Required. Your API key |
Update a stadium by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Stadium ID |
data |
object |
Required. Stadium data to update |
api_key |
string |
Required. Your API key |
Delete a stadium by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Stadium ID |
api_key |
string |
Required. Your API key |
Get all tickets (Admin only).
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get a ticket by number (Admin only).
| Parameter | Type | Description |
|---|---|---|
numero |
string |
Required. Ticket number |
api_key |
string |
Required. Your API key |
Get tickets by user.
| Parameter | Type | Description |
|---|---|---|
utilisateur |
string |
Required. User ID |
api_key |
string |
Required. Your API key |
Update a ticket by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Ticket ID |
data |
object |
Required. Ticket data to update |
api_key |
string |
Required. Your API key |
Delete a ticket by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. Ticket ID |
api_key |
string |
Required. Your API key |
Register a new user.
| Parameter | Type | Description |
|---|---|---|
email |
string |
Required. User email |
password |
string |
Required. User password |
api_key |
string |
Required. Your API key |
Authenticate a user.
| Parameter | Type | Description |
|---|---|---|
email |
string |
Required. User email |
password |
string |
Required. User password |
api_key |
string |
Required. Your API key |
Get all users (Admin only).
| Parameter | Type | Description |
|---|---|---|
api_key |
string |
Required. Your API key |
Get a user by ID (Admin and User).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. User ID |
api_key |
string |
Required. Your API key |
Get users by email (Admin only).
| Parameter | Type | Description |
|---|---|---|
address_mail |
string |
Required. Email address |
api_key |
string |
Required. Your API key |
Update a user by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. User ID |
data |
object |
Required. User data to update |
api_key |
string |
Required. Your API key |
Delete a user by ID (Admin only).
| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. User ID |
api_key |
string |
Required. Your API key |
Planify/
├── backend/ # Backend source code
│ ├── config/ # Configuration files
│ ├── controllers/ # Route controllers
│ ├── middlewares/ # Custom middlewares
│ ├── models/ # MongoDB models
│ ├── routes/ # API routes
│ ├── utils/ # Utility functions
│ └── server.js # Express server setup
├── node_modules/ # Node.js dependencies
├── .env # Environment variables
├── .gitignore # Git ignore file
├── docker-compose.yml # Docker Compose setup
├── package-lock.json # Lock file for dependencies
├── package.json # Node.js dependencies
└── README.md # Project documentation
1.Run the project using Docker Compose:
docker-compose up --build2.Run this command:
npm run dev3.The app will be accessible at:
http://localhost:PORT_you_put_in_the_.env_file