Balsamoa Backend is a Node.js REST API built with Express 5 that serves as the complete backend for the Balsamoa clothing store. It manages a product catalog with size and color variant inventory, handles image uploads through Multer, and exposes two distinct API surfaces: a public read-only store API for the storefront and a full CRUD admin API for the management panel. The database layer runs on PostgreSQL hosted by Supabase, accessed through a connection pool managed by theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/MateoNavarroMN/Balsamoa-Backend/llms.txt
Use this file to discover all available pages before exploring further.
pg driver.
Key features
Full CRUD for products
Create, read, update, and delete products through the admin API at
/api/v1/admin/productos. Includes logical activation and deactivation so products can be hidden without permanent deletion.Size and color variant inventory
Every product supports granular stock tracking per size (
talles) and color (colores) combination via the variantes table, with a pre-loaded catalog of 5 sizes and 8 colors.Image upload via Multer
Upload product images directly to the server’s public folder through
POST /api/v1/admin/imagenes/subir. Images are served as static assets under /recursos and can be removed via DELETE /api/v1/admin/imagenes/:id.Public store API with censored stock
The tienda routes at
/api/v1/tienda/productos expose product data suitable for the storefront — full catalog details including variant availability — without surfacing raw admin fields. Supports an optional ?destacados=true query parameter to return only featured products.Admin panel at /admin
A static HTML admin panel is served directly by Express at the
/admin route, allowing store managers to browse products, create new entries, and manage inventory from a web UI with no separate frontend server required.PostgreSQL via Supabase connection pool
Database connections are managed through a
pg.Pool with SSL enforced (rejectUnauthorized: false), pointing at Supabase’s transaction pooler on port 6543 for reliable serverless-compatible connections.Tech stack
| Technology | Role |
|---|---|
| Node.js (ES Modules) | Runtime; all source files use .mjs extensions and native import/export syntax |
| Express 5 | HTTP framework for routing, middleware, and static file serving |
PostgreSQL via pg driver | Relational database access with a Pool for connection reuse |
| Supabase | Hosted PostgreSQL database with a pooler endpoint for production connections |
| Multer | Multipart form-data middleware for handling product image uploads |
| dotenv | Loads DATABASE_URL and PUERTO from a .env file into process.env |
| nodemon | Development-time file watcher that restarts the server on source changes |
Project structure
The repository follows a module-per-domain layout insidesrc/modulos/, keeping routes, controllers, and models co-located for each resource.
API base URL
All API routes are versioned under the Port
/api/v1/ prefix. Admin routes live under /api/v1/admin/ and public store routes under /api/v1/tienda/.3003 is the value set in .env.example. The server code defaults to port 3000 when PUERTO is not set — set PUERTO=3003 in your .env file to match the configured default.