Home Docs Schema Formats Errors
Conduit

Architecture

Architecture Overview

Conduit is built as a clean, layered system. Each component has a single responsibility, making the engine predictable, testable, and easy to extend.

Architecture Overview

Conduit is composed of decoders, routers, service logic, database drivers, encoders, authorization modules, and an error system. Together, these components form a complete request‑to‑response pipeline.

Request Flow

Every request follows the same high‑level path:

  1. Decoder parses the incoming payload
  2. Router selects the correct handler
  3. Authorization module evaluates permissions
  4. Service layer performs schema or CRUD logic
  5. Database driver executes SQL
  6. Encoder formats the response
  7. Error system handles failures

Decoders

Decoders convert incoming request bodies into Go objects. Conduit supports multiple input formats:

  • JSON
  • YAML
  • TOML
  • XML
  • CSV
  • NDJSON
  • CBOR

The decoder automatically detects the format based on the Content-Type header.

Router

The router maps HTTP paths to handlers. Conduit exposes two major API groups:

  • /v1/schema — table creation, deletion, introspection
  • /v1/<table> — CRUD operations

Routing is dynamic: Conduit generates endpoints based on the database schema.

Authorization

Authorization is handled before any database or service logic runs. Conduit supports:

  • No‑Op Auth
  • Environment‑based Auth
  • Database‑backed Auth

Authorization determines whether the request may read, write, or mutate schema.

Service Layer

The service layer contains the core logic for schema operations and CRUD operations. It enforces:

  • Validation rules
  • Ignored columns
  • Default values
  • Driver‑specific behaviors

The service layer is intentionally thin and predictable.

Database Drivers

Conduit supports multiple database engines through a unified driver interface:

  • SQLite
  • PostgreSQL
  • MySQL / MariaDB
  • SQL Server
  • In‑Memory

Each driver implements:

  • Insert
  • Update
  • Delete
  • List
  • Get
  • Schema introspection

SQL generation is tailored to each driver’s syntax and capabilities.

Encoders

Encoders format responses based on the Accept header or ?format= query parameter. Supported output formats:

  • JSON
  • YAML
  • XML
  • TOML
  • CSV
  • NDJSON
  • CBOR

Encoders ensure consistent output across all endpoints.

Error System

Conduit includes a structured error system with localization support. Errors are translated based on the Accept-Language header.

The error system handles:

  • Validation failures
  • Authorization failures
  • Database errors
  • Routing errors
  • Schema errors

Notes

  • Architecture is modular and easy to extend.
  • All components follow clean‑architecture principles.
  • Schema drives the entire API surface.
  • Encoders and decoders ensure multi‑format compatibility.
  • Authorization is pluggable and configurable.