-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Laravel-grade developer experience for Go.
lagodev is a full backend toolkit — an Eloquent-style ORM, a migration engine, factories, seeders, an Artisan-style CLI, and a native HTTP framework — that drops into any Go project. Use the whole stack, or pick the parts that fit your existing app.
This wiki is the long-form companion to the README on GitHub. The README is the elevator pitch; the wiki is the cookbook.
-
Laravel developers moving to Go. You'll find familiar shapes:
lago make:model,Resource()routes,orm.Query[T], migrations written asup/downclosures, factories, seeders, the whole thing. The mental model maps almost 1:1. - Gophers tired of gluing five libraries together. lagodev's ORM, migrations, factories, scheduler, queue, mailer, and HTTP framework all share the same DB connection, logger, and config object. No more picking GORM + golang-migrate + gofakeit + chi + viper + cron and stitching their lifecycles by hand.
-
Teams that want a secure baseline. The
webpackage is secure-by-default: CSRF, security headers, body limits, rate limiting, and validation are one line each — not a weekend of research and integration.
- Getting-Started — install, scaffold, run an API in ten minutes.
-
Web-Framework —
web.App, routing, middleware, validation, the(any, error)handler contract, the secure-by-default middleware stack. -
ORM —
orm.Query[T], hooks, casts, transactions. - Migrations-and-Schema — the schema DSL, the migration runner's safety guarantees, programmatic use.
- Factories-and-Seeders — generic factories, dependency- ordered seeders, the bundled faker.
-
CLI-Reference — every
lago/artisancommand with examples. -
Configuration —
.envloading order,lago.json, time zones. - Framework-Integration — drop the ORM into Gin / Fiber / Echo / Chi / plain net/http / gRPC.
- Architecture — how the packages fit together, with diagrams.
- FAQ — "Why not just use GORM?" and friends.
- Troubleshooting — concrete errors and their fixes.
package main
import (
"github.com/devituz/lagodev/database"
_ "github.com/devituz/lagodev/drivers/sqlite"
"github.com/devituz/lagodev/migrations"
"github.com/devituz/lagodev/orm"
"github.com/devituz/lagodev/schema"
"github.com/devituz/lagodev/web"
)
type Post struct {
orm.Model
Title string
Body string
}
func init() {
migrations.Register(migrations.Define("0001_posts",
func(c *migrations.Context) error {
return c.Schema(schema.Create("posts", func(t *schema.Blueprint) {
t.ID()
t.String("title")
t.Text("body")
t.Timestamps()
}))
},
func(c *migrations.Context) error {
return c.Schema(schema.DropIfExists("posts"))
},
))
}
type PostController struct{ Conn *database.Connection }
func (p *PostController) Index(c *web.Context) (any, error) {
var out []Post
return out, orm.Query[Post](p.Conn).OrderBy("id", "desc").Get(c.Ctx(), &out)
}
func (p *PostController) Show(c *web.Context) (any, error) {
return orm.Query[Post](p.Conn).Find(c.Ctx(), c.ParamUint("id"))
}
func (p *PostController) Store(c *web.Context) (any, error) {
var x Post
if err := c.Bind(&x); err != nil { return nil, err }
return c.Created(x), orm.Save(c.Ctx(), p.Conn, &x)
}
func (p *PostController) Update(c *web.Context) (any, error) { return nil, nil }
func (p *PostController) Destroy(c *web.Context) (any, error) { return nil, nil }
func main() {
conn, _ := database.Global.Open("default", database.Config{
Driver: "sqlite", DSN: "file::memory:?cache=shared",
})
app := web.New(
web.WithDatabase(conn),
web.WithMigrations(nil),
)
app.Resource("posts", &PostController{Conn: conn})
app.MustRun(":8080")
}go run .
curl -X POST http://localhost:8080/posts -d '{"Title":"hi","Body":"x"}'
curl http://localhost:8080/postsThat's a migration, a model, a controller, five RESTful routes, an HTTP server with graceful shutdown, panic recovery, and request logging — all in one file with no external dependencies beyond the SQLite driver.
lagodev follows SemVer. Pre-v1.0.0 minor
releases may include breaking changes; check the
CHANGELOG
before upgrading. The CHANGELOG is the canonical list of what landed
in each tag.
- Open an issue for bugs or feature requests — use the templates so we have what we need to reproduce.
- Discussions for Q&A, ideas, and "show & tell".
- Security: see SECURITY.md for private reporting.
lagodev on GitHub · MIT-licensed — see LICENSE.