Athena Typesense Crate
What belongs in crates/athena-typesense and what still stays in the main server crate.
crates/athena-typesense is the reusable domain seam for Athena's optional
Typesense integration. The crate owns the sync/search runtime behavior that can
be shared by the main server, daemon-style worker runtimes, and later adapters
without keeping the full implementation inside athena_rs.
What Lives Here Today
- Typesense connection validation and HTTP request helpers.
- Sync-job loading, manifest generation, progress accounting, and retry logic.
- Typesense schema creation, import batching, rollback compensation, and search proxy execution.
- Worker-tick logic for scheduled sync jobs.
- The narrow runtime trait that
athena_rsimplements to provide HTTP clients, logging pools, source-client pools, and Typesense config values.
What Still Stays In athena_rs
- Actix route registration and
/typesense/*auth middleware. AppStateitself and the concrete runtime implementation for the trait.- Process-local worker spawning and scheduler-loop startup wiring.
Current Extraction Rule
Use athena-typesense when code is specifically about Typesense sync/search
behavior and only needs a narrow runtime interface.
Keep code in athena_rs when it is primarily:
- Actix service wiring
- server auth enforcement
- top-level process bootstrap
- shared runtime ownership of
AppState
Near-Term Direction
The next Typesense refactors should keep shrinking the wrapper in
src/api/typesense/mod.rs and continue splitting the crate internals by
concern:
- catalog/load-state helpers
- import + rollback logic
- search/proxy handlers
- scheduled worker orchestration