gohorsejobs/backend/internal
Tiago Yamamoto 841b1d780c feat: Email System, Avatar Upload, Email Templates UI, and Public Job Posting
- Backend: Email producer (LavinMQ), EmailService interface
- Backend: CRUD API for email_templates and email_settings
- Backend: avatar_url field in users table + UpdateMyProfile support
- Backend: StorageService for pre-signed URLs
- NestJS: Email consumer with Nodemailer and Handlebars
- Frontend: Email Templates admin pages (list/edit)
- Frontend: Updated profileApi.uploadAvatar with pre-signed URL flow
- Frontend: New /post-job public page (company registration + job creation wizard)
- Migrations: 027_create_email_system.sql, 028_add_avatar_url_to_users.sql
2025-12-26 12:21:34 -03:00
..
api feat: Email System, Avatar Upload, Email Templates UI, and Public Job Posting 2025-12-26 12:21:34 -03:00
core feat: Email System, Avatar Upload, Email Templates UI, and Public Job Posting 2025-12-26 12:21:34 -03:00
database feat: prefer DATABASE_URL format for db connection, fallback to individual params 2025-12-23 23:23:42 -03:00
dto feat: Email System, Avatar Upload, Email Templates UI, and Public Job Posting 2025-12-26 12:21:34 -03:00
handlers Implement secure Stripe credential management using RSA encryption 2025-12-26 11:03:52 -03:00
infrastructure feat: Email System, Avatar Upload, Email Templates UI, and Public Job Posting 2025-12-26 12:21:34 -03:00
middleware refactor(roles): rename companyAdmin->admin and jobSeeker->candidate 2025-12-24 13:30:50 -03:00
models fix(backend): resolve 500 errors on jobs, notifications and secure routes 2025-12-24 17:48:06 -03:00
router feat: Email System, Avatar Upload, Email Templates UI, and Public Job Posting 2025-12-26 12:21:34 -03:00
services feat: Email System, Avatar Upload, Email Templates UI, and Public Job Posting 2025-12-26 12:21:34 -03:00
utils refactor: clean up legacy UUID v4, use UUID v7 everywhere 2025-12-24 11:29:55 -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)