Study Guide
This guide gives a practical reading order for the current AxumKit codebase.
1) Start with Configuration
Read:
crates/config/src/server_config.rscrates/worker/src/config/worker_config.rs
Focus on required env vars and defaults.
2) Understand Shared Types
Read:
crates/entity/src/users.rscrates/entity/src/user_oauth_connections.rscrates/dto/src/auth/*crates/dto/src/oauth/*crates/dto/src/search/*
3) Learn the Error System
Read:
crates/errors/src/errors.rscrates/errors/src/protocol.rscrates/errors/src/handlers/*
Goal: understand how domain errors map to HTTP responses.
4) Server Runtime Entry
Read:
crates/server/src/main.rscrates/server/src/state.rscrates/server/src/connection/*
Goal: how DB, Redis, NATS, R2, and MeiliSearch are wired.
5) Middleware and Extractors
Read:
crates/server/src/middleware/*crates/server/src/extractors/*
Goal: request lifecycle, session extraction, and rate-limit flow.
6) Route -> Service -> Repository Flow
Read in this order:
crates/server/src/api/v0/routes/auth/*crates/server/src/service/auth/*crates/server/src/repository/user/*crates/server/src/repository/oauth/*
Then check user/search routes:
crates/server/src/api/v0/routes/user/*crates/server/src/api/v0/routes/search/*crates/server/src/service/search/*
7) Worker Pipeline
Read:
crates/worker/src/main.rscrates/worker/src/nats/streams.rscrates/worker/src/nats/consumer.rscrates/worker/src/jobs/email/*crates/worker/src/jobs/index/*crates/worker/src/jobs/reindex/*crates/worker/src/jobs/cron/*
Goal: understand asynchronous job execution and cron scheduling.
Suggested Exercises
- Add a new field to user profile and expose it in API.
- Add a new worker job subject and consumer.
- Add an integration or API-level test that verifies a full auth flow.