Architecture
This chapter explains how Oxidite is split across crates and how requests move through the system.
Workspace Structure
oxidite: top-level facade and feature flags.oxidite-core: router, request/response, server primitives.oxidite-middleware: common cross-cutting layers.oxidite-db+oxidite-macros: ORM, derive macros, migrations.oxidite-auth,oxidite-cache,oxidite-queue,oxidite-realtime,oxidite-template: batteries-included runtime capabilities.oxidite-cli: scaffolding, migration, and developer workflow tooling.
Request Lifecycle
- The server accepts an HTTP request in
oxidite-core. - The router matches method/path and prepares extractors.
- Middleware chain runs pre-handler logic.
- Handler executes with typed extractors.
- Handler returns typed response.
- Middleware chain runs post-handler logic.
- Response is serialized and returned to the client.
Database Layer Design
Oxidite ORM sits on top of sqlx::Any:
Databasetrait abstracts pool/transaction execution.Modeltrait provides typed CRUD and validation hooks.ModelQueryoffers builder ergonomics.- Relationship helpers (
HasMany,HasOne,BelongsTo) keep joins and loading explicit. - Raw SQL remains first-class through
execute_query/fetch_all/fetch_one.
Extension Strategy
Prefer adding capabilities in dedicated crates and surfacing stable public APIs through oxidite.
This keeps compile times predictable and avoids making core crates monolithic.