lagodev

module
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: MIT

README

lagodev

The batteries-included web framework for Go.

Go Reference Go Report Card Tests Discussions

ORM · Migrations · Router · Auth · Authz · Admin · GraphQL · Realtime · Queue · Scheduler · Mail · Cache · OpenAPI · CLI — one cohesive stack.

Quick start · Why lagodev · Features · Docs · vs Laravel / Django / NestJS / Express


lagodev is a full-stack web framework for Go — not a starter template, not a loose bag of libraries. It gives you everything you need to ship a production backend: a generics-typed ORM with relations and migrations, an HTTP router and web layer, first-class authentication and authorization, an auto-generated admin panel, GraphQL, WebSocket realtime, a queue with a dashboard, a scheduler, events, mail, cache, OpenAPI 3.1 generation, and a Laravel-style lago CLI that scaffolds it all. Every subsystem shares the same connection, config, container, and logger — so the parts fit together instead of fighting each other.

If you've used Laravel, Django, NestJS, or Express, lagodev will feel immediately familiar — with Go's static typing, single-binary deploys, and goroutine concurrency underneath. Take the whole framework, or drop individual packages into an existing Gin / gRPC / Echo app.

Why lagodev

  • Complete, not minimal. Auth, authz, admin, realtime, queue, scheduler, mail, cache, search, observability — in the box, sharing one runtime. No weekend spent wiring five third-party libraries into a coherent stack.
  • Typed end to end. orm.Query[T], collection.Collection[T], and a generics-based DI container give you compile-time-checked data access with zero codegen. The OpenAPI generator and typed client codegen close the loop out to your API consumers.
  • Secure by default. CSRF, security headers, body limits, per-IP rate limiting, hardened CORS, and HttpOnly/Secure/SameSite cookies are one line each — not an afterthought. See SECURITY.md.
  • Productive like Laravel. The lago CLI scaffolds models, migrations, factories, seeders, services, controllers, policies, resources, and full CRUD in a single command. gen:client emits a typed client from your routes.
  • Native to Go. Single static binary, no runtime, no VM. Goroutine-backed realtime and queue workers, context.Context threaded throughout, and allocation-conscious reflection caches.
  • Use the whole stack — or just a piece. The ORM works identically under Gin, Fiber, Echo, Chi, or gRPC. See docs/FRAMEWORK_INTEGRATION.md.

Feature matrix

Domain What ships in the box
Data / ORM Generic Query[T], orm.Model, lifecycle hooks, soft deletes, casts, relations (HasOne/HasMany/BelongsTo/BelongsToMany/polymorphic) with eager loading, chainable query builder
Migrations & schema Transactional up/rollback/refresh/fresh/reset/status/step, advisory locks, checksums, dry-run; dialect-correct schema DSL for SQLite / MySQL / Postgres (MIGRATIONS.md)
HTTP / Web Router, middleware, typed requests, JSON responses with status mapping, resource routes, validation (struct-tag rules → 422), server-rendered views
Auth Guards, sessions, tokens, JWT, OAuth (PKCE), account + password-reset flows (AUTHENTICATION.md)
Authz Gates and policies, least-privilege checks (AUTHORIZATION.md)
Admin Auto-CRUD admin panel built on generics (ADMIN.md)
APIs API resources / serializers, OpenAPI 3.1 generation + typed client codegen, GraphQL (GRAPHQL.md)
Realtime WebSocket hub with presence, broadcasting
Background work Queue + jobs + dashboard, scheduler, events, notifications
Messaging Mail, notifications
Infrastructure Cache, session, DI container, config, i18n, carbon dates, filesystem (local/S3), httpclient, crypt
Reliability Resilience (circuit breaker, retry), observability / OpenTelemetry, Telescope debug dashboard
Search Full-text search
DX lago CLI (make:* generators, migrate*, db:*, gen:client), factories + testing harness, generic collections, live reload
Integrations Adapters for gin / grpc / websocket, redis driver, drop-in ORM for existing apps

60-second quick start

mkdir myapp && cd myapp
go mod init github.com/you/myapp

go get github.com/devituz/lagodev@latest
go install github.com/devituz/lagodev/cmd/lago@latest   # `lago` CLI (alias: artisan)

lago init        # writes lago.json, config/, routes/
lago env:init    # writes .env with documented defaults

# Generate model + migration + factory + seeder + service + controller in one shot
lago make:model Post -mfsc \
    --fields="title:string,body:text,published:bool:default(false)"

Wire the route in routes/api.go:

package routes

import (
    "github.com/devituz/lagodev/web"
    "github.com/you/myapp/controllers"
)

func Register(app *web.App) {
    app.Get("/health", func(c *web.Context) (any, error) {
        return map[string]string{"status": "ok"}, nil
    })

    app.Group("/api/v1", func(g *web.Router) {
        g.Resource("posts", controllers.NewPostController(app.DB()))
    })
}

Bootstrap in main.go:

package main

import (
    "log"

    "github.com/devituz/lagodev/config"
    "github.com/devituz/lagodev/database"
    _ "github.com/devituz/lagodev/drivers/sqlite"
    "github.com/devituz/lagodev/web"

    _ "github.com/you/myapp/migrations" // registers migrations via init()

    appcfg "github.com/you/myapp/config"
    "github.com/you/myapp/routes"
)

func main() {
    _ = config.LoadEnv()

    mgr := database.NewManager()
    conn, err := mgr.Open("default", appcfg.Database())
    if err != nil {
        log.Fatal(err)
    }

    app := web.New(
        web.WithDatabase(conn),
        web.WithManager(mgr),
        web.WithMigrations(nil),
        web.WithAddr(appcfg.App().Addr),
    )
    routes.Register(app)
    app.MustRun()
}
lago migrate          # apply migrations
go run .              # serves on :8080, prints every registered route

curl -X POST http://localhost:8080/api/v1/posts \
    -H "Content-Type: application/json" \
    -d '{"Title":"Hello","Body":"World"}'   # → 201 Created
curl http://localhost:8080/api/v1/posts     # → 200 OK

Resource() registers the six CRUD routes (Index/Show/Store/Update/ Destroy) in a single call. Handlers return (any, error) and the framework maps them to JSON with the correct 200/201/204/404/422/500 status.

Full walkthrough: docs/GETTING_STARTED.md.

CLI at a glance
lago make:model        lago make:migration    lago make:factory
lago make:seeder       lago make:service      lago make:controller
lago make:resource     lago make:policy       lago make:test
lago make:scheme       lago make:crud         # full CRUD stack in one command

lago migrate           lago migrate:fresh --seed   lago migrate:rollback
lago db:show           lago env:init

lago gen:client        # typed API client from your routes / OpenAPI spec

Two interchangeable binaries — lago and artisan. See docs/CLI.md.

Installation

go get github.com/devituz/lagodev@latest
go install github.com/devituz/lagodev/cmd/lago@latest   # or .../cmd/artisan@latest

Blank-import the database driver you need:

_ "github.com/devituz/lagodev/drivers/postgres" // pgx
_ "github.com/devituz/lagodev/drivers/mysql"    // go-sql-driver/mysql
_ "github.com/devituz/lagodev/drivers/sqlite"   // mattn/go-sqlite3
Live reload

lagodev ships a ready-to-use air config at the repo root. Install once (go install github.com/air-verse/air@latest), then run air from your project root — every save rebuilds and restarts the binary.

Documentation

Area Guide
Getting started GETTING_STARTED.md
Web — routing, middleware, controllers WEB.md
Server-rendered views VIEWS.md
ORM — Query[T], hooks, relations, casts ORM.md
Migrations & schema DSL MIGRATIONS.md
Authentication (guard/session/token/JWT/OAuth) AUTHENTICATION.md
Authorization (gates & policies) AUTHORIZATION.md
Admin panel (auto-CRUD) ADMIN.md
GraphQL GRAPHQL.md
Realtime — WebSocket, presence, broadcasting REALTIME.md
Queue, jobs & dashboard QUEUE.md
API resources / serializers API_RESOURCES.md
OpenAPI 3.1 + typed client codegen OPENAPI.md
Full-text search SEARCH.md
Resilience (circuit breaker / retry) RESILIENCE.md
Observability (OpenTelemetry) OBSERVABILITY.md
Telescope debug dashboard TELESCOPE.md
Factories & seeders FACTORIES.md
lago / artisan CLI reference CLI.md
Configuration — .env & lago.json CONFIGURATION.md
Gin / Fiber / Echo / Chi / gRPC integration FRAMEWORK_INTEGRATION.md
Architecture deep-dive ARCHITECTURE.md
Benchmarks BENCHMARKS.md
Release notes CHANGELOG.md

At a glance vs the rest

lagodev (Go) Laravel (PHP) Django (Python) NestJS (Node) Express (Node)
Typed ORM, no codegen ✅ generics runtime runtime via TS+ORM
Migrations in core add-on
Auth + authz in core add-on
Auto admin panel add-on add-on
GraphQL in core add-on add-on add-on
Realtime (WS + presence) add-on add-on (Channels) gateway add-on
Queue + scheduler in core add-on (Celery) add-on
OpenAPI + typed client gen add-on add-on add-on
Scaffolding CLI lago ✅ artisan ✅ manage.py ✅ nest
Single static binary

lagodev brings the full "framework with everything" model of Laravel/Django to Go, with the typed DX of NestJS and the deploy story of a single Go binary. See COMPARISON.md for the detailed breakdown and BENCHMARKS.md for performance numbers.

Examples

Folder What it shows
examples/basic/ Connection → migrations → ORM → query, ~30 lines
examples/blog/ Full showcase — 3 models, FKs, services, factories, seeders
examples/gin/ · fiber/ · echo/ · chi/ Same service layer, swapped HTTP framework
examples/microservice/ Queue worker with LockForUpdate + transactions
cd examples/blog && go mod tidy && go run .
curl http://localhost:8080/posts

Testing

go test ./...                          # full suite (in-memory SQLite)
go test -race ./...
go test -bench=. -benchmem ./benchmarks
import lagotest "github.com/devituz/lagodev/testing"

func TestSomething(t *testing.T) {
    conn, cleanup := lagotest.SQLite(t) // migrations already applied
    defer cleanup()
    // ORM, factory, service — all wired and ready.
}

Requirements

  • Go 1.25+ (generics-heavy APIs throughout).
  • Database: SQLite, MySQL, or PostgreSQL. Redis driver for cache/queue/realtime fan-out (optional).

Community

License

MIT — see LICENSE.

If lagodev saved you time, a ⭐ helps other Go developers find it.

Star History Chart

Directories

Path Synopsis
adapters
gin module
Package admin provides a Django-admin-style auto-CRUD panel for the lagodev framework.
Package admin provides a Django-admin-style auto-CRUD panel for the lagodev framework.
Package app is lagodev's application bootstrap and module layer.
Package app is lagodev's application bootstrap and module layer.
Package auth provides framework-agnostic JWT signing/parsing and password hashing for lagodev-based applications.
Package auth provides framework-agnostic JWT signing/parsing and password hashing for lagodev-based applications.
account
Package account implements the credential-lifecycle flows that sit around authentication: password-reset tokens, email-verification tokens, signed URLs, and a login throttler.
Package account implements the credential-lifecycle flows that sit around authentication: password-reset tokens, email-verification tokens, signed URLs, and a login throttler.
guard
Package guard implements a cookie-backed, stateful session auth guard modelled on Laravel's session guard ("web" guard).
Package guard implements a cookie-backed, stateful session auth guard modelled on Laravel's session guard ("web" guard).
oauth
Package oauth implements the OAuth2 / social-login flows that back a Laravel-Socialite-style "log in with Google/GitHub" experience, using only the standard library.
Package oauth implements the OAuth2 / social-login flows that back a Laravel-Socialite-style "log in with Google/GitHub" experience, using only the standard library.
token
Package token implements Sanctum-style personal access tokens for lagodev-based applications.
Package token implements Sanctum-style personal access tokens for lagodev-based applications.
Package authz provides Gate (function-based) and Policy (struct-based) authorisation primitives modelled on Laravel's Gate facade.
Package authz provides Gate (function-based) and Policy (struct-based) authorisation primitives modelled on Laravel's Gate facade.
Package broadcasting provides a pub/sub abstraction modelled on Laravel's Broadcasting facade.
Package broadcasting provides a pub/sub abstraction modelled on Laravel's Broadcasting facade.
Package cache provides a key-value cache abstraction with a built-in in-memory store.
Package cache provides a key-value cache abstraction with a built-in in-memory store.
Package carbon is a small ergonomic wrapper around time.Time modelled on Laravel's Carbon helper.
Package carbon is a small ergonomic wrapper around time.Time modelled on Laravel's Carbon helper.
Package casts provides a small attribute-casting layer the ORM applies on reads and writes.
Package casts provides a small attribute-casting layer the ORM applies on reads and writes.
cli
Package cli implements the Artisan-style command-line interface.
Package cli implements the Artisan-style command-line interface.
cmd
Package cmd contains the implementation of each Artisan subcommand.
Package cmd contains the implementation of each Artisan subcommand.
cmd
artisan command
Command artisan is the default lagodev Artisan-style CLI binary.
Command artisan is the default lagodev Artisan-style CLI binary.
lago command
Command lago is the alternative name for the lagodev CLI.
Command lago is the alternative name for the lagodev CLI.
Package collection provides a type-safe, ergonomic wrapper over Go slices, modelled on Laravel's Collections but idiomatic Go.
Package collection provides a type-safe, ergonomic wrapper over Go slices, modelled on Laravel's Collections but idiomatic Go.
Package config loads framework configuration from environment variables and .env files.
Package config loads framework configuration from environment variables and .env files.
Package container provides a type-safe, generics-based dependency injection (service) container modelled on Laravel's container and NestJS's DI, made idiomatic for Go.
Package container provides a type-safe, generics-based dependency injection (service) container modelled on Laravel's container and NestJS's DI, made idiomatic for Go.
Package crypt provides symmetric encryption and HMAC signing helpers modelled on Laravel's Crypt facade.
Package crypt provides symmetric encryption and HMAC signing helpers modelled on Laravel's Crypt facade.
drivers
mysql
Package mysql registers the MySQL/MariaDB driver and grammar.
Package mysql registers the MySQL/MariaDB driver and grammar.
postgres
Package postgres registers the PostgreSQL driver and grammar.
Package postgres registers the PostgreSQL driver and grammar.
sqlite
Package sqlite registers the SQLite driver (via mattn/go-sqlite3) and provides a Grammar implementation.
Package sqlite registers the SQLite driver (via mattn/go-sqlite3) and provides a Grammar implementation.
Package events provides an in-process event dispatcher modelled on Laravel's Event facade.
Package events provides an in-process event dispatcher modelled on Laravel's Event facade.
examples
basic command
Example: end-to-end usage of lagodev with an in-memory SQLite database.
Example: end-to-end usage of lagodev with an in-memory SQLite database.
microservice command
Example: a microservice-style worker that reads jobs from a queue table.
Example: a microservice-style worker that reads jobs from a queue table.
secure command
Example: secure-by-default lagodev HTTP service.
Example: secure-by-default lagodev HTTP service.
Package factory provides a generic, type-safe model factory inspired by Laravel's factories.
Package factory provides a generic, type-safe model factory inspired by Laravel's factories.
Package filesystem provides a Disk abstraction modelled on Laravel's Storage facade.
Package filesystem provides a Disk abstraction modelled on Laravel's Storage facade.
s3 module
Package graphql is a dependency-free, struct-first GraphQL execution engine for the lagodev framework.
Package graphql is a dependency-free, struct-first GraphQL execution engine for the lagodev framework.
Package httpclient is a fluent wrapper around net/http modelled on Laravel's Http facade.
Package httpclient is a fluent wrapper around net/http modelled on Laravel's Http facade.
Package i18n provides translation primitives modelled on Laravel's Lang facade.
Package i18n provides translation primitives modelled on Laravel's Lang facade.
internal
inflect
Package inflect provides minimal, allocation-conscious string transformations used across the framework (snake_case, plural table names, etc.).
Package inflect provides minimal, allocation-conscious string transformations used across the framework (snake_case, plural table names, etc.).
reflectutil
Package reflectutil provides a thread-safe, allocation-amortized reflection cache.
Package reflectutil provides a thread-safe, allocation-amortized reflection cache.
Package logger provides a small, dependency-free structured logger used across the framework.
Package logger provides a small, dependency-free structured logger used across the framework.
Package mail provides a Mailer abstraction with an SMTP driver modelled on Laravel's Mail facade.
Package mail provides a Mailer abstraction with an SMTP driver modelled on Laravel's Mail facade.
mailgun
Package mailgun implements mail.Mailer against Mailgun's HTTP API (https://documentation.mailgun.com/en/latest/api-sending.html).
Package mailgun implements mail.Mailer against Mailgun's HTTP API (https://documentation.mailgun.com/en/latest/api-sending.html).
sendgrid
Package sendgrid implements mail.Mailer against SendGrid's v3 HTTP API (https://docs.sendgrid.com/api-reference/mail-send/mail-send).
Package sendgrid implements mail.Mailer against SendGrid's v3 HTTP API (https://docs.sendgrid.com/api-reference/mail-send/mail-send).
Package migrations implements a Laravel-style migration engine.
Package migrations implements a Laravel-style migration engine.
Package mock provides small testing helpers modelled on Laravel's Mock facade — the bits applications reach for over and over in tests without pulling in a full mocking framework.
Package mock provides small testing helpers modelled on Laravel's Mock facade — the bits applications reach for over and over in tests without pulling in a full mocking framework.
Package notifications provides multi-channel notification delivery modelled on Laravel's Notification facade.
Package notifications provides multi-channel notification delivery modelled on Laravel's Notification facade.
Package observability provides a vendor-neutral, dependency-free observability layer for the lagodev framework: tracing, metrics and trace-correlated logging.
Package observability provides a vendor-neutral, dependency-free observability layer for the lagodev framework: tracing, metrics and trace-correlated logging.
Package openapi generates a valid OpenAPI 3.1 document for a lagodev application using only the standard library and reflection.
Package openapi generates a valid OpenAPI 3.1 document for a lagodev application using only the standard library and reflection.
Package orm provides an ActiveRecord-style Model, a fluent query builder, hooks, casts, and relationships.
Package orm provides an ActiveRecord-style Model, a fluent query builder, hooks, casts, and relationships.
Package process wraps os/exec with a fluent builder modelled on Laravel's Process facade.
Package process wraps os/exec with a fluent builder modelled on Laravel's Process facade.
Package query provides a fluent, driver-aware SQL builder.
Package query provides a fluent, driver-aware SQL builder.
Package queue provides a job queue abstraction modelled on Laravel's Queue facade.
Package queue provides a job queue abstraction modelled on Laravel's Queue facade.
dashboard
Package dashboard provides a Horizon / Bull-Board-style operational view over the parent queue package: live throughput, per-queue counters, and a failed-job list with retry / forget actions.
Package dashboard provides a Horizon / Bull-Board-style operational view over the parent queue package: live throughput, per-queue counters, and a failed-job list with retry / forget actions.
sqlqueue
Package sqlqueue implements a database-backed Queue driver that survives process restarts and works across replicas.
Package sqlqueue implements a database-backed Queue driver that survives process restarts and works across replicas.
Package realtime is a high-level realtime gateway for lagodev, modelled on Laravel Echo / NestJS gateways.
Package realtime is a high-level realtime gateway for lagodev, modelled on Laravel Echo / NestJS gateways.
Package relations implements model relationships with eager-loading.
Package relations implements model relationships with eager-loading.
Package resilience provides composable fault-tolerance primitives for Go services — a circuit breaker, retry with backoff, timeout, bulkhead (concurrency limiter), and a token-bucket rate limiter, modelled on gobreaker / resilience4j.
Package resilience provides composable fault-tolerance primitives for Go services — a circuit breaker, retry with backoff, timeout, bulkhead (concurrency limiter), and a token-bucket rate limiter, modelled on gobreaker / resilience4j.
Package resource is a dependency-free API-resource / serializer layer for turning domain models into clean JSON representations — the JSON-API equivalent of Laravel's API Resources or Django REST Framework serializers.
Package resource is a dependency-free API-resource / serializer layer for turning domain models into clean JSON representations — the JSON-API equivalent of Laravel's API Resources or Django REST Framework serializers.
Package router provides Laravel-style declarative routing that is independent of any HTTP framework.
Package router provides Laravel-style declarative routing that is independent of any HTTP framework.
Package scheduling provides a task scheduler modelled on Laravel's Task Scheduling.
Package scheduling provides a task scheduler modelled on Laravel's Task Scheduling.
Package schema provides a fluent table-builder DSL (Blueprint) and a driver-agnostic Builder that compiles blueprints into SQL via a Grammar implementation provided by the database driver.
Package schema provides a fluent table-builder DSL (Blueprint) and a driver-agnostic Builder that compiles blueprints into SQL via a Grammar implementation provided by the database driver.
Package search provides a Scout-style full-text search abstraction for the lagodev framework.
Package search provides a Scout-style full-text search abstraction for the lagodev framework.
Package seeder runs database seeders with dependency ordering and transactional execution.
Package seeder runs database seeders with dependency ordering and transactional execution.
Package session provides cookie-backed sessions modelled on Laravel's Session facade.
Package session provides cookie-backed sessions modelled on Laravel's Session facade.
Package telescope provides a Laravel-Telescope-style in-process debug dashboard for the lagodev framework, built entirely on the Go standard library (net/http, html/template, sync, encoding/json, time).
Package telescope provides a Laravel-Telescope-style in-process debug dashboard for the lagodev framework, built entirely on the Go standard library (net/http, html/template, sync, encoding/json, time).
Package testing provides helpers for running migrations against an ephemeral SQLite database, useful for unit and integration tests.
Package testing provides helpers for running migrations against an ephemeral SQLite database, useful for unit and integration tests.
Package validation provides a dependency-free, Laravel-FormRequest-grade request validator for structs and maps.
Package validation provides a dependency-free, Laravel-FormRequest-grade request validator for structs and maps.
Package view is a thin, ergonomic layer over the standard library's html/template, modelled on Laravel's Blade view layer.
Package view is a thin, ergonomic layer over the standard library's html/template, modelled on Laravel's Blade view layer.
Package web is the Laravel-style HTTP framework for lagodev.
Package web is the Laravel-style HTTP framework for lagodev.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL