first commit

This commit is contained in:
2026-07-18 23:32:11 +03:00
commit d401e9009c
9 changed files with 496 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
---
description: Go Clean Architecture rules for Mixmaker backend
globs: backend/**/*.go
alwaysApply: false
---
# Go Backend Architecture
- Keep dependency direction strict: `domain` has no outward dependencies; `application` depends on domain and ports; adapters depend on application contracts; `cmd/api` performs wiring.
- `backend/internal/domain` must not import HTTP routers, SQL drivers, configuration, loggers, or framework code.
- `backend/internal/application` must depend on domain types and consumer-owned ports, never concrete adapters.
- Put request and response DTOs in HTTP adapters, not in domain entities.
- Prefer explicit domain errors and small interfaces owned by their consumers.
- Keep SQL, migrations, and PostgreSQL-specific types inside output adapters.
- Make transactions explicit at the application boundary for multi-step state changes.
- Keep balancing and draft validation deterministic and free of infrastructure dependencies.
- Pass clocks, random sources, and ID generators through ports when behavior must be testable.
- Add focused unit tests whenever domain behavior or a use case changes.