Skip to main content

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.

This guide takes you from zero to a fully running Credith instance on your local machine. By the end you will have the PostgreSQL database, the Express API, and the React frontend all running in Docker — plus demo data loaded and your first API call verified. The only thing you need to start is Docker already installed.

Steps

1

Prerequisites

Make sure the following tools are available on your machine before proceeding:
ToolMinimum VersionPurpose
Docker DesktopLatest stableRuns all three services (DB, API, frontend)
Node.js18+Required to run pnpm CLI commands outside of Docker
pnpm11+Package manager used by both Service and Website workspaces
Verify your setup:
docker --version
node --version
pnpm --version
2

Clone the Repository

Clone the Credith monorepo and navigate into it:
git clone https://github.com/RoyGeova07/Credith.git
cd Credith
The repository has two main workspaces:
  • Service/ — Express REST API (Node.js + Sequelize)
  • Website/ — React SPA (Vite)
3

Configure Environment Variables

The full-stack Docker Compose file (docker-compose-prod.yml) includes sensible defaults for local development. If you want to override any value, edit the environment block in docker-compose-prod.yml directly.
Never commit secrets to the repository. If you copy values to a .env file, confirm it is listed in .gitignore.
The full set of environment variables consumed by the credith_service container:
VariableDefaultDescription
NODE_ENVdevelopmentControls Swagger UI availability and logging
PORT3000Port the Express server binds to
JWT_SECRETvisca_barca_visca_catalunyaSecret used to sign JWT tokens
DB_HOSTcredith_dbPostgreSQL container hostname
DB_PORT5432PostgreSQL port
DB_NAMEcredithDatabase name
DB_USERpostgresDatabase user
DB_PASSWORD123456Database password
DB_DIALECTpostgresSequelize dialect
CORS_ORIGINhttp://localhost:4173Allowed frontend origin for CORS
The credith_website container takes one required build argument:
Build ArgumentDefaultDescription
VITE_BASE_ROUTEhttp://localhost:3000Base URL the frontend uses for all API requests
4

Start Docker Compose

Spin up all three services — the database, the API, and the frontend — with a single command from the project root:
docker compose -f docker-compose-prod.yml up --build
Docker Compose will:
  1. Pull postgres:17 and start credith_db with a health check (pg_isready).
  2. Build the Service/dockerfile and start credith_service on port 3000 (waits for the DB to be healthy). On first start the container automatically runs migrations and the production seeder before launching the API.
  3. Build the Website/dockerfile with VITE_BASE_ROUTE=http://localhost:3000 and start credith_website on port 4173.
Wait until you see output similar to:
credith_service  | Example app listening on port 3000
5

Load Demo Data (Optional)

The credith_service container automatically runs pnpm migrate and pnpm seed:prd on startup, so the database is already populated with the production baseline (roles, initial company, one store, one checkout machine, five categories, and a default admin account) by the time the API is ready.To additionally load a rich set of mock data — two demo companies, three stores, five users, six products, four categories, active CAIs and ranges, four clients, and 21 bills spanning January–June 2026 with full installment payment plan data — run the dev seeder once the service is up:
docker exec -it credith_service pnpm seed:dev
Run pnpm seed:dev only once. Executing it a second time will attempt to insert duplicate records and will fail with a unique-constraint error.
6

Open the App

Your Credith instance is now fully operational:
ServiceURLDescription
React Frontendhttp://localhost:4173Login, POS dashboard, reports, management panels
Express APIhttp://localhost:3000Health check — returns { "message": "Hello from the backend!" }
Swagger UIhttp://localhost:3000/api-docsInteractive API reference (development mode only)
Log in with the seeded admin credentials:
  • Email: admin@credith.hn
  • Password: 123456

First API Calls

With the service running, verify it and create your first user:
curl http://localhost:3000/
The health-check returns:
{ "message": "Hello from the backend!" }
The POST /api/users/login endpoint validates credentials and sets two cookies: an HttpOnly cookie containing the signed JWT (used automatically by the browser on subsequent authenticated requests) and a readable session cookie with user details and role. Use POST /api/users/logout to clear both cookies. The POST /api/users endpoint registers a new user, hashes the password with bcrypt, assigns the EMPLOYEE role by default (or ADMIN if role is provided in the body), and returns the created user object. Field names use snake_case: first_name, second_name, first_last_name, second_last_name. Both storeId and checkoutMachineId (UUIDs of existing records) are required.
The Swagger UI at http://localhost:3000/api-docs is only available when NODE_ENV=development. It documents every route in the API with request/response schemas, generated automatically from JSDoc annotations on each route file. This is the fastest way to explore the full API surface.
Ready to move beyond local development? See the Deployment guide to run Credith in production using the docker-compose-prod.yml file, including how to configure Cloudinary for product image uploads.

Build docs developers (and LLMs) love