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:
| Variable | Description | Default |
|---|---|---|
DATABASE_URL | SQLite path or PostgreSQL connection | file:./dev.db |
PORT | HTTP listen port | 3000 |
SESSION_SECRET | Session encryption secret | — |
API_KEY_SALT | Salt 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_URLas a Postgres connection string). - Enable HTTPS with a valid certificate.
- Use a process manager (e.g., PM2) or container orchestration for high availability.