Kyrux
Back

CLI — Commands

Create a new app

go run main.go startapp <name>

Automatically generates:

  • apps/<name>/routes.go — with a GET / route and ExemploView view
  • apps/<name>/views/views.go — with func ExemploView
  • apps/<name>/models/models.go
  • apps/<name>/templates/exemplo.html — a styled welcome page
  • apps/<name>/statics/styles/exemplo.css — styles for the example page
  • The statics/styles/ folder
  • Registers it in InstalledApps and adds the import automatically

Remove an app

go run main.go removeapp <name>

Removes the folder and undoes the registration. Asks for confirmation first.

Generate automatic migrations

go run main.go makemigrations

Reads every struct with kyrux:"pk" in apps/*/models/*.go, core/security/auth/*.go, and core/admin/*.go (ignoring *_test.go), detects tables that haven't been migrated yet, and generates a database/migrations/NNNN_auto.sql file. Review the file before applying it.

Apply migrations

go run main.go migrate

Applies every .sql file in database/migrations/ that hasn't run yet. Records each migration in the kyrux_migrations table — idempotent. Requires DB_ENABLED=true.

Create a superuser

go run main.go createsuperuser

Interactively creates a user with is_admin=true and is_staff=true. Requires DB_ENABLED=true.

The field marked with kyrux:"login" on the auth.User model is always required. The other identifier (username or email) is requested as optional — if provided, it's also checked for uniqueness.

Create a regular user

go run main.go createuser

Interactively creates a regular user (asks whether it's staff). Requires DB_ENABLED=true.

Follows the same behavior as createsuperuser regarding the required login field and the optional identifier.

Remove a migration

go run main.go removemigration 0003        # removes it from disk only
go run main.go removemigration 0003 all    # removes it from disk + from the kyrux_migrations table

Removes the migration by number (NNNN prefix). The all variant requires DB_ENABLED=true. Useful for fixing a migration that was generated with an error before applying it in production.

Run the framework benchmarks

go run main.go benchmark

Runs the performance test layers described in section 22 in sequence (microbenchmark, framework without TCP, regression, and real throughput) and saves the full output to benchmark/benchmark_YYYY-MM-DD_HH-MM-SS.txt, along with the detected Go version and CPU model. A shortcut so you don't have to type each layer's go test commands manually.