How codetheuri/poster-gen works
Project type and purpose
• Tusk is a Go-based starter template for building RESTful APIs.
• It follows a clean-architecture style: distinct layers for handlers (HTTP), services (business logic), repositories (data access), and models.
• It also ships with CLI tools (database migrations, seeders, module generator) and a set of shared packages (logging, middleware, validation, mailing).
File structure
• Top-level “cmd” directory
• cmd/main.go → launches the HTTP server
• cmd/migrate → database migrations & seeding CLI
• cmd/genmodule → scaffolds new API modules
• internal/bootstrap/app.go → application startup, wiring modules and middleware
• internal/app/… → per‐module folders (auth, posters) each with handlers, models, repositories, services, module.go
• internal/app/routers/router.go → central Chi router assembling module routes
• internal/platform/database/gorm.go → GORM setup, connection pooling
• database/… → actual SQLite data file (for dev), migration source, seeder definitions
• pkg/… → cross-cutting utilities: logging, errors, middleware, pagination, validation, web response helpers, mailer, token interface
• config/config.go → environment variable loading, global settings
Key insights from the README
• Uses Go-Chi for routing and middleware
• Uses GORM for ORM and auto-migrations
• JWT + Bcrypt for authentication
• Clean architecture enforced by layered modules
• CLI tools for migrations, seeding, module scaffolding
Final checklist
• All major components: Router, Middleware, Handlers, Services, Repositories, Database, CLI tools, Shared pkg libs
• Annotations for external systems (DB, mail server) and environment/config entry points