Credith ships with two Docker Compose files:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/RoyGeova07/Credith/llms.txt
Use this file to discover all available pages before exploring further.
docker-compose.yml for local development (database only, no service or website containers) and docker-compose-prod.yml for a fully self-contained production deployment. The production file builds all three services from source — credith_db (PostgreSQL 17), credith_service (Express API), and credith_website (Vite-compiled React SPA) — and wires them together with health checks and dependency ordering so the stack comes up cleanly in a single command.
Production Deployment
Build and Start the Production Stack
From the repository root, build all images and start every service in detached mode:The
--build flag forces Docker to rebuild the credith_service and credith_website images even if cached layers exist. Use this on every deployment to pick up code changes.You can follow the startup logs to monitor progress:Wait for the Database Health Check
The Expected output:
credith_service container will not start until credith_db passes its health check. The check runs pg_isready -U postgres every 5 seconds, with a timeout of 5 seconds and up to 10 retries (50 seconds maximum wait). Once PostgreSQL is accepting connections you will see the service and website containers start automatically.To verify the database is healthy:healthyMigrations and Base Data Run Automatically
The
credith_service container’s startup command runs pnpm migrate and pnpm seed:prd automatically before the API process launches. No manual migration or seeding steps are required on a fresh deployment.On startup the container will:- Run
sequelize-cli db:migrate— creates thecdschema and all tables. - Run the
20260516000000-prd-base-data.jsseeder — inserts the three roles (OWNER, ADMIN, EMPLOYEE), the initial company record, one store, one checkout machine, five product categories, and a default admin user. - Start the Express server on port
3000.
| Field | Value |
|---|---|
admin@credith.hn | |
| Password | 123456 |
| Role | OWNER |
Access the Running Application
Once the
To check all three containers are running:
credith_service container finishes its startup sequence (migrations, seeding, and server launch), Credith is ready:| Service | URL | Notes |
|---|---|---|
| React Frontend | http://your-host:4173 | Vite preview server serving the production build |
| Express API | http://your-host:3000 | Health check: GET / returns { "message": "Hello from the backend!" } |
| Swagger UI | http://your-host:3000/api-docs | Available while NODE_ENV=development; disable by setting NODE_ENV=production |
Environment Variables
All environment variables for the production stack are defined indocker-compose-prod.yml. Replace the placeholder values — especially JWT_SECRET, DB_PASSWORD, and any Cloudinary credentials — before deploying to a live server.
credith_service — Express API
| Variable | Value in docker-compose-prod.yml | Description |
|---|---|---|
NODE_ENV | development | Set to production to disable Swagger UI and enable production-mode logging. |
PORT | 3000 | Port the Express server listens on inside the container. |
JWT_SECRET | visca_barca_visca_catalunya | Must be changed. Secret key used to sign and verify JWT tokens. |
DB_HOST | credith_db | Hostname of the PostgreSQL container (Docker service name). |
DB_PORT | 5432 | PostgreSQL port. |
DB_NAME | credith | Name of the database. |
DB_USER | postgres | PostgreSQL user. |
DB_PASSWORD | 123456 | Must be changed. PostgreSQL password. Must match POSTGRES_PASSWORD on credith_db. |
DB_DIALECT | postgres | Sequelize dialect — always postgres for this project. |
CORS_ORIGIN | http://localhost:4173 | The frontend origin that the API will accept cross-origin requests from. Update to your production domain. |
credith_website — React Frontend (Build Arguments)
| Build Argument | Value in docker-compose-prod.yml | Description |
|---|---|---|
VITE_BASE_ROUTE | http://localhost:3000 | Base URL for all API requests made by the frontend. Update to your API’s public URL. |
VITE_CLOUDINARY_CLOUD_NAME | (commented out) | Optional. Your Cloudinary cloud name for product image uploads. |
VITE_CLOUDINARY_UPLOAD_PRESET | (commented out) | Optional. Your Cloudinary unsigned upload preset. |
Docker Services
The production Compose file defines three services that together form the complete Credith stack:credith_db — PostgreSQL 17
postgres:17 image. The database is initialized with POSTGRES_DB=credith, POSTGRES_USER=postgres, and POSTGRES_PASSWORD=123456. A pg_isready health check gates the startup of all dependent services. Port 5432 is exposed to the host for direct access with tools like psql or TablePlus.
credith_service — Express REST API
Service/dockerfile. The container starts only after credith_db reports a healthy status. On first launch the container’s startup command automatically runs pnpm migrate (creates all tables) and pnpm seed:prd (inserts the production baseline) before starting the Express server. All business logic, authentication (JWT + bcrypt), CAI validation, invoice generation, and payment plan management live in this service. The API is reachable at port 3000.
credith_website — React SPA (Vite)
Website/dockerfile. During the Docker build, Vite compiles the React application with VITE_BASE_ROUTE and any Cloudinary arguments baked into the static bundle. The compiled assets are served via vite preview on port 4173. Because Vite environment variables are inlined at build time, you must rebuild the image whenever VITE_BASE_ROUTE or the Cloudinary settings change.
Cloudinary Integration (Optional)
Credith supports uploading product images to Cloudinary. This is entirely optional — products without images display a placeholder in the frontend. To enable image uploads:- Create a free Cloudinary account and note your Cloud Name.
- In the Cloudinary dashboard, create an unsigned upload preset and note its name.
- In
docker-compose-prod.yml, uncomment and populate the two build args for thecredith_websiteservice:
- Rebuild the website image for the new environment variables to take effect:
VITE_CLOUDINARY_CLOUD_NAME and VITE_CLOUDINARY_UPLOAD_PRESET are Vite build-time variables, they are embedded directly into the compiled JavaScript bundle. Changing them requires a full image rebuild — they cannot be injected at runtime.
Swagger UI (
/api-docs) is only enabled when NODE_ENV=development. In production, set NODE_ENV=production in the credith_service environment block to disable the interactive API explorer and reduce the attack surface.