This guide walks you through cloning the Ocha API, configuring your environment, starting the server, and making your first authenticated request. You will need Node.js 18 or higher, a running MongoDB instance, and a Cloudinary account before you begin.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/floriansalvi/HEIG-VD_Ocha-api/llms.txt
Use this file to discover all available pages before exploring further.
Clone the repository and install dependencies
Clone the repository and install the required npm packages.
Create the .env file
Create a
.env file at the project root with the following variables. All four are required for the server to start correctly.JWT_SECRET can be any long random string. Use a secret manager or openssl rand -hex 32 to generate one. Do not commit this file to version control.Start the server
Start the API server. Use development mode while building locally — it restarts automatically on file changes.The server starts on
- Development
- Production
http://localhost:5001. You can verify it is running by visiting http://localhost:5001/api/v1/health.Seed sample data
Populate the database with sample products and stores so you have data to work with immediately.
Register a user
Create a new account by sending a A successful response returns HTTP Copy the
POST request to /api/v1/auth. The response includes a JWT token you will use for all subsequent authenticated requests.201 with your token:token value — you will need it in the next step.