# Use Chi router for HTTP routing

* Status: Accepted
* Deciders: Gabriel Radureau, AI Agent
* Date: 2026-04-02

## Context and Problem Statement

We needed to choose an HTTP router for the DanceLessonsCoach web service that provides:
- Good performance characteristics
- Flexible routing capabilities
- Middleware support
- Active maintenance and community support
- Compatibility with our interface-based design

## Decision Drivers

* Need for performant HTTP routing
* Desire for clean, idiomatic Go API
* Requirement for middleware support
* Long-term maintainability
* Good documentation and examples

## Considered Options

* Chi router - Lightweight, fast router with good middleware support
* Gorilla Mux - Well-established but heavier
* Gin - High performance but more opinionated
* Standard library - Simple but limited features

## Decision Outcome

Chosen option: "Chi router" because it provides excellent performance, clean API, good middleware support, and active maintenance while remaining lightweight and unopinionated.

## Pros and Cons of the Options

### Chi router

* Good, because lightweight and fast
* Good, because excellent middleware support
* Good, because clean, idiomatic Go API
* Good, because actively maintained
* Good, because good documentation and examples
* Bad, because slightly less feature-rich than some alternatives

### Gorilla Mux

* Good, because very mature and stable
* Good, because feature-rich
* Bad, because heavier and more complex
* Bad, because less performant than Chi

### Gin

* Good, because extremely high performance
* Good, because good ecosystem
* Bad, because more opinionated framework
* Bad, because different from standard library patterns

### Standard library

* Good, because no external dependencies
* Good, because simple and familiar
* Bad, because limited routing capabilities
* Bad, because no built-in middleware support

## Links

* [Chi Router GitHub](https://github.com/go-chi/chi)
* [Chi Documentation](https://go-chi.io/#/)
* [Gorilla Mux](https://github.com/gorilla/mux)
* [Gin Web Framework](https://github.com/gin-gonic/gin)