Simple MVC web framework golang
翻译准备中
正在加载完整 README。
查看完整 README ↗Under Development - This framework is still in active development. API may change without notice. Not recommended for production use yet.
goigniter new myapp creates a working app with login and admin panelAll you need is Go 1.24+. No C compiler, no database server: SQLite is built in. Works the same on Windows, macOS and Linux.
go install github.com/semutdev/goigniter/cmd/goigniter@latest
goigniter new myapp
cd myapp
go run .
Open http://localhost:8080 and log in as [email protected]. The admin password is printed in the console on the first run (or set ADMIN_PASSWORD in .env before starting). Tables are created automatically.
Without installing the CLI:
go run github.com/semutdev/goigniter/cmd/goigniter@latest new myapp
| Flag | Description | Default |
|---|---|---|
--module | Go module path | (project name) |
--db | Database type (sqlite/mysql) | sqlite |
--db-host | MySQL host | 127.0.0.1 |
--db-port | MySQL port | 3306 |
--db-user | MySQL user | root |
--db-pass | MySQL password | (empty) |
--db-name | MySQL database name | (project name) |
--skip-tidy | Don't run go mod tidy | false |
goigniter new myapp --db=mysql --db-user=root --db-pass=password --db-name=myapp
The old curl ... setup.sh | bash one-liner still works; it now runs this CLI.
If you prefer to build manually without the setup script:
package main
import (
"goigniter/system/core"
"goigniter/system/middleware"
)
func main() {
app := core.New()
app.Use(middleware.Logger())
app.Use(middleware.Recovery())
app.GET("/", func(c *core.Context) error {
return c.JSON(200, core.Map{"message": "Hello GoIgniter!"})
})
app.Run(":8080")
}
| Example | Description | Run |
|---|---|---|
examples/simple | Basic routing & JSON response | go run examples/simple/main.go |
examples/autoroute | Controller auto-routing | go run examples/autoroute/main.go |
examples/views | Template rendering | cd examples/views && go run main.go |
examples/database | Query builder (SQLite) | go run examples/database/main.go |
examples/full-crud | Full CRUD with database (GORM) | cd examples/full-crud && go run main.go |
goigniter/
├── system/
│ ├── core/ # Core framework (router, context, controller)
│ ├── middleware/ # Built-in middleware
│ ├── libraries/ # Session, database query builder
│ └── helpers/ # URL helpers, template funcs
├── cmd/goigniter/ # CLI: `goigniter new` (templates/ holds the generated files)
├── examples/ # Usage examples
├── starter/ # Minimal starter template
└── setup/setup.sh # Legacy curl installer, runs the CLI
MIT