Ocha API is the backend service powering the Ocha matcha shop application. Built with Express.js and MongoDB, it exposes a versioned REST API atDocumentation 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.
/api/v1 providing full management of users, products, stores, and orders — with JWT-based authentication, role-based access control, real-time WebSocket notifications, and Cloudinary image uploads.
Quickstart
Make your first API call in minutes — register, authenticate, and start fetching products.
Authentication
Learn how to register, log in, and pass JWT tokens to protected endpoints.
API Reference
Full reference for every endpoint: parameters, request bodies, and response shapes.
Guides
Explore pagination, geolocation search, WebSockets, image uploads, and more.
Key features
JWT authentication
Secure token-based auth with
user and admin roles. Tokens are valid for 7 days.Product & store CRUD
Full create, read, update, delete for products and stores, including image management via Cloudinary.
Order management
Users can place orders; admins update order status through a defined lifecycle.
Geolocation search
Find stores near a coordinate using MongoDB’s 2dsphere index with configurable radius.
Real-time WebSockets
Subscribe to live broadcasts when new products are added to the catalog.
Pagination & filtering
All list endpoints support page/limit pagination. Products support active filtering.
Get started
Register an account
Send a
POST /api/v1/auth request with your email, display name, and password to create a user account and receive a JWT token.Authenticate requests
Include your token in every request using the
Authorization: Bearer <token> header to access protected endpoints.Explore the catalog
Call
GET /api/v1/products to list available matcha products, or GET /api/v1/stores to find store locations near you.The API base URL is
http://localhost:5001 when running locally. All endpoints are prefixed with /api/v1.