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.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.
Steps
Prerequisites
Make sure the following tools are available on your machine before proceeding:
Verify your setup:
| Tool | Minimum Version | Purpose |
|---|---|---|
| Docker Desktop | Latest stable | Runs all three services (DB, API, frontend) |
| Node.js | 18+ | Required to run pnpm CLI commands outside of Docker |
| pnpm | 11+ | Package manager used by both Service and Website workspaces |
Clone the Repository
Clone the Credith monorepo and navigate into it:The repository has two main workspaces:
Service/— Express REST API (Node.js + Sequelize)Website/— React SPA (Vite)
Configure Environment Variables
The full-stack Docker Compose file (The full set of environment variables consumed by the
The
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.credith_service container:| Variable | Default | Description |
|---|---|---|
NODE_ENV | development | Controls Swagger UI availability and logging |
PORT | 3000 | Port the Express server binds to |
JWT_SECRET | visca_barca_visca_catalunya | Secret used to sign JWT tokens |
DB_HOST | credith_db | PostgreSQL container hostname |
DB_PORT | 5432 | PostgreSQL port |
DB_NAME | credith | Database name |
DB_USER | postgres | Database user |
DB_PASSWORD | 123456 | Database password |
DB_DIALECT | postgres | Sequelize dialect |
CORS_ORIGIN | http://localhost:4173 | Allowed frontend origin for CORS |
credith_website container takes one required build argument:| Build Argument | Default | Description |
|---|---|---|
VITE_BASE_ROUTE | http://localhost:3000 | Base URL the frontend uses for all API requests |
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 will:
- Pull
postgres:17and startcredith_dbwith a health check (pg_isready). - Build the
Service/dockerfileand startcredith_serviceon port3000(waits for the DB to be healthy). On first start the container automatically runs migrations and the production seeder before launching the API. - Build the
Website/dockerfilewithVITE_BASE_ROUTE=http://localhost:3000and startcredith_websiteon port4173.
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: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.Open the App
Your Credith instance is now fully operational:
Log in with the seeded admin credentials:
| Service | URL | Description |
|---|---|---|
| React Frontend | http://localhost:4173 | Login, POS dashboard, reports, management panels |
| Express API | http://localhost:3000 | Health check — returns { "message": "Hello from the backend!" } |
| Swagger UI | http://localhost:3000/api-docs | Interactive API reference (development mode only) |
- Email:
admin@credith.hn - Password:
123456
First API Calls
With the service running, verify it and create your first user: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.