Simple MVC web framework golang
README
GoIgniter
A lightweight Go web framework inspired by CodeIgniter, built on net/http stdlib.
Under Development - This framework is still in active development. API may change without notice. Not recommended for production use yet.
Features
- Zero external HTTP dependencies (net/http stdlib)
- CodeIgniter-inspired routing & controllers
- Built-in middleware (logger, recovery, CORS, rate limit, auth)
- Security features: CSRF protection, Security headers, Encrypted sessions
- Template engine with hot reload
- Session management (cookie-based, HMAC signed + AES encrypted)
- Auto-routing support
- Project generator -
goigniter new myappcreates a working app with login and admin panel - Secure file upload with MIME validation
Create New Project
All 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 admin@admin.com. 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
Options
| 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
Generated Project Includes
- Login System - Session-based authentication
- Admin Dashboard - Stats, user management (CRUD), settings
- HTMX + Minimal CSS - Modern UI without page reloads
- SQLite/MySQL - Choose your database
The old curl ... setup.sh | bash one-liner still works; it now runs this CLI.
Manual Quick Start
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")
}
Examples
| 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 |
Documentation
- Examples - Usage patterns
- Security Guide - Security best practices
Project Structure
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
License
MIT