The Ocha API is configured entirely through aDocumentation 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.
.env file placed at the project root. No configuration is hard-coded: port, database connection, JWT signing secret, and image storage credentials are all read from environment variables at startup. The sections below document each variable, its expected format, and whether it is required or optional.
Environment variables
PORT
| Property | Value |
|---|---|
| Required | No (optional) |
| Default | 5001 |
| Type | Integer |
MONGO_URI
| Property | Value |
|---|---|
| Required | Yes |
| Type | String |
Local instance
MongoDB Atlas
JWT_SECRET
| Property | Value |
|---|---|
| Required | Yes |
| Type | String |
401 Unauthorized response.
CLOUDINARY_URL
| Property | Value |
|---|---|
| Required | Yes |
| Type | String |
| Format | cloudinary://<api_key>:<api_secret>@<cloud_name> |
PUT /api/v1/products/{productId}/image) and the resulting URL is stored in the Product.image field.
api_key, api_secret, and cloud_name in the Cloudinary dashboard under Settings → Access Keys.
The seeded products reference images that must already be published to your Cloudinary account. Upload the product images to Cloudinary before running the seeder if you want them to resolve correctly.
Complete .env example
.env
Useful commands
Seed the database
Populate the database with an initial set of products and stores. Run this once after first setup, or any time you need to restore the baseline data.seeders/seedProducts.js and seeders/seedStores.js in sequence. Existing documents with conflicting unique fields will cause the seeder to skip or error on those entries.
Run the test suite
Execute the full Jest integration and unit test suite using Supertest against a dedicated test database.Configure a separate
MONGO_URI for your test environment if you do not want tests to write to your development or production database. The test setup in tests/setup/testDB.js manages the test database lifecycle.Start the server
http://localhost:<PORT>/api/v1 and the Swagger UI at http://localhost:<PORT>/api/v1/api-docs.