git clone https://github.com/<you>/backend.git
cd backend
npm install
cp .env.example .env # set JWT_SECRET
npm run db:seed
npm run devNode.js 22.13 or newer is required for the built-in node:sqlite module
(see .nvmrc).
Environment variables and troubleshooting: docs/DEVELOPMENT.md and docs/ENVIRONMENT.md.
Every fork of this repository is listed in CONTRIBUTORS.md.
Most were created before the current code landed and are many commits behind
main. Sync yours before you start, or you will be working on code that no
longer exists:
# GitHub CLI
gh repo sync <you>/<your-fork> --source StellarPOS-App/backend --branch main
# or plain git, from your clone
git remote add upstream https://github.com/StellarPOS-App/backend.git
git fetch upstream
git checkout main && git merge --ff-only upstream/main && git pushYou can also click Sync fork on your fork's GitHub page. Once your first pull request is merged, you move from the Forks list to the contributors table.
- Open or claim an issue for anything beyond a typo.
- Branch from
main:feat/...,fix/...,docs/...,test/.... - Commit with Conventional Commits,
for example
feat(payments): ...orfix(products): .... - Run
npm run check(lint, type-check, tests). CI also runs Prettier and a Docker build. - Open a pull request using the template, with
Closes #N.
- Layers. Routes validate input and shape responses. Business rules live
in
services/. SQL lives inmodels/. Onlyservices/horizon.tstalks to the Stellar network. - Validation. Every request body goes through a Joi schema in
validation/viavalidateBody. Unknown keys are stripped. - Errors. Throw
AppError(message, status), or thenotFound,conflictandbadRequesthelpers. Never send error responses by hand from deep code. - Money. Integer cents for store amounts,
bigintstroops for Stellar (utils/money.ts). Never use floats for money. - Multi-step writes go through
withTransactionso a failure rolls back. - Tests. Every endpoint change needs a Supertest test. Mock the network
at
@/services/horizon, never at the SDK. - Secrets. Never log tokens, passwords, or anything that looks like a key.
By participating you agree to the Code of Conduct.