Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Luisangelebp/SCO_Autolavados/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through spinning up a complete SCO Autolavados environment on your local machine. By the end you will have all three services running — PostgreSQL database, Express API, and React frontend — with a seeded database and a working JWT token ready for API exploration.
The server will immediately exit at startup if JWT_SECRET is not defined in your environment. Make sure this variable is set in your .env file before running docker compose up.

Steps

1

Prerequisites

Ensure the following tools are installed on your machine before proceeding.
ToolMinimum VersionCheck Command
Docker24+docker --version
Docker Compose2.20+docker compose version
Git2.30+git --version
docker --version
docker compose version
git --version
Docker Desktop for macOS and Windows bundles both Docker Engine and Docker Compose. On Linux, install Docker Compose v2 as a plugin separately.
2

Clone the Repository

Clone the SCO Autolavados repository from GitHub and navigate into the project root.
git clone https://github.com/Luisangelebp/SCO_Autolavados.git
cd SCO_Autolavados
3

Configure Environment Variables

The application requires several environment variables to be present before the containers start. Create a .env file in the project root (alongside docker-compose.yml).
touch .env
Populate it with the following values:
# PostgreSQL credentials — consumed by the `db` Docker Compose service
DB_USER=sco_user
DB_PASSWORD=supersecretpassword
DB_NAME=sco_autolavados

# Prisma / Backend connection string
# The host must be `db` (the Docker Compose service name), not `localhost`
DATABASE_URL=postgresql://sco_user:supersecretpassword@db:5432/sco_autolavados

# JWT secret used to sign and verify all authentication tokens
JWT_SECRET=replace_this_with_a_long_random_string
Variable reference:
VariableDescription
DB_USERPostgreSQL superuser name, passed to the sco_db container
DB_PASSWORDPostgreSQL password, passed to the sco_db container
DB_NAMEName of the database to create inside PostgreSQL
DATABASE_URLFull Prisma connection string; the host segment must be db (the Compose service name)
JWT_SECRETArbitrary secret string for JWT signing — the server exits if this is absent
Never commit your .env file to version control. The repository’s .gitignore should already exclude it, but double-check before pushing.
4

Start the Stack

Build all images and start all three services in the foreground so you can watch the logs:
docker compose up --build
Docker Compose will start the following services:
ContainerImagePort(s)Role
sco_dbpostgres:15(not exposed externally)PostgreSQL 15 database with persistent postgres_data volume
sco_apiCustom (built from ./backend)3000:3000, 5555:51212Express REST API + Prisma Studio
sco_webCustom (built from ./frontend)5173:5173React/Vite frontend (depends on sco_api)
Wait until you see the following line in the logs before proceeding:
[server]: Servidor corriendo en http://localhost:3000
Prisma Studio is exposed at http://localhost:5555. It maps to port 51212 inside the sco_api container (configured via the 5555:51212 port mapping in docker-compose.yml). You can use it to inspect and edit database records visually without writing SQL.
5

Run Database Migrations and Seed

With the containers running, open a second terminal and apply the Prisma migration to create all tables, then seed the database with initial data (admin user, sample laundrer, and seed customer).
# Apply all pending migrations
docker compose exec backend npx prisma migrate deploy

# Seed the database with initial data
docker compose exec backend npx tsx prisma/seed.ts
A successful migration will print each applied migration name. The seed script creates the default AutoLavado configuration record, roles, and initial users so you can immediately start testing the full business flow.
The backend/package.json does not define a prisma.seed configuration entry, so npx prisma db seed will not work. The seed file is a plain TypeScript script — run it directly with tsx as shown above.
6

Make Your First API Call

Authenticate as the admin user to receive a JWT token. Use the seeded credentials:
curl -X POST http://localhost:3000/api/users/login \
  -H "Content-Type: application/json" \
  -d '{"identifier": "admin", "password": "admin123"}'
A successful response looks like this:
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "uuid",
    "email": null,
    "role": "ADMIN"
  }
}
Copy the token value and use it as a Bearer token in the Authorization header for all subsequent protected API requests:
curl http://localhost:3000/api/service-orders \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
A POST /api/users/refresh endpoint is also available for token renewal. Send the refreshToken value (returned alongside token in the login response) in the request body to receive a new access token without re-authenticating:
curl -X POST http://localhost:3000/api/users/refresh \
  -H "Content-Type: application/json" \
  -d '{"refreshToken": "<your_refresh_token>"}'

What’s Next?

Now that your environment is running and you have an authenticated token, explore the core concepts and API reference:

Users & Roles

Learn how the Admin, Customer, and Laundrer roles work, how accounts are created for each, and how JWT middleware enforces access control across all routes.

API Reference

Browse the full HTTP API — all endpoints, request bodies, response shapes, and authentication requirements across every module.

Build docs developers (and LLMs) love