Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Eleazarguitar18/kantuta_pos_back/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through cloning the repository, wiring up the required services, starting the development server, and making your first authenticated request — all in under 5 minutes. By the end you will have a live Kantuta POS API running on http://localhost:3000 with the interactive Swagger UI available at /api.

Prerequisites

Before you begin, make sure the following are installed and accessible on your machine:
  • Node.js v22+ — the version used by the project’s type definitions (@types/node ^22)
  • PostgreSQL — any recent version; you’ll need a database created and credentials handy
  • Redis — running locally on the default port 6379, or accessible via a remote URL
  • npm — bundled with Node.js; no alternative package manager configuration is needed

Steps

1

Clone the repository and install dependencies

Clone the project from GitHub and install all Node.js packages:
git clone https://github.com/Eleazarguitar18/kantuta_pos_back.git
cd kantuta_pos_back
npm install
npm install resolves every dependency declared in package.json, including NestJS 11 core packages, TypeORM, Baileys, AI SDKs, and all dev tooling.
2

Create your .env file

Create a .env file in the project root. You can use .env.example as a starting point if it exists, or create the file from scratch with at minimum the variables below:
# PostgreSQL
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_USER=your_db_user
DATABASE_PASSWORD=your_db_password
DATABASE_NAME=kantuta_pos
DATABASE_SSL=false

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=

# JWT
JWT_SECRET=replace_with_a_long_random_secret_string
JWT_EXPIRES_IN=8h
JWT_REFRESH_SECRET=replace_with_another_long_random_secret
JWT_REFRESH_EXPIRES_IN=7d

# Server
PORT=3000
NODE_ENV=development
The database schema is applied automatically on startup because synchronize: true is set in the TypeORM configuration. You do not need to run migrations manually in development.
3

Start the development server

Launch the API in watch mode so it recompiles on every file change:
npm run start:dev
You should see NestJS bootstrap output followed by a line confirming the server is listening:
[NestApplication] Nest application successfully started
The server binds to 0.0.0.0 on the port defined by PORT (default 3000). The Swagger UI is immediately available at:
http://localhost:3000/api
4

Make your first login request

The POST /auth/login endpoint is public (no bearer token required). Send your credentials to receive a JWT access token and a refresh token:
curl -X POST http://localhost:3000/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "your_password"}'
A successful response looks like:
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Copy the access_token — you’ll pass it as a bearer token on every subsequent protected request.
5

Use the token in subsequent requests

Pass the access_token in the Authorization header as a Bearer token:
curl http://localhost:3000/auth \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
When the access token expires, obtain a new one by calling POST /auth/refresh_token and supplying the refresh_token in the same Authorization: Bearer header:
curl -X POST http://localhost:3000/auth/refresh_token \
  -H "Authorization: Bearer <your_refresh_token>"

Available npm Scripts

ScriptCommandDescription
Developmentnpm run start:devStart with hot-reload (file watch)
Buildnpm run buildCompile TypeScript to dist/
Productionnpm run start:prodRun the compiled build with node dist/main
Unit testsnpm run testRun Jest unit test suites
E2E testsnpm run test:e2eRun end-to-end tests via test/jest-e2e.json config
Coveragenpm run test:covRun tests and generate a coverage report
Open http://localhost:3000/api in your browser while the server is running to access the full Swagger UI. Every endpoint is listed with its required headers, body schema, and response shape. Click Authorize in the top-right corner, paste your access_token, and you can try any protected endpoint directly from the browser — no curl needed.

Build docs developers (and LLMs) love