145 lines
6.3 KiB
Markdown
145 lines
6.3 KiB
Markdown
# Backend Architecture (Go)
|
|
|
|
**Note:** This document describes a *conceptual* architecture and is not a final, binding requirement.
|
|
|
|
The backend is written in Go and follows the principles of **Clean Architecture** and **Domain-Driven Design (DDD)**.
|
|
|
|
## Project Structure
|
|
```
|
|
timetracker-backend/
|
|
├── cmd/ # Einstiegspunkte
|
|
│ ├── api/
|
|
│ │ └── main.go
|
|
│ └── worker/
|
|
│ └── main.go
|
|
├── internal/ # Interner Code
|
|
│ ├── domain/ # Domain Layer (DDD)
|
|
│ │ ├── entities/ # Domain Entitäten
|
|
│ │ │ ├── user.go
|
|
│ │ │ ├── company.go
|
|
│ │ │ ├── project.go
|
|
│ │ │ ├── timeentry.go
|
|
│ │ │ ├── customer.go
|
|
│ │ │ ├── activity.go
|
|
│ │ │ ├── sprint.go
|
|
│ │ │ ├── task.go
|
|
│ │ │ └── kanban.go
|
|
│ │ ├── repositories/ # Repository Interfaces
|
|
│ │ │ ├── user_repository.go
|
|
│ │ │ ├── company_repository.go
|
|
│ │ │ ├── project_repository.go
|
|
│ │ │ ├── timeentry_repository.go
|
|
│ │ │ └── ...
|
|
│ │ ├── services/ # Service Interfaces und Implementierungen
|
|
│ │ │ ├── auth_service.go
|
|
│ │ │ ├── user_service.go
|
|
│ │ │ ├── timetracking_service.go
|
|
│ │ │ ├── reporting_service.go
|
|
│ │ │ └── ...
|
|
│ │ └── valueobjects/ # Value Objects
|
|
│ │ ├── money.go
|
|
│ │ ├── duration.go
|
|
│ │ └── ...
|
|
│ ├── application/ # Anwendungsfälle
|
|
│ │ ├── auth/ # Authentication Use Cases
|
|
│ │ │ ├── login.go
|
|
│ │ │ ├── register.go
|
|
│ │ │ └── ...
|
|
│ │ ├── timetracking/ # Zeiterfassung Use Cases
|
|
│ │ │ ├── create_time_entry.go
|
|
│ │ │ ├── update_time_entry.go
|
|
│ │ │ ├── list_time_entries.go
|
|
│ │ │ └── ...
|
|
│ │ ├── projects/ # Projektverwaltung Use Cases
|
|
│ │ │ └── ...
|
|
│ │ ├── customers/ # Kundenverwaltung Use Cases
|
|
│ │ │ └── ...
|
|
│ │ └── reporting/ # Berichtswesen Use Cases
|
|
│ │ └── ...
|
|
│ ├── infrastructure/ # Infrastruktur
|
|
│ │ ├── persistence/ # Datenbankzugriff
|
|
│ │ │ ├── postgres/ # PostgreSQL Implementierung
|
|
│ │ │ │ ├── connection.go
|
|
│ │ │ │ ├── user_repository.go
|
|
│ │ │ │ ├── company_repository.go
|
|
│ │ │ │ └── ...
|
|
│ │ │ └── migrations/
|
|
│ │ ├── security/ # Sicherheitsimplementierungen
|
|
│ │ │ ├── jwt.go
|
|
│ │ │ ├── password.go
|
|
│ │ │ └── rbac.go
|
|
│ │ ├── messaging/ # Messaging-Implementierungen
|
|
│ │ │ ├── email.go
|
|
│ │ │ └── notification.go
|
|
│ │ └── external/ # Externe Dienste
|
|
│ │ ├── calendar/
|
|
│ │ ├── pdf/
|
|
│ │ └── webhook/
|
|
│ └── interfaces/ # Interfaces
|
|
│ ├── http/ # HTTP-API
|
|
│ │ ├── handlers/ # API Handler
|
|
│ │ │ ├── auth_handler.go
|
|
│ │ │ ├── user_handler.go
|
|
│ │ │ ├── time_entry_handler.go
|
|
│ │ │ └── ...
|
|
│ │ ├── middleware/ # Middleware
|
|
│ │ │ ├── auth_middleware.go
|
|
│ │ │ ├── tenant_middleware.go
|
|
│ │ │ ├── logging_middleware.go
|
|
│ │ │ └── ...
|
|
│ │ ├── dto/ # Data Transfer Objects
|
|
│ │ │ ├── auth_dto.go
|
|
│ │ │ ├── user_dto.go
|
|
│ │ │ ├── time_entry_dto.go
|
|
│ │ │ └── ...
|
|
│ │ └── routes/ # API Routes
|
|
│ │ └── router.go
|
|
│ └── grpc/ # gRPC-API (Optional für Microservice-Kommunikation)
|
|
├── pkg/ # Öffentliche Pakete
|
|
│ ├── functional/ # FPGO Utilities
|
|
│ │ ├── option.go
|
|
│ │ ├── result.go
|
|
│ │ └── ...
|
|
│ ├── validator/ # Validierung
|
|
│ │ └── validator.go
|
|
│ ├── logger/ # Logging
|
|
│ │ └── logger.go
|
|
│ ├── errors/ # Fehlerbehandlung
|
|
│ │ └── errors.go
|
|
│ └── utils/ # Allgemeine Utilities
|
|
│ ├── date.go
|
|
│ ├── crypto.go
|
|
│ └── ...
|
|
├── api/ # API Definitionen
|
|
│ └── swagger/ # Swagger Dokumentation
|
|
│ └── swagger.yaml
|
|
├── deployments/ # Deployment-Konfigurationen
|
|
│ ├── docker/
|
|
│ │ ├── Dockerfile
|
|
│ │ └── docker-compose.yml
|
|
│ └── kubernetes/
|
|
│ ├── api.yaml
|
|
│ └── worker.yaml
|
|
├── test/ # Tests
|
|
│ ├── unit/
|
|
│ ├── integration/
|
|
│ └── e2e/
|
|
├── scripts/ # Skripte
|
|
│ ├── migration.sh
|
|
│ ├── seed.sh
|
|
│ └── ...
|
|
├── docu/ # Projektdokumentation
|
|
│ ├── general_overview.md
|
|
│ ├── backend_architecture.md
|
|
│ ├── frontend_architecture.md
|
|
│ ├── database_schema.md
|
|
│ ├── security_privacy.md
|
|
│ ├── extensibility_integrations.md
|
|
│ ├── deployment_devops.md
|
|
│ ├── llm_guidance.md
|
|
│ └── README.md
|
|
├── go.mod
|
|
├── go.sum
|
|
└── README.md
|
|
```
|