Thank you for your interest in contributing! This guide will help you get started and ensure consistency across contributions.
This project is a backend API built with:
- NestJS (TypeScript)
- TypeORM (the persistence layer for the application schema)
- PostgreSQL (production) with a SQLite fallback for local development
- Jest for testing
TypeORM is the persistence layer for the application schema. Entities live alongside their
feature modules, and migrations live in src/migrations/. The data source is
src/config/data-source.ts, which selects PostgreSQL when DATABASE_URL is set and falls
back to SQLite otherwise.
npm run migration:run # Apply pending migrations
npm run migration:revert # Roll back the most recent migration
npm run migration:generate # Generate a migration after changing an entityTwo things to know before you touch the schema:
- CI enforces the migrations. The
Schema Migration and Drift Gatejob inci.ymlapplies every migration to an empty PostgreSQL database, then reverts and re-applies the latest one, then fails if the entities do not exactly match the migrated schema. Generate a migration whenever you change an entity; an unmigrated entity change fails the gate. - A legacy Prisma layer still exists and is not the application schema. It is retained
for a set of identity, analytics, outbox and AI-assistant features. Do not run
prisma migrateagainst it, and do not assume its tables describe the protocol schema. Readdocs/PRISMA_INVENTORY.mdbefore adding anything that touches it.
git clone https://github.com/DigiNodes/truthbounty-api.git
cd truthbounty-api
# Use Node 20 LTS with npm 10 (see "Supported Runtime and Toolchain" in docs/DEPLOYMENT.md)
nvm use 20
# Install exactly what package-lock.json records
npm ci