Documentation

docs
cli
overview

CLI Overview

CLI Overview

Mithril provides a global CLI (mithril) and project commands that delegate to make.

Global Commands#

mithril --version          # Show version (alias: version, ping)
mithril init               # Symlink CLI to /usr/local/bin
mithril new <name>         # Scaffold new project (git clone + setup)
mithril help               # Usage

Project Commands#

Inside a Mithril project (detected by go.mod + Makefile), any make target works:

cd my-app
mithril run
mithril run-dev
mithril migrate-up
mithril crud MODEL=Blog
mithril seed
mithril createsuperuser
mithril backup
mithril swagger
mithril admin-enable
mithril dbms

Equivalent to ./mithril <target> or make <target>.

Development#

CommandDescription
mithril installgo mod tidy && go mod download
mithril rungo run .
mithril run-devAir live reload
mithril buildgo build -o bin/app .
mithril testgo test -v ./...
mithril routesPrint registered routes
mithril killStop dev server / Air

Database#

CommandDescription
mithril migrate-upApply goose migrations
mithril migrate-downRoll back one migration
mithril migrate-statusMigration status
mithril migrate-resetReset DB (destructive)
mithril seedRun seed data
mithril backupDatabase backup
mithril restoreRestore from backup
mithril backup-listList backups

Code Generation#

mithril crud MODEL=User
go run ./cmd/crud --dry-run Blog

ACL#

mithril acl-role-create NAME=editor
mithril acl-permission-create NAME=blogs.view
mithril acl-assign-role EMAIL=user@example.com ROLE=editor
mithril acl-superuser-set EMAIL=admin@example.com

Run make acl for full ACL help.

Utilities#

mithril secret              # Generate random secret
mithril hash TEXT=password  # bcrypt hash
mithril sha256 TEXT=hello
mithril encode TEXT=hello   # Base64 encode
mithril decode TEXT=aGVsbG8=  # Base64 decode

Admin & DBMS#

mithril admin-enable / admin-disable
mithril dbms-enable / dbms-disable
mithril dbms                # Start embedded DBMS on :5050

Install Script#

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

Next Steps#