serve / make
All commands below assume you are in an application directory that contains ./grind (created by kona new). From anywhere under that app you can also run the same commands through the global CLI:
kona grind servekona grind migratekona grind --help # explains the proxy; other args are forwarded to ./grindkona grind finds the nearest Gradle project (same walk as ./grind serve), then runs that app’s ./grind or grind.bat with your remaining arguments and exit code.
./grind serve
Section titled “./grind serve”./grind serve./grind serve --host=127.0.0.1 --port=4000./grind serve --in-process --once./grind serve --in-process --bootstrap=bootstrap.App| Flag | Effect |
|---|---|
--host / --port |
Bind address (also via .env as HOST / PORT) |
--in-process |
Load compiled classes and call bootstrap.App.create instead of gradlew run |
--once |
With in-process mode, return after the server starts |
--bootstrap= |
Bootstrap class (in-process only) |
--base= |
Directory to search upward for the Gradle project |
Default host is 127.0.0.1 and default port is 4000 (also in generated .env). If that port is already in use, grind asks whether to try the next one (4001, 4002, …). If no Gradle project is found, grind exits and tells you to run kona new <name>.
./grind make:command
Section titled “./grind make:command”./grind make:command SendDigest./grind make:command SendDigest --command=mail:digest --lang=javaGenerates a ConsoleCommand under app/console/commands/ and registers it in META-INF/kona/commands. Full guide: Creating commands.
./grind make:controller
Section titled “./grind make:controller”./grind make:controller Post./grind make:controller AccountController --lang=javaWrites under src/main/kotlin|java/app/http/controllers/. Names cannot contain path separators; invalid identifiers are rejected. Language defaults from existing .java files under src/main/java/, or pass --lang=.
Unlike serve, make:controller does not walk upward from nested folders unless you pass --base=.
./grind make:resource
Section titled “./grind make:resource”./grind make:resource User./grind make:resource PostResource --collection --lang=javaWrites under src/main/kotlin|java/app/http/resources/. Names get a Resource suffix when missing. Pass --collection to include a static/companion collection helper that wraps items in JsonResource.collection(...).
Database commands
Section titled “Database commands”These commands work with Cadence. Generators write source files; the others boot your application in-process.
| Command | Writes / does |
|---|---|
./grind make:model <Name> [--migration] [--factory] [--seeder] [--all] |
app/Models/<Name>; flags add database/migrations/Create<Table>Table, database/factories/<Name>Factory, database/seeders/<Name>Seeder |
./grind make:migration <snake_name> [--create=table] [--table=table] |
database/migrations/<StudlyName>; create_x_table creates x, …_to_x_table alters x |
./grind make:factory <Name>Factory [--model=Name] |
database/factories/<Name>Factory |
./grind make:seeder <Name>Seeder |
database/seeders/<Name>Seeder |
./grind migrate |
Runs pending migrations as one new batch |
./grind migrate:rollback [--step=N] |
Reverts the last N batches (default 1) |
./grind migrate:reset |
Reverts every migration |
./grind migrate:status |
Lists each registered migration as Ran (with its batch) or Pending |
./grind db:seed [--class=…] |
Runs a seeder (default database.seeders.DatabaseSeeder) |
All generators accept --lang=kotlin|java (default: Java when app/ already has .java files) and --base=, and never overwrite an existing file.
The migrate and seed commands:
- find the project at or above
--base(default: current directory); - load
build/classesand callcreate(String[])on the bootstrap class (--bootstrap=, defaultbootstrap.App), so run./gradlew classesfirst; - use the
MigrationRegistrybound in the application container (they stop with a message when none is bound); - use the container’s
Database(registered byCadenceServiceProvider), or build one from thedatabaseconfig section;--database=nameselects a named connection.
Errors (unknown connection, a failing migration, a missing seeder class) print a message and exit with status 1. See Migrations and Seeders & factories for the APIs behind these commands.
./grind key:generate
Section titled “./grind key:generate”./grind key:generate./grind key:generate --show./grind key:generate --force./grind key:generate --base=/path/to/appSets a cryptographically random application key in the project .env as APP_KEY=base64:… (32 raw bytes, Base64-encoded). That value is what encryption, signed cookies, and related features read as app.key.
| Flag | Effect |
|---|---|
| (none) | Generate a key and write it to .env |
--show |
Print a new key to the terminal and do not modify files |
--force |
Allow overwriting an existing key when APP_ENV=production |
--base= |
Directory to search upward for the Gradle project (same walk as serve) |
What happens on a normal run
Section titled “What happens on a normal run”- Grind finds the application root at or above
--base(default: current directory). - If
.envis missing but.env.exampleexists, grind copies.env.example→.envfirst. - A new
base64:…key is generated (same format askona new). - The
APP_KEY=…line in.envis replaced. If that line is missing, grind exits with an error. - On success:
Application key set successfully.
Existing keys and production
Section titled “Existing keys and production”- If
APP_KEYis empty, grind writes the new key with no extra prompt. - If
APP_KEYis already set and the environment is not production (APP_ENVfrom the process environment, or from.envwhen unset in the process), grind overwrites the key. - If
APP_KEYis already set andAPP_ENV=production, grind warns and asks for confirmation. Decline (or a non-interactive “no”) cancels the command. Pass--forceto skip the prompt.
--show always prints a fresh key and never touches .env, regardless of production or an existing key.
Rotate carefully: ciphertext and signed cookie payloads produced with the old key will not verify after you change APP_KEY. See Encryption.
Not a grind command: creating apps
Section titled “Not a grind command: creating apps”kona new my-app --lang=kotlinSee Installation.