How akbaralishaikh/denti works
Project type and purpose
• This is a Go-based REST API application for a dental clinic, built with the Clean Architecture / DDD / Hexagonal style.
• It exposes HTTP endpoints (health check, user management, login, patient management) backed by GORM ORM and uses Docker for local orchestration.
File structure
• Top level:
• cmd/server
└ router.go, server.go (entry point and HTTP router bootstrap)
• denti.go (optional root entry)
• docker/ (docker-compose.yml), dockerfile
• go.mod, go.sum
• pkg/
– config (config loader, config.yml)
– di (dependency injection container with Uber Dig)
– logger (Zap logger)
– http/rest (Gin handlers: health, login, user)
– login, user, patient (domain entities, repository interfaces, service/use-case implementations)
– storage (driver interface; orm folder with GORM repository implementations)
• No “frontend” – it’s purely a backend service.
README for additional insights
• Emphasizes Clean Architecture, DDD, Hexagonal layering
• Core dependencies: gin (HTTP), gorm (ORM), zap (logging), dig (DI), configor (config)
• Typical run/test commands
a. Main components
• Delivery Layer: Gin HTTP Server (cmd/server + pkg/http/rest)
• Application Layer: Use-cases / services (pkg/user/service, pkg/login/service, pkg/patient/service)
• Domain Layer: Entities and interfaces (pkg/user/user.go, pkg/login/login.go, pkg/patient/patient.go + repository interfaces)
• Infrastructure Layer: Persistence (pkg/storage/orm/*.go implementing repository interfaces using GORM), Logger (pkg/logger), Config (pkg/config), DI Container (pkg/di)
• External Dependencies: SQL database (e.g., PostgreSQL/MySQL), Docker environment
b. Relationships and interactions
• HTTP handlers receive requests → invoke DI container to resolve service instances
• Services execute business logic → call repository interfaces
• ORM implementations persist/fetch data from the database
• Config loader initializes config values early in the bootstrap
• Logger is injected across layers for structured logging
c. Architectural patterns
• Hexagonal / Ports-and-Adapters:
– Ports: repository interfaces in domain packages
– Adapters: GORM-based implementations in pkg/storage/orm
• Dependency Injection with Uber Dig for wiring concrete adapters to domain ports
• Separation of Concerns: Delivery, Application, Domain, Infrastructure layers
d. Key technologies
• Go / Gin for HTTP API
• GORM for ORM/persistence
• Zap for logging
• Dig for DI
• Configor or viper-style config loader
• Docker / Docker-Compose for environment
Summary of essential elements
• Clearly separate Delivery / Application / Domain / Infrastructure
• Ports (interfaces) vs. Adapters (concrete implementations)
• DI container wiring connections
• Data flows from HTTP → business logic → persistence
• External dependencies (database, Docker environment)