The API template creates a well-structured JSON API service. An API (Application Programming Interface) is a way for programs to talk to each other - when you build an API, you create endpoints (URLs) that other programs can call to get or send data, usually in JSON format. This template is designed for production use with a clean architecture that scales as your project grows.Documentation Index
Fetch the complete documentation index at: https://docs.go-mizu.dev/llms.txt
Use this file to discover all available pages before exploring further.
When to Use This Template
Use the API template when:- Building a REST API - JSON endpoints for web or mobile clients
- Multiple developers - Clear structure everyone can follow
- Production service - Ready for deployment
- Need organization - More than a few routes
What You Get
A complete project structure with:- Feature-based organization - Code grouped by domain
- Configuration management - Environment-based config
- App lifecycle - Clean startup and shutdown
- Example endpoints - Health check, echo, users
Quick Start
Project Structure
Key Features
Feature-Based Organization
Each feature (domain/module) gets its own folder:Configuration Management
Configuration is loaded from environment variables:Application Structure
TheApp struct manages lifecycle:
Example Routes
Health Check
Hello Endpoint
Users API
Echo Endpoint
Why This Structure?
Scalability
As your API grows, add new features without cluttering existing code:Testability
Each feature can be tested independently:Team Collaboration
Clear boundaries mean less merge conflicts:- Developer A works on
feature/users/ - Developer B works on
feature/products/
Maintainability
Find code easily:- βWhereβs the user creation logic?β β
feature/users/ - βWhere are routes defined?β β
app/api/routes.go - βWhereβs the config?β β
app/api/config.go
Comparison with Minimal
| Aspect | minimal | api |
|---|---|---|
| Files | 1 | 10+ |
| Structure | None | Feature-based |
| Config | Hardcoded | Environment variables |
| Suitable for | Learning, prototypes | Production |
| Scalability | Poor | Good |
Next Steps
Project Structure
Detailed file-by-file explanation
Tutorial
Build a complete API step by step