Project Structure
Put feature code in internal/. Use app/ to register the routes, commands, and dependencies that the App exposes.
Default App Layout
These are the files behind the users endpoint in Your First Route, along with the main Project settings.
.
├── .goforj.yml
├── .env
├── go.mod
├── cmd/app/main.go
├── app/
│ ├── routes.go
│ └── wire/
└── internal/users/
├── controller.go
├── service.go
└── service_test.goThe controller handles HTTP and calls the service. The provider files connect their constructors, and app/routes.go registers the routes. GoForj owns the entrypoint in cmd/app/main.go, which launches the App.
Where Common Changes Go
| Change | Implementation | App Registration |
|---|---|---|
| Route or controller | internal/<domain>/controller.go | app/routes.go and inject_http_controllers_app.go |
| Service | internal/<domain>/service.go | inject_services_app.go |
| Model or repository | internal/models/ or the feature package | inject_repositories_app.go |
| Console command | internal/cmd/ or the feature package | app/commands.go and inject_cmd_app.go |
| Queue job | internal/jobs/ or the feature package | inject_jobs_app.go |
| Scheduled task | internal/schedules/ or the feature package | inject_schedules_app.go for generated tasks, app/schedules.go for direct registrations |
| Startup or shutdown hook | In the service that owns the resource | app/lifecycle.go |
The provider files in the last column live under app/wire/. Make commands create implementations and update their registrations. For example, forj make:command reports:sync puts the command in internal/reports/sync_cmd.go. See Package Placement and Wiring Recipes.
Enabled components add their own paths. Database migrations start in migrations/. The File Ownership reference lists the generated database, cache, storage, queue, event, and mail packages. HTTP Runtime covers the server under internal/http/.
Files You Can Edit
Edit your feature code, migrations, and App-owned registration files normally. GoForj preserves App registration files on a render. Make commands can update them when they add a route, command, or provider.
Change the inputs to generated files and rebuild. GoForj refreshes files such as app/root_cmd.go and app/wire/wire.go when it renders. It writes the Wire graph, resource accessors, API artifacts under build/, and binaries under bin/ during the build. See File Ownership.
When a starter kit is selected, a full render refreshes kit files under cmd/app/frontend/. The templ + htmx kit also refreshes framework-owned files under internal/starterui/. Demo rendering refreshes its example packages and migrations. Keep feature code in your own packages and review the starter-kit render rules before rerendering a customized kit.
Local Development rebuilds after watched changes. Run forj build for an explicit build, or forj route:list to check route registration against current source.
Root Configuration
| File | What It Controls |
|---|---|
.goforj.yml | Components, App metadata, development tasks, and module replacements |
.env and .env.host | Private runtime settings and host overrides |
.env.example and .env.testing | Committed key inventory and test configuration |
.env.local | Development overrides that a full render regenerates |
Keep private values you need to preserve in .env or .env.host. See Configuration for when changes require a restart, build, or render.
Additional Apps
One App can expose many feature packages. If you need a second binary, add an App such as admin. It gets its own entrypoint in cmd/admin/ and registration files in app/admin/, including its Wire graph under app/admin/wire/.
The two Apps share go.mod and can import the same packages under internal/. Each App constructs its own services and builds its own binary. HTTP API artifacts go under build/admin/ for admin. See Multi-App Migrations for the App and connection directories.
With a starter kit, the admin App has its own frontend under cmd/admin/frontend/. forj dev builds the configured frontends before rebuilding their owning App. One App can manage several SPA entries. The App controls how it serves or deploys their output.
Follow Dependency Injection to see how the provider files turn the users service and controller into constructor calls.