SCO Autolavados ships as a fully containerized application. All three tiers — the PostgreSQL database, the Express/Prisma backend, and the React/Vite frontend — run as isolated Docker Compose services that share a private internal network. A singleDocumentation 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.
docker compose up --build command brings the entire stack online, and a named Docker volume ensures your data survives container restarts and rebuilds.
Docker Compose Services
Thedocker-compose.yml at the repository root declares three services:
sco_db — PostgreSQL 15 Database
| Property | Value |
|---|---|
| Image | postgres:15 |
| Container name | sco_db |
| Internal hostname | db |
| Credentials | Sourced from DB_USER, DB_PASSWORD, DB_NAME env vars |
| Persistence | Named volume postgres_data → /var/lib/postgresql/data |
| External ports | None (not exposed; only reachable by other services on the internal network) |
postgres_data volume is declared at the bottom of docker-compose.yml and persists independently of the container lifecycle. Removing the container does not delete your data unless you explicitly remove the volume.
sco_api — Express Backend
| Property | Value |
|---|---|
| Build context | ./backend |
| Container name | sco_api |
| Exposed ports | 3000:3000 (API), 5555:51212 (Prisma Studio) |
| Depends on | sco_db (database must start first) |
| Volume mounts | ./backend:/usr/src/app (live reload), anonymous mount for node_modules |
| Key environment | DATABASE_URL, CHOKIDAR_USEPOLLING=true |
| Working directory | /usr/src/app/src |
| Start command | npm run dev → tsx watch src/index.ts |
npx prisma generate, and exposes port 3000. In the current development configuration, the host ./backend directory is mounted into the container so that tsx watch picks up file changes without requiring a rebuild.
sco_web — React / Vite Frontend
| Property | Value |
|---|---|
| Build context | ./frontend |
| Container name | sco_web |
| Exposed ports | 5173:5173 |
| Depends on | sco_api (backend must start first) |
| Volume mounts | ./frontend:/app (live reload), anonymous mount for node_modules |
| Start command | npm run dev -- --host (Vite --host flag is required inside Docker to bind to 0.0.0.0) |
First-Time Deployment
Create your .env file
Copy the example below to the repository root and fill in your credentials. All five required variables must be present before proceeding.See the Environment Variables reference for a full explanation of each variable.
.env
Build images and start all services
Run the following command from the repository root. The Docker Compose will pull
--build flag ensures all three Docker images are compiled fresh. The -d flag runs the stack in detached (background) mode.postgres:15, build ./backend and ./frontend, create the postgres_data volume, and start all three containers in dependency order.Run database migrations
Once the containers are running, apply the Prisma migration history to create all tables in the The
sco_db database:--schema flag is required because the container’s working directory is set to /usr/src/app/src in docker-compose.yml, so Prisma must be pointed one level up to find prisma/schema.prisma. This command executes all pending migrations in backend/prisma/migrations against the live PostgreSQL instance.On first boot,
initializeApp() in src/index.ts automatically creates the AutoLavado record if none exists, so no separate seed step is needed.Development vs Production
The currentdocker-compose.yml is configured for development:
- Host directories (
./backend,./frontend) are bind-mounted into their respective containers so thattsx watchand Vite’s HMR can detect file changes without rebuilding images. - Both
sco_apiandsco_webstart their dev servers (npm run dev), not production-compiled builds. CHOKIDAR_USEPOLLING=trueis set on the backend to ensure file-watching works across Docker’s virtualized filesystem layer.
- Remove the bind-mount volume entries from
docker-compose.ymlso containers run only the code baked into their images. - Update the backend
Dockerfileto runnpm run build(TypeScript compilation) and changeCMDtonpm start(node dist/index.js). - Update the frontend
Dockerfileto runnpm run buildand serve thedist/output with a static file server such as Nginx. - Set
NODE_ENV=productionand ensureJWT_SECRETis sourced from a secrets manager rather than a plain.envfile.
Updating the Application
To deploy new code after the initial setup:Stop the running stack
postgres_data volume and your data.Prisma Studio
Prisma Studio provides a browser-based GUI for inspecting and editing database records. It is accessible athttp://localhost:5555 — Docker Compose maps host port 5555 to the container’s internal port 51212, where the studio process listens (as defined in the studio npm script: npx prisma studio --browser none --port 51212).
To launch a Prisma Studio session manually:
Prisma Studio is intended for development and debugging only. Restrict access to port
5555 in any environment where the host is reachable from the public internet.Common Commands
Environment Variables
Full reference for all
.env variables required by the stack.Multi-Currency Configuration
How exchange rates are fetched, stored, and applied to sales.