How lelecodedev/villa-backend works
This is a Go backend for villa-site content and administration. Its principal workflow is an HTTP request routed to a feature handler, processed by a service, and persisted through repositories to PostgreSQL; authentication additionally validates credentials and issues JWTs. The tree shows distinct content domains for applications, hero sections, FAQs, galleries, testimonials, villa packages, and package lists. Wiring and authentication are supported by sampled source; other feature internals are inferred from the tree, so their repository-level call paths are not expanded.
Main entry points: route.go Route registration · service Content services · auth_service.go Auth service · villa_package_service.go Package service
Components 26
HTTP runtime
- App composition
internal/bootstrap/app.go - Route registration
internal/bootstrap/route.go - Auth middleware
internal/middleware/auth_middleware.go - Role middleware
internal/middleware/role_middleware.go
Identity
- Auth endpoints
internal/handler/auth_handler.go - Auth service
internal/service/auth_service.go - User repository
internal/repository/user_repository.go - JWT tokens
pkg/jwt/jwt.go
Site content
- Applications
internal/handler/application_handler.go - Hero sections
internal/handler/hero_section_handler.go - FAQs
internal/handler/faq_handler.go - Gallery
internal/handler/gallery_handler.go - Testimonials
internal/handler/testimony_handler.go - Application service
internal/service/application_service.go - Content services
internal/service - Content repositories
internal/repository
Villa packages
- Package endpoints
internal/handler/villa_package_handler.go - Package-list endpoints
internal/handler/villa_package_list_handler.go - Package service
internal/service/villa_package_service.go - Package-list service
internal/service/villa_package_list_service.go - Package repository
internal/repository/villa_package_repository.go - Package-list repository
internal/repository/villa_package_list_repository.go
Persistence
- Transaction manager
internal/repository/tx_manager.go - DB connection
internal/database/database.go - PostgreSQL
Other components
- API client
Connections 30
- API client → Route registration: sends requests
- App composition → DB connection: opens connection
- App composition → Route registration: registers routes
- Route registration → Auth endpoints: dispatches
- Route registration → Applications: dispatches
- Route registration → Hero sections: dispatches
- Route registration → FAQs: dispatches
- Route registration → Gallery: dispatches
- Route registration → Testimonials: dispatches
- Route registration → Package endpoints: dispatches
- Route registration → Package-list endpoints: dispatches
- Auth endpoints → Auth service: calls
- Auth service → User repository: reads and writes
- Auth service → Transaction manager: runs transaction
- Auth service → JWT tokens: issues token
- Applications → Application service: handles requests
- Hero sections → Content services: handles requests
- FAQs → Content services: handles requests
- Gallery → Content services: handles requests
- Testimonials → Content services: handles requests
- Content services → Content repositories: persists content
- Package endpoints → Package service: handles requests
- Package-list endpoints → Package-list service: handles requests
- Package service → Package repository: reads and writes
- Package service → Package-list repository: reads and writes
- Package-list service → Package-list repository: reads and writes
- Package repository → PostgreSQL: queries
- Package-list repository → PostgreSQL: queries
- DB connection → PostgreSQL: connects
- User repository → PostgreSQL: queries