A modern, opinionated blueprint for building reactive web applications.
- Backend: Go, SQLite + sqlc, Datastar, datastar-templ, Templ, Chi
- Frontend: Lit, Native CSS (Layers/Nesting), esbuild
- Tools: Air, Hivemind, UPX
-
Clone & Install
Shell
git clone https://github.com/yacobolo/datastar-go-blueprint.git cd datastar-go-blueprint go mod tidy -
Environment Setup
Shell
task tools:install # Installs templ, air, sqlc, golangci-lint, hivemind task generate:all # Generates SQL, CSS constants, and Templ files -
Run Development Server
Shell
task dev # Starts Air, Templ watcher, and esbuild via HivemindVisit
http://localhost:8080.
.
├── cmd/server/ # App entry point & build scripts
├── data/ # Local SQLite database files
├── internal/
│ ├── app/ # Application lifecycle & initialization
│ ├── domain/ # Core business logic and entities
│ ├── features/ # Feature-based modules (Templ, Handlers, Routes)
│ ├── platform/ # Shared infra (Router, PubSub)
│ ├── store/ # Database layer (Migrations, SQLC, Repositories)
│ └── ui/ # Generated type-safe CSS constants (cssgen)
├── web/
│ ├── resources/ # Static assets & embedded Go files
│ └── ui/ # Frontend source (Lit components, CSS Layers, TS)
├── Procfile.dev # Dev process management (Hivemind)
├── Taskfile.yml # Project automation tasks
└── sqlc.yaml # SQL compiler configuration
- Feature-Based Architecture: Logic grouped by domain, not layer.
- Type-Safe Everything: * sqlc for database queries.
- cssgen for type-safe CSS classes.
- datastar-templ for Datastar attributes.
- Native CSS: No framework. Uses standard CSS
@layerand nesting. - Single Binary: Static assets embedded using
go:embed.
| Command | Description |
|---|---|
task dev |
Start full hot-reload dev environment |
task generate:all |
Run all code generators (SQL, Templ, CSS) |
task build |
Create a production-ready compressed binary |
task check |
Run tests and linters |
task docker:build |
Build optimized Docker image |
Docker Quick Start:
Shell
docker build -t datastar-app .
docker run -p 8080:9001 datastar-app
Binary Build:
Executables are optimized with UPX compression for minimal footprint. Use task build.
License: MIT
