Self-Hosted Deployment

Overview

The Truss API is a Node.js/Fastify application backed by SQLite (development) or PostgreSQL (production).

Prerequisites

  • Node.js 18+
  • npm

Quick Start

git clone <repo-url> truss-api
cd truss-api
npm install

Configuration

Set the following environment variables:

VariableDescriptionDefault
DATABASE_URLSQLite path or PostgreSQL connectionfile:./dev.db
PORTHTTP listen port3000
SESSION_SECRETSession encryption secret
API_KEY_SALTSalt for API key hashing

Migrations and Startup

npx prisma migrate deploy
npm start

The API serves its OpenAPI specification at GET /openapi.json.

Production Recommendations

  • Reverse proxy with nginx for TLS termination and rate limiting.
  • Replace SQLite with PostgreSQL (DATABASE_URL as a Postgres connection string).
  • Enable HTTPS with a valid certificate.
  • Use a process manager (e.g., PM2) or container orchestration for high availability.