gohorsejobs/backend/internal
2025-12-22 16:37:05 -03:00
..
api Add admin backoffice routes and dashboard 2025-12-22 16:37:05 -03:00
core fix(integration): correct frontend fallback port to 8521 and handle NULL fields in company entity 2025-12-15 10:19:31 -03:00
database fix(backend): improve migration logs with friendly messages 2025-12-14 09:00:38 -03:00
dto Add admin backoffice routes and dashboard 2025-12-22 16:37:05 -03:00
handlers fix(docs): update swagger annotations with /api/v1 prefix 2025-12-15 13:46:51 -03:00
infrastructure Merge branch 'hml' into dev 2025-12-11 14:59:40 -03:00
middleware fix(backend): relax CSP for Swagger UI docs 2025-12-14 09:04:19 -03:00
models Add admin backoffice routes and dashboard 2025-12-22 16:37:05 -03:00
router Add admin backoffice routes and dashboard 2025-12-22 16:37:05 -03:00
services Add admin backoffice routes and dashboard 2025-12-22 16:37:05 -03:00
utils docs: complete project documentation overhaul 2025-12-09 19:36:36 -03:00
README.md docs: complete project documentation overhaul 2025-12-09 19:36:36 -03:00

Internal - Backend Core

Este diretório contém toda a lógica interna do backend, seguindo princípios de Clean Architecture.


📁 Estrutura de Módulos

Diretório Camada Responsabilidade
api/ Interface Handlers e middlewares (Clean Arch)
core/ Domain Entidades, ports e use cases (DDD)
database/ Infrastructure Conexão GORM com PostgreSQL
dto/ Interface Data Transfer Objects (request/response)
handlers/ Interface Controllers HTTP (legacy)
infrastructure/ Infrastructure Implementações de ports
middleware/ Interface Middlewares de segurança
models/ Infrastructure Modelos GORM
router/ Interface Configuração de rotas
services/ Application Lógica de negócios (legacy)
utils/ Shared Utilitários (JWT, Sanitizer)

🏗️ Fluxo de Requisição

HTTP Request
     │
     ▼
┌─────────────┐
│ Middleware  │  (Auth, CORS, Rate Limit, Security Headers)
└─────────────┘
     │
     ▼
┌─────────────┐
│  Router     │  (router/router.go)
└─────────────┘
     │
     ▼
┌─────────────┐
│  Handler    │  (api/handlers/ ou handlers/)
└─────────────┘
     │
     ▼
┌─────────────┐
│  UseCase    │  (core/usecases/)
└─────────────┘
     │
     ▼
┌─────────────┐
│ Repository  │  (infrastructure/persistence/)
└─────────────┘
     │
     ▼
┌─────────────┐
│  Database   │  (PostgreSQL via GORM)
└─────────────┘

📦 Módulos Detalhados

api/

Implementação Clean Architecture dos handlers e middlewares.

  • handlers/ - Controllers HTTP novos
  • middleware/ - Auth com JWT Service

core/

Camada de domínio puro seguindo DDD.

  • domain/entity/ - Entidades sem dependências externas
  • ports/ - Interfaces de repositórios e serviços
  • usecases/ - Casos de uso (Login, CreateUser, etc.)

middleware/

Middlewares de segurança aplicados globalmente.

  • auth.go - Validação JWT + RBAC
  • cors.go - Whitelist de origens
  • rate_limit.go - 100 req/min por IP
  • security_headers.go - Headers OWASP

utils/

Utilitários compartilhados.

  • jwt.go - Geração e validação de tokens
  • sanitizer.go - Sanitização de inputs (XSS prevention)