Repo of the Day
mikestefanello/pagoda
Published: Oct 18, 2023
Open repository ↗Rapid, easy full-stack web development starter kit in Go
Summary
Pagoda is a full-stack web development starter kit in Go that ships as a template repository rather than an importable library. It combines Echo for HTTP routing, Ent for the ORM, and Gomponents for HTML rendering, with HTMX, Alpine.js, and DaisyUI on the frontend and SQLite as the default store. The kit also includes an admin panel, authentication, sessions, task queues, cron, and a service container for dependency injection.
What it is useful for
Pagoda fits projects that want a server-rendered web app in Go without a separate JavaScript frontend, leaning on HTMX and Alpine.js to add interactivity from markup. The README frames it as a base for "any web application," providing patterns for routing, forms, sessions, validation, and an admin UI while still letting each piece be swapped. The default SQLite database and in-memory cache target rapid local development; the README notes that Postgres and Redis can be brought back, but a reference branch doing so is no longer maintained. Because the admin panel is generated from Ent schemas, it is most useful when you are willing to model data with Ent.
How engineers can use it
The documented setup path is:
- Install Go.
- Clone the repository with
git clone [email protected]:mikestefanello/pagoda.gitandcd pagoda. - Run
make installto fetch optional tools: the Ent code generator, the Air live-reload CLI, and the Tailwind CSS CLI. - Create an admin user with
make admin [email protected]; a generated password is printed to the console. - Start the app with
make run(defaults tolocalhost:8000), ormake watchfor live reloading that also recompiles Tailwind on save.
Application code lives under pkg/. The service container at pkg/services/container.go exposes auth, cache, config, database, files, mail, ORM, tasks, validator, and web services for dependency injection, and is passed to route handlers' Init methods. New Ent entity types are added with make ent-new name=YourEntity, then Fields() and Edges() are filled in before running make ent-gen. Routes are registered in pkg/handlers/router.go, where middleware such as middleware.RequireAuthentication, middleware.RequireNoAuthentication, and middleware.RequireAdmin can be applied per group. Configuration in config/config.yaml can be overridden by environment variables prefixed with PAGODA_, for example PAGODA_HTTP_PORT.
Two documented caveats: the default session encryption key in Config.App.EncryptionKey must be replaced before any non-development deployment, and removing Ent will also remove the dynamic admin panel, since it depends on Ent's generated code.