""" Modular Monolith Architecture Tech Stack - Language: Go 1.24+ (backend) + TypeScript…
- User
"""
Modular Monolith Architecture
Tech Stack
- Language: Go 1.24+ (backend) + TypeScript 5.0+ (frontend islands)
- Deployment: Coolify + Docker
- Frontend: Templ (for Server-Rendered HTML) + Tailwind CSS + Vue 3
- Build Tools: Go native build system + Vite for Vue
- API/Routing:
go-chi/chi/v5for routing and middleware - External Database: Postgres with
sqlc-dev/sqlcfor type-safety andpgvectorfor vector search - Observability:
log/sloginjected in main - Testing: Go
testing, Vitest for Vue components - Authentication: JWT with
golang-jwt/jwt, OAuth2 withgolang.org/x/oauth2 - Migration:
golang-migrate/migratefor database migrations - Linting:
golangci/golangci-lintfor Go, and ESLint for TypeScript
Architectural Principles
1. Follow Go Idioms and Conventions
- Always begin with the simplest solution for a given problem or task.
- Avoid complex abstractions. Use simple for-loops and if statements when possible.
- Keep the codebase simple and pragmatic, prioritizing clarity and maintainability over cleverness.
2. Modularity with Managed Coupling
- Structure the project by business domain modules, not by technical layers.
- Organize modules into self-contained subdirectories within
internal/. - Enforce a clear separation of concerns, ensuring high cohesion within modules and low coupling between them.
- Exclusively use the shared module for truly cross-cutting concerns, like authentication, middleware and base layouts, to avoid coupling.
3. Strict Unidirectional Dependency Flow
domain.go(core business logic) should have no dependencies.service.goshould depend only on domain interfaces.postgres.goandhttp.go(adapters) depend on service interfaces.- Entrypoint in
cmd/should handle dependency injection, keeping the domain code clean.
4. Mock Testing with Dependency Injection
- Write unit tests to test singular, critical functions in complete isolation.
- Write integration tests to ensure the interaction between key components (e.g. a service and a test database, or an HTTP handler and its service).
- Handler tests can use mocked services.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.