This guide walks you through cloning the repository, wiring up all required environment variables, starting the development server, and completing a full authentication flow — from registering a new account to making authenticated requests with your JWT token. The whole process takes about five minutes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/Ecommerce/llms.txt
Use this file to discover all available pages before exploring further.
Clone the repository
Pull the project from GitLab and move into the directory:The source code lives entirely inside the
src/ subdirectory. Configuration is loaded from a .env file you will create in the project root (next step).Install dependencies
Install all Node.js dependencies declared in Key packages installed include
package.json:express, mongoose, jsonwebtoken, bcrypt, multer, sharp, @google-cloud/storage, nodemailer, passport, passport-google-oauth20, socket.io, and swagger-ui-express.Create the .env file
Create a
.env file in the project root (the same level as package.json, not inside src/). Populate every variable — the server will start with empty strings for missing values, but features that depend on them will silently fail..env
Start the development server
The You should see output like:The server listens on
dev script uses Nodemon to watch for file changes and Babel to transpile ES module syntax on the fly:PORT from your .env (defaulting to 3000 if unset). Nodemon will automatically restart the server whenever you save a source file.Register a new user
Send a
POST request to /api/user/register with all required fields. On success the server emails a 5-digit verification code to the address provided.All nine fields are required — the server returns 203 if any are missing.| Field | Type | Allowed Values |
|---|---|---|
firstName | string | Any |
lastName | string | Any |
email | string | Valid email address |
password | string | Any (hashed with bcrypt) |
phone | string | Numeric phone number |
sex | string | Masculino, Femenino, Otro |
document | string | Numeric document number |
documentType | string | CC, CE, Pasaporte |
birthdate | string | Date string e.g. 1995-05-20 |
Verify your account
Check your inbox for the 5-digit code. Submit it alongside your email to activate your account. Without this step, login will be rejected with
403.The code is a 5-character string of digits. It is stored in
login_code on the User document and matched exactly — make sure to send it as a string, not a number.Log in and retrieve your JWT token
With your account verified, log in to receive a signed JWT. The token is valid for 365 days and must be sent with every protected request.Copy the
token value from the response — you will need it in the next step.Complete Auth Flow at a Glance
Here is the full registration-to-authenticated-request sequence in one place:Prefer interactive exploration? Open
http://localhost:3000/api-docs in your browser once the server is running. Swagger UI lets you try every endpoint directly from your browser — no cURL required.