Welcome to Keyline! This comprehensive onboarding guide will help you understand Keyline's architecture, design patterns, and development workflows.
- Architecture Overview - Understand the big picture
- CQRS and Mediator Pattern - Learn the core communication patterns
- Dependency Injection with IoC - Understand how components are wired together
- Development Workflow - Get started with development
- Testing Guide - Write effective tests
-
Start with the Architecture Overview
- Understand clean architecture principles
- Learn the folder structure
- See how components interact
-
Deep dive into CQRS and Mediator
- Understand commands vs queries
- Learn the mediator pattern
- See how requests flow through the system
-
Explore Dependency Injection
- Learn about IoC container
- Understand lifetime management
- See how dependencies are resolved
-
Follow the Development Workflow
- Set up your environment
- Make your first change
- Run tests and linting
Already familiar with the basics? Jump to specific sections:
- Writing tests? → See Testing Guide
- Understanding errors? → See Development Workflow: Troubleshooting
- Need examples? → Check existing commands and queries in
internal/commands/andinternal/queries/
Keyline follows Clean Architecture with CQRS (Command Query Responsibility Segregation) pattern:
┌─────────────────────────────────────────────────────────────┐
│ HTTP Layer │
│ (Handlers/Routes) │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Mediator Layer │
│ (Commands/Queries + Behaviors) │
└──────────────────────┬──────────────────────────────────────┘
│
┌────────────┴────────────┐
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ Command Layer │ │ Query Layer │
│ (Write Logic) │ │ (Read Logic) │
└────────┬─────────┘ └────────┬─────────┘
│ │
└──────────┬───────────────┘
▼
┌─────────────────────────────────────────────────────────────┐
│ Repository Layer │
│ (Data Access Logic) │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Database │
│ (PostgreSQL/SQLite) │
└─────────────────────────────────────────────────────────────┘
Each layer has a clear responsibility. Handlers don't access databases directly; they use commands and queries through the mediatr.
High-level modules don't depend on low-level modules. Both depend on abstractions (interfaces).
Each component does one thing well. Commands modify state, queries read data, handlers handle HTTP.
Components communicate through the mediator, not directly. This makes the system flexible and testable.
- IoC Container Documentation - Deep dive into dependency injection
- Mediator Pattern Documentation - Deep dive into the mediator
- Configuration Documentation - Configuration management
- E2E Testing Documentation - End-to-end testing guide
- API Client Documentation - Using the API client
- Service User Authentication - Machine-to-machine authentication guide
- GitHub Issues: Report bugs or ask questions
- GitHub Discussions: Community discussions
- Code Comments: Many complex sections have detailed comments explaining the "why"
After reading this guide, you'll be ready to contribute! Check the main README for:
- Code style guidelines
- Testing requirements
- Pull request process
- Developer Certificate of Origin (DCO)
Ready to dive in? Start with the Architecture Overview →