High-Level Flow
High-Level Flow
High-Level Flow
Request
↓
Format Decoder
↓
Router
↓
Authorization
↓
Service Layer
↓
Database Driver
↓
Response Encoder
↓
Client
1. Request
The client sends an HTTP request to Conduit. The request may include:
- Path (e.g.,
/v1/books) - Method (GET, POST, PUT, PATCH, DELETE)
- Body (JSON, YAML, XML, TOML, etc.)
- Headers (Authorization, Accept, Content-Type)
- Query parameters (limit, offset, where, order, format)
2. Format Decoder
The decoder reads the request body and converts it into a Go structure. Supported formats:
- JSON
- YAML
- XML
- TOML
The decoder is format‑aware and automatically selects the correct parser based on
Content-Type.
3. Router
The router determines which handler should process the request. Conduit exposes two major API groups:
- /v1/schema — schema introspection, creation, deletion
- /v1/<table> — CRUD operations
Routing is dynamic: Conduit generates endpoints based on the database schema.
4. Authorization
Before any database or service logic runs, Conduit checks whether the request is allowed. Authorization modules include:
- No‑Op Auth
- Environment Auth
- Database Auth
Authorization determines whether the request may:
- Read data
- Write data
- Mutate schema
5. Service Layer
The service layer performs the core logic for schema and CRUD operations. Responsibilities include:
- Validation
- Ignored columns
- Default values
- Driver‑specific behavior
The service layer is intentionally thin and predictable.
6. Database Driver
The database driver executes SQL against the configured backend:
- SQLite
- PostgreSQL
- MySQL / MariaDB
- SQL Server
- In‑Memory
Drivers implement a unified interface for:
- Insert
- Update
- Delete
- List
- Get
- Schema introspection
7. Response Encoder
The encoder formats the response based on the Accept header or
?format= query parameter.
Supported formats:
- JSON
- YAML
- XML
- TOML
- CSV
- NDJSON
- CBOR
Encoders ensure consistent output across all endpoints.
8. Client
The final response is returned to the client in the requested format. Errors are localized, structured, and consistent across all endpoints.