Josh Finnie Headshot

Series: Pokemon Api (14 posts)

  1. Part 1
    Project SetupAugust 31, 2026

    Setting up the Cargo workspace, crates, git repo, rustfmt config, and Makefile the rest of the series builds on.

  2. Part 2
    ConfigurationAugust 31, 2026

    Loading server config from the environment with envconfig, so nothing about the port or CORS rules lives in the binary.

  3. Part 3
    Setting Up the ServerAugust 31, 2026

    Wiring the config from the last part into an Axum server, split across a binary entry point and a build_app function.

  4. Part 4
    Health ChecksAugust 31, 2026

    A liveness endpoint the container orchestrator can poll before the service has any dependencies to check.

  5. Part 5
    MiddlewareAugust 31, 2026

    Wiring CORS, request tracing, and a body size limit through tower-http, driven by the config we already loaded.

  6. Part 6
    Database Connection PoolingAugust 31, 2026

    Adding a PostgreSQL connection pool with sqlx, config-driven like everything else, and running migrations on startup.

  7. Part 7
    Application StateAugust 31, 2026

    Sharing the pool and config with every handler through Axum's typed state, and finally finishing the /readyz endpoint.

  8. Part 8
    The Repository LayerAugust 31, 2026

    A trait-based repository in the pokemon_service crate, so the code that talks to Postgres never has to know it's serving HTTP.

  9. Part 9
    Service and Domain LogicAugust 31, 2026

    A service layer that owns validation and business rules, depending on the repository trait instead of Postgres directly.

  10. Part 10
    HandlersAugust 31, 2026

    The last layer: translating HTTP requests into service calls and service errors into status codes.

  11. Part 11
    OpenAPIAugust 31, 2026

    Generating an OpenAPI schema and interactive docs from the handlers we already wrote, with utoipa.

  12. Part 12
    Error Handling & API ContractsAugust 31, 2026

    Closing the gaps in ApiError so every failure, not just the ones the service produces, returns the same JSON shape.

  13. Part 13
    Docker & ProductionAugust 31, 2026

    A pinned, multi-stage Dockerfile, graceful shutdown, and the gap between a container that runs and a service you could actually deploy.

  14. Part 14
    ObservabilityAugust 31, 2026

    Request IDs and custom tracing spans, the two things Middleware explicitly deferred, plus structured logs for production.