run-development
Use this skill when running Hanami 2.x development commands.
Quick Reference
| Command | Purpose |
|---|---|
hanami dev |
Start development server with code reloading |
hanami console |
Start interactive REPL with full container loaded |
hanami routes |
List all routes |
hanami middleware |
List middleware stack |
hanami version |
Show Hanami version |
Core Rules
Start the development server:
hanami devVerify: Once started, confirm the server is responding:
curl http://localhost:2300Error recovery:
- Port already in use:
lsof -ti:2300 | xargs kill -9or change port inconfig/app.rb - Server fails to start: Check
config/app.rbandconfig/routes.rbfor syntax errors - Does not reload configuration files (requires restart after editing
config/app.rborconfig/routes.rb)
- Port already in use:
Start the console:
Before starting, ensure
DATABASE_URLis set if your app uses a database:echo $DATABASE_URLThen start the console:
hanami consoleUses
developmentenvironment by default; override withHANAMI_ENV=test hanami console.Access components directly:
app = Hanami.app rom = app["db.rom"] users = rom.relations[:users] users.insert(email: "test@example.com")Error recovery:
- Database connection refused: Verify
DATABASE_URLis set and database server is running - Boot errors: Check
config/providers/for missing dependencies or configuration issues
- Database connection refused: Verify
Use the console for exploration:
# Query the database Hanami.app["db.rom"].relations[:users].to_a # Access a Repository Hanami.app["repos.user_repo"].all # Access settings Hanami.app[:settings].database_url # Test a Relation query Hanami.app["relations.users"].active.to_aList routes and middleware:
hanami routes hanami middleware
Common Mistakes
- Config files don't reload:
hanami devreloads Ruby code only. Restart the server after editing configuration files. - Environment awareness: Always verify
HANAMI_ENVbefore running destructive operations in the console — it defaults todevelopmentbut is easy to misconfigure.
Integration
| Related Skill | When to chain |
|---|---|
| create-app | Development commands are used after creating the app. |
| manage-database | Database commands may be needed before starting the dev server. |