Skip to main content

Prerequisites

  • Node.js >= 20.16.0
  • Docker and Docker Compose
  • npm (bundled with Node.js)

Setup

1

Clone the repository

git clone <repository-url> shoptoken-backend
cd shoptoken-backend
2

Install dependencies

npm install
3

Configure environment

Copy the example environment file and update values as needed:
cp .env.example .env
See Configuration for details on all environment variables.
4

Start infrastructure services

Launch PostgreSQL, Redis, and Elasticsearch via Docker Compose:
npm run dev
This starts:
  • PostgreSQL on port 54321
  • Redis on port 63791
  • Elasticsearch on port 9200
5

Run database migrations

Migrations run automatically when the Docker migrator service starts. To run manually:
npm run typeorm:run-migrations
6

Start the development server

npm run start:dev
The API will be available at http://localhost:3001. Verify with:
curl http://localhost:3001/ping

Available Commands

CommandDescription
npm run start:devStart in watch mode
npm run start:debugStart with debugger on port 9229
npm run build:merchant-apiBuild for production
npm testRun all tests
npm run test:watchRun tests in watch mode
npm run test:coverage-reportGenerate coverage report
npm run test:e2eRun end-to-end tests
npm run devStart Docker Compose environment
npm run dev:buildRebuild Docker containers

Verify Installation

After starting the server, confirm everything is working:
# Health check
curl http://localhost:3001/ping
# Expected: "pong"

Next Steps