This guide walks you through setting up a local KaroKar Backend instance from scratch. You will clone the repository, wire up a PostgreSQL database, run TypeORM migrations, and fire a real API request against the running server. The entire flow should take fewer than five minutes on a machine that already has Node.js and PostgreSQL installed.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Codefied-CodePix/Karokar-backend/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Node.js ≥ 18 and npm ≥ 9
- PostgreSQL ≥ 14 running locally (or a remote connection string)
- Git
Clone the repository and install dependencies
Clone the repo and install all Node dependencies with a single command.
npm install resolves both production dependencies (NestJS, TypeORM, Passport, etc.) and dev dependencies (TypeScript compiler, NestJS CLI schematics, type definitions).Configure your environment
Copy the example environment file and update the values for your local setup.The
Create the database if it does not exist yet:
.env.example ships with these defaults:| Variable | Description |
|---|---|
NODE_ENV | Runtime environment. Use development locally. |
PORT | HTTP port the server binds to. Defaults to 3000. |
DATABASE_URL | Full PostgreSQL connection string. Create the karokar database before running migrations. |
JWT_SECRET | Secret used to sign and verify JWT tokens. Must be changed in production. |
The TypeORM connection is configured with
synchronize: false, which means the schema is never auto-updated at startup. All schema changes are managed exclusively through migrations — see the next step.Run database migrations
KaroKar uses TypeORM migrations (via Under the hood this runs:You should see each migration logged as it is applied. If you need to roll back the most recent migration:
src/database/data-source.ts) to manage the schema. Apply all pending migrations to your database:Start the development server
Launch the NestJS application in watch mode. The compiler will rebuild and reload on every file change.Once bootstrapped, the server is available at the port defined in your
.env (default 3000):A global
ValidationPipe is applied at bootstrap with whitelist: true, forbidNonWhitelisted: true, and transform: true. This means any request body property that is not declared in the corresponding DTO is automatically stripped, and extra unknown properties cause a 400 Bad Request rather than being silently ignored. Always model your request bodies against the published DTOs.Make your first API call
The
A successful response returns
POST /users endpoint creates a new user in the Identity domain and requires the employee.manage permission encoded in a valid JWT.Request:| Field | Type | Description |
|---|---|---|
firstName | string | User’s given name |
lastName | string | User’s family name |
email | string | Unique email address |
phone | string (optional) | Contact phone number |
201 Created with the newly created user resource. A missing or expired token returns 401 Unauthorized; insufficient permissions return 403 Forbidden.Next Steps
- Read the Architecture guide to understand bounded contexts, module structure, and the non-negotiable rules enforced across the codebase.
- Review the Introduction for a full overview of participant types and the tech stack.