Conduct

Backend Overview

Overview

The Conduct backend is a self-hostable Node.js service that provides:

  • REST API with 35 endpoints
  • Multi-database support (PostgreSQL, MySQL, SQLite)
  • API key authentication
  • File storage abstraction
  • Rate limiting and security features

Key Features

API Endpoints

Complete CRUD operations for:

  • Specs
  • Runs
  • Checks
  • Features
  • API keys

Database Support

Three adapters for flexibility:

  • PostgreSQL (recommended for production)
  • MySQL (compatible alternative)
  • SQLite (development only)

Authentication

API key-based with permissions:

  • Read
  • Write
  • Delete
  • Admin

Storage

Pluggable storage system:

  • Local filesystem
  • S3-compatible storage
  • Google Cloud Storage
  • Custom adapters

Performance

  • Cursor-based pagination
  • Connection pooling
  • Response caching
  • Rate limiting

Architecture

Express Server
├── Authentication Middleware
├── Rate Limiting
├── Request Validation
├── API Routes (/v1/)
│   ├── /specs
│   ├── /runs
│   ├── /checks
│   ├── /features
│   └── /auth
├── Drizzle ORM
│   ├── PostgreSQL Adapter
│   ├── MySQL Adapter
│   └── SQLite Adapter
└── File Storage
    ├── Local Storage
    └── Cloud Storage (extensible)

Tech Stack

  • Runtime: Node.js 18+
  • Framework: Express.js
  • ORM: Drizzle
  • Validation: Zod
  • Storage: Pluggable adapters
  • Database: PostgreSQL/MySQL/SQLite

Repository Structure

backend/
├── src/
│   ├── db/              # Database layer
│   │   ├── schema.ts    # Drizzle schema
│   │   ├── postgres.ts  # PostgreSQL adapter
│   │   ├── mysql.ts     # MySQL adapter
│   │   └── sqlite.ts    # SQLite adapter
│   ├── api/             # API routes
│   │   ├── specs.ts
│   │   ├── runs.ts
│   │   ├── checks.ts
│   │   ├── features.ts
│   │   └── auth.ts
│   ├── storage/         # File storage
│   │   ├── local.ts
│   │   └── interface.ts
│   ├── middleware/      # Express middleware
│   │   ├── auth.ts
│   │   ├── rateLimit.ts
│   │   └── validate.ts
│   └── utils/           # Utilities
├── scripts/             # Database scripts
│   ├── migrate.ts
│   └── seed.ts
├── example-server.ts    # Example implementation
├── Dockerfile
└── docker-compose.yml

Statistics

  • 50+ TypeScript files
  • ~6,000 lines of code
  • 35 API endpoints
  • 3 database adapters
  • Zero TypeScript errors

Quick Start

cd backend
 
# Install dependencies
pnpm install
 
# Start database
docker-compose up -d postgres
 
# Run migrations
npm run db:setup
 
# Start server
tsx example-server.ts

Server runs at http://localhost:3000.

Configuration

Environment variables:

PORT=3000
NODE_ENV=production
DATABASE_URL=postgresql://user:pass@localhost:5432/conduct
STORAGE_TYPE=local
STORAGE_PATH=./storage
RATE_LIMIT_MAX=100

API Documentation

Complete API reference available at:

Next Steps

On this page