Skip to main content

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.

Ocha API is the REST backend that powers Ocha, a fictitious matcha shop chain. It provides endpoints for managing users, products, stores, and orders, with role-based access control for both regular customers and administrators. The API is built with Node.js and Express.js, stores data in MongoDB via Mongoose, and uses JWT tokens for authentication.

Tech stack

LayerTechnology
RuntimeNode.js 18+ with Express.js
DatabaseMongoDB with Mongoose ODM
AuthenticationJSON Web Tokens (JWT)
Password hashingbcrypt
Image storageCloudinary
Real-timeWebSockets (ws library)
DocumentationOpenAPI (Swagger)

Resources

The API exposes four main resource types:
  • Users — account registration, profile retrieval, and order history
  • Products — full CRUD with image upload and real-time broadcast on creation
  • Stores — full CRUD with geolocation filtering
  • Orders — order creation, status updates, item retrieval, and aggregated stats

Roles

All new accounts are created with the user role. The admin role unlocks additional write operations such as creating products and stores, deleting resources, and accessing order statistics. Role assignment is managed directly in the database.

Base URL

http://localhost:5001/api/v1

API documentation

Interactive Swagger UI is available at http://localhost:5001/api/v1/api-docs once the server is running.

Where to go next

Quickstart

Clone the repo, configure environment variables, and make your first request in minutes.

Authentication

Understand JWT tokens, registration, login, and how to pass credentials to protected routes.

Register a user

Full reference for the POST /api/v1/auth endpoint with request and response schemas.

Filtering and pagination

Learn how to filter products by status, paginate results, and query stores by location.

Build docs developers (and LLMs) love