Backend Architecture
Repository: equa-server | Stack: Express, TypeORM, PostgreSQL, Node 18, vineyard-lawn
Server Entry Point
Source:equa-server/modules/api/src/server.ts (function startApi(), lines 180-198)
The server starts with this sequence:
- Create Express app
- Enable CORS via
enableCors(app)(vineyard-lawn) - Initialize sessions via
initializeSessions()(TypeORM session store) - Register Google OAuth redirect endpoint
- Register all API endpoints via
createEndpoints(app, endpoints)(vineyard-lawn) - Initialize dynamic file serving
- Register
/healthand/ping endpoints - Register 404 handler
- Start Express on configured port (default: 3000)
SSL Support
Source:equa-server/modules/api/src/server.ts (function startExpress(), lines 53-98)
SSL is optional, activated when API_SSL env var is set. Reads certs from SSL_PRIVATE_KEY_PATH and SSL_PUBLIC_KEY_PATH.
Module Inventory
The backend is organized into 20 modules underequa-server/modules/:
Endpoint Framework: vineyard-lawn
Endpoints are defined using vineyard-lawn’s type-safe endpoint system. Source:equa-server/modules/api/src/lib/utility.ts (lines 60-94)
- HTTP method and path
- Request/response types
- Optional
requires?: PermissionCheckfor authorization - Versioning (v1 prefix)
Endpoint Files
Source:equa-server/modules/api/src/endpoints/
Agent-specific endpoints in
equa-server/modules/agent/src/endpoints/:
agent-endpoints.ts— Chat, confirmations, context, tools, onboarding
Database Layer
Source:equa-server/modules/persistence/src/site/connecting.ts
Entity Registration
Source:equa-server/modules/persistence/src/schema.ts (lines 2008-2101)
All 92 entities are registered in the allEntities array and loaded during connection initialization.
Middleware Stack
Process Architecture
Development
Production
Build Pipeline
Source:equa-server/package.json