Documentation
Project Structure
What gostrata generates and where things live.
A newly generated project looks like this:
my-saas
my-saas/
├── cmd/
│ ├── api/
│ └── migrate/
├── config/
├── internal/
│ ├── domain/
│ │ ├── entity/
│ │ ├── errors/
│ │ └── repository/
│ ├── usecase/
│ │ ├── interface/
│ │ └── implementation/
│ ├── delivery/http/
│ │ ├── handlers/
│ │ ├── middleware/
│ │ ├── response/
│ │ └── routes.go
│ ├── infrastructure/
│ │ ├── container/
│ │ ├── database/
│ │ ├── persistence/
│ │ └── server/
│ └── types/
├── migrations/
├── pkg/logger/
├── .air.toml
├── .env
├── .gostrata.json
├── .dockerignore
├── Dockerfile
├── docker-compose.yml
├── Makefile
└── go.modDirectories
cmd/api— the API entry point. Loads config and starts the server.cmd/migrate— runs database migrations up or down. Used bymake migrate.internal/domain—entity,errorsandrepositoryinterfaces.internal/usecase—interfacedeclarations and theirimplementation.internal/delivery/http—handlers,middleware(CORS, request ID, logging, recovery), the JSONresponsehelpers androutes.go.internal/infrastructure— thecontainerthat wires dependencies, plusdatabase, GORMpersistencerepositories and theserver.internal/types— request, input and response DTOs.migrations— numbered.up.sqland.down.sqlfiles.config— Viper configuration.pkg/logger— the Zerolog logger.
Starter feature
Every new project already includes a working User feature, a /health endpoint and an initial users migration, so you can run the server straight away.
Root files
.envand.env.example— environment settings..air.toml— hot reload settings..gostrata.json— records your router, database and ORM so generators match your stack.Dockerfileand.dockerignore— a multi-stage build for the API.docker-compose.yml— the database service, for PostgreSQL and MySQL projects.Makefile—run,dev,build,migrate,migrate-down,test,tidyandclean.