Folder Structure
Every Nimbus app follows a consistent directory layout inspired by Laravel conventions. When you run nimbus new myapp, the CLI scaffolds the structure below.
Top-level Overview
myapp/
app/
controllers/
middleware/
models/
jobs/
bin/
server.go
config/
config.go
env.go
app.go
database.go
database/
migrations/
seeders/
start/
kernel.go
routes.go
resources/
views/
layout.nimbus
home.nimbus
css/
js/
public/
.env
.env.example
main.go
go.mod
go.sum
app/
Contains your application logic, organized by concern.
app/controllers/
Controller structs that handle HTTP requests. Each controller is a Go struct with methods like Index, Show, Store, Update, and Destroy. Controllers receive a *http.Context and return an error.
app/middleware/
Custom middleware functions for your application. Nimbus ships with built-in middleware (Logger, Recover, CORS, CSRF, RateLimit), but app-specific middleware such as authentication checks or request transformations go here.
app/models/
GORM model structs that map to database tables. Each file typically defines one model and its relationships.
bin/
The application boot file. bin/server.go is the HTTP server entrypoint โ it loads configuration, creates the Nimbus app, registers middleware (via the kernel), wires up routes, and connects to the database.
// bin/server.go
func Boot() *nimbus.App {
config.Load()
app := nimbus.New()
start.RegisterMiddleware(app)
start.RegisterRoutes(app)
_, _ = database.Connect(config.Database.Driver, config.Database.DSN)
return app
}
config/
Application configuration files. Values are loaded from environment variables via .env using godotenv.
config.goโ Loads.envand calls each config loader.env.goโ Helper functions:env(),envInt(),envBool().app.goโ General settings: port, environment, app name.database.goโ Database driver and DSN configuration.
start/
The start/ directory holds files that run during application startup, mirroring Laravel-style boot organization.
kernel.goโ Registers middleware with the server or the router. This is the only place where middleware is configured.routes.goโ Defines all HTTP routes for the application.
database/
Database-related files for managing schema and seed data.
database/migrations/
Migration files that define schema changes. Nimbus uses GORM AutoMigrate or manual migration files to version your database schema.
database/seeders/
Seeder files that populate your database with sample or default data for development and testing.
resources/views/
Template files using the .nimbus extension. These are HTML files with template directives for layouts, data binding, and control flow. Views are rendered by calling c.View("name", data) from a controller or handler.
layout.nimbusโ Base layout wrapping all pages.home.nimbusโ Homepage template.
public/
Static assets served directly by the web server. Place CSS, JavaScript, images, fonts, and other files that should be publicly accessible here.
Root Files
main.goโ Minimal bootstrap entrypoint. Importsbin.Boot()and callsapp.Run(). You should not need to modify this file..envโ Environment variables (PORT, APP_ENV, DB_DRIVER, DB_DSN, etc.)..env.exampleโ Template of available environment variables for new developers.go.mod/go.sumโ Go module files managing dependencies.
Laravel Comparison
If you are coming from Laravel, here is how the Nimbus structure maps:
| Laravel-style concept | Nimbus | Purpose |
|---|---|---|
server.ts | main.go | Untouched entry point |
bin/server.ts | bin/server.go | Boot, config, DB |
start/kernel.ts | start/kernel.go | Middleware only |
start/routes.ts | start/routes.go | Route definitions |
config/*.ts | config/*.go | Environment-driven config |
app/controllers/ | app/controllers/ | HTTP controllers |
app/middleware/ | app/middleware/ | Custom middleware |
resources/views/ | views/ | Templates |