mithril

command module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 23 Imported by: 0

README

Mithril

A batteries-included, AI-friendly Go web framework built on Fiber, inspired by Django, Laravel, FastAPI, and NestJS.

Documentation: mithril-docs-nine.vercel.app

Features

Available now Planned (see ROADMAP.md)
JWT auth + refresh tokens CSRF, rate limiting, 2FA
Django-style RBAC WebSockets, gRPC, queues
PostgreSQL + goose migrations OpenTelemetry, Sentry, Prometheus
CRUD generator FastAPI-style validation layer
Admin panel + embedded DBMS Object storage (S3/MinIO)
Docker + Kubernetes + CI/CD i18n, CMS module

Quick Start

Install CLI
curl -fsSL https://raw.githubusercontent.com/mithril-framework/mithril/main/install.sh | sh

Or from source:

go install github.com/mithril-framework/mithril/cmd/mithril@v1.0.2
Create a project
mithril new hello-mithril
cd hello-mithril
cp env.example .env
make dc-up-postgres
make migrate-up
make seed              # demo user: user@example.com / password
# or: make createsuperuser
make run

Visit http://localhost:4000 — API docs at /docs, health at /health.

Clone and run this repo
git clone https://github.com/mithril-framework/mithril.git
cd mithril
make install
cp env.example .env
make dc-up-postgres
make migrate-up
make run

CLI Commands

Inside a project, mithril delegates to make:

mithril migrate-up      # Run migrations
mithril crud MODEL=Blog # Generate CRUD from model
mithril seed              # Seed demo data
mithril admin-enable      # Enable /admin panel
mithril dbms              # Start embedded DBMS on :5050
mithril --help            # Full command list

Project Structure

├── main.go              # Application entry point
├── routes/              # Route registration
├── internal/            # Auth, ACL, admin, CRUD handlers
├── database/            # Models, repositories, migrations
├── cmd/                 # CLI tools (mithril, crud, acl, seed, …)
├── pkg/utils/           # Shared utilities
├── public/admin/        # Admin SPA
└── infrastructure/      # Docker, K8s, compose services

Configuration

See env.example. Required for production:

  • JWT_SECRET — must be set when APP_ENV=production
  • DATABASE_URL or DB_* — PostgreSQL connection

Security

Warning: Change JWT_SECRET before deploying. Never commit .env files.

Registration is disabled by default. Set ENABLE_REGISTER=true to allow POST /auth/register.

Contributing

See CONTRIBUTING.md.

Troubleshooting

Wrong mithril on PATH

If mithril --version prints dev or a scaffold message instead of mithril 1.x.x (github.com/mithril-framework/mithril), another binary is shadowing the framework CLI:

which -a mithril
go install github.com/mithril-framework/mithril/cmd/mithril@v1.0.2
export PATH="$(go env GOPATH)/bin:$PATH"
# or symlink to /usr/local/bin:
sudo "$(go env GOPATH)/bin/mithril" init
mithril --version

Quick login without interactive createsuperuser

mithril seed
# user@example.com / password

Or non-interactive superuser:

mithril createsuperuser --email admin@example.com --password 'your-secure-password'

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
acl command
Command acl manages roles, permissions, and superusers (Django-style ACL).
Command acl manages roles, permissions, and superusers (Django-style ACL).
backup command
createsuperuser command
Command createsuperuser interactively creates a superuser (Django-style).
Command createsuperuser interactively creates a superuser (Django-style).
crud command
Command crud generates CRUD repository, handlers, routes, and registers them from a model file.
Command crud generates CRUD repository, handlers, routes, and registers them from a model file.
dbms command
Command dbms runs the embedded PostgreSQL web UI (Adminer-style).
Command dbms runs the embedded PostgreSQL web UI (Adminer-style).
mithril command
Command mithril is the global Mithril CLI.
Command mithril is the global Mithril CLI.
seed command
swagger command
util command
database
examples
internal
acl
db
timezone
Package timezone sets the process default timezone from environment variables.
Package timezone sets the process default timezone from environment variables.
pkg
utils
Package utils provides common utilities for hashing, encryption, encoding, string manipulation, validation, time, pagination, sorting, file operations, and CLI helpers.
Package utils provides common utilities for hashing, encryption, encoding, string manipulation, validation, time, pagination, sorting, file operations, and CLI helpers.
version
Package version is the framework and API release version.
Package version is the framework and API release version.

Jump to

Keyboard shortcuts

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