Skip to main content

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:
  1. Create Express app
  2. Enable CORS via enableCors(app) (vineyard-lawn)
  3. Initialize sessions via initializeSessions() (TypeORM session store)
  4. Register Google OAuth redirect endpoint
  5. Register all API endpoints via createEndpoints(app, endpoints) (vineyard-lawn)
  6. Initialize dynamic file serving
  7. Register /health and / ping endpoints
  8. Register 404 handler
  9. 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 under equa-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)
Each endpoint specifies:
  • HTTP method and path
  • Request/response types
  • Optional requires?: PermissionCheck for 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

No explicit rate limiting middleware was found in the codebase. This is a gap for production readiness.

Process Architecture

Development

Production

Build Pipeline

Source: equa-server/package.json