Skip to content

Yacobolo/datastar-go-blueprint

Repository files navigation

Datastar Go Blueprint

A modern, opinionated blueprint for building reactive web applications.
License: MIT

Datastar Go Blueprint mascot


The Stack


Quick Start

  1. Clone & Install

    Shell

    git clone https://github.com/yacobolo/datastar-go-blueprint.git
    cd datastar-go-blueprint
    go mod tidy
    
  2. Environment Setup

    Shell

    task tools:install  # Installs templ, air, sqlc, golangci-lint, hivemind
    task generate:all   # Generates SQL, CSS constants, and Templ files
    
  3. Run Development Server

    Shell

    task dev            # Starts Air, Templ watcher, and esbuild via Hivemind
    

    Visit http://localhost:8080.


Project Structure

.
├── 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

Key Features

  • Feature-Based Architecture: Logic grouped by domain, not layer.
  • Type-Safe Everything: * sqlc for database queries.
  • Native CSS: No framework. Uses standard CSS @layer and nesting.
  • Single Binary: Static assets embedded using go:embed.

Essential Commands

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

Deployment

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

About

Opinionated blueprint for fullstack hypermedia-driven go webapp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors