A CLI scaffolding tool for Go backend projects. Bootstrap your Go projects with clean architecture, best practices, and a solid foundation — all generated in seconds.
Go >= v1.26.8
Install the tool to your system with go install, or download a binary from the releases page:
go install github.com/daffadon/fndn@latestTo pin a version:
go install github.com/daffadon/fndn@v0.8.3go run github.com/daffadon/fndn@v0.8.3 init .* . generates in the current directory.
Or see all commands:
go run github.com/daffadon/fndn@v0.8.3 --helpNote
The first generation takes longer than expected, depending on the Go build cache, module cache, and internet speed.
After the project is generated, you can add a config for another tech stack with:
go run github.com/daffadon/fndn@v0.8.3 generate [command]command: framework, database, mq, cache, storage
- Clean architecture scaffolding
- Customizable tech stack
- Interactive CLI with Bubble Tea
- Docker and containerization ready
- Go modules setup
Generation runs in default mode or custom mode, with the freedom to choose the framework, database, message queue, in-memory store, and object storage you need. Default mode uses the first tech stack from each section.
It generates a folder structure that uses clean architecture as reference. If you're not familiar with the scheme, don't worry, let's talk about it.
Project Folder Structure
project
├── cmd
│ ├── bootstrap
│ │ └── bootstrap.go
│ ├── di
│ │ └── container.go
│ ├── server
│ │ └── server.go
│ └── main.go
├── config
│ ├── cache
│ │ └── redis.go
│ ├── env
│ │ └── env.go
│ ├── logger
│ │ └── zerolog.go
│ ├── mq
│ │ ├── nats-server.conf
│ │ └── nats.go
│ ├── router
│ │ └── http.go
│ └── storage
│ ├── minio.go
│ └── postgresql.go
├── internal
│ ├── domain
│ │ ├── dto
│ │ │ └── todo.go
│ │ ├── handler
│ │ │ ├── http.go
│ │ │ └── todo.go
│ │ ├── repository
│ │ │ └── todo.go
│ │ └── service
│ │ └── todo.go
│ ├── infra
│ │ ├── cache
│ │ │ └── redis.go
│ │ ├── mq
│ │ │ └── jetstream_infra.go
│ │ └── storage
│ │ ├── minio.go
│ │ └── querier.go
│ └── pkg
│ └── .gitkeep
├── script
│ ├── build-binary.sh
│ └── docker-build.sh
├── .air.toml
├── .env.example
├── .gitignore
├── Dockerfile
├── Makefile
├── README.md
├── VERSION
├── config.local.yaml
├── docker-compose.yml
├── go.mod
└── go.sumThe folder structure is grouped by its usage:
cmd: where the commands exist to run the application. There are several folders for bootstrapping, dependency injection, and constructing the server.main.gois the entrypoint for all of those.config: stores all the configs; connection to 3rd party services, instantiation of dependencies, configuration for the http server, and certificates for tls. Furthermore you can add more like grpc server config, log emitter, or any other configuration.internal: the place where you put your app business logic that should not be exposed. This is a special folder for golang because the module can't be imported from anywhere even when the repository is publicly accessible. see morescript: shell scripts to build the app. There are two scripts, one to build the binary and one to build the docker image.
Several generated files you can change for your app:
.air.toml: Check your repository readme for special notes if it's not working on windows.env.example: check your repository readme for what you should do with this fileDockerfile: this generated Dockerfile uses multistage and distroless. So in case you want to do something to your containerized app and need a shell, you can change the base image of the second stage.config.local.yaml: check your repository readme for what you should do with this filedocker-compose.yml: this is for production purposes. For development, this file is purposed to run the 3rd party services for your app.
|----> config/*.go (except /env)
(cmd) |
main.go -> bootstrap/bootstrap.go -> di/di.go ---|----> internal/domain/*.go (except /dto)
| |
| |----> internal/infra/*.go
|----> server.go
|
|(/internal)
|
|---> handler/http.go -> handler/todo.go -> service/todo.go -> repository/todo.goNote
All of the dependencies are injected in the cmd/di/container.go. So, calling the infra in the repository/todo.go is not shown.
Note
If you use windows and generate the project using wsl, the hot reload won't work. Better you use the fndn for windows in this case or if its already generated, you can change the .air.toml in bin and cmd to become like below and run air from windows, not from wsl.
bin = "./tmp/main.exe"
cmd = "go build -o ./tmp/main.exe ./cmd"Note
In windows environment, sometimes go run command can't be stopped. It's because the compatibility. Just use powershell to run the app and don't use the wsl.
Note
Due to limitation, you can't use any database. Instead use, postgres database. If you find a similar log with the below log in your postgres db, change the database to postgres (i've made this default, but in case you change the database name in docker-compose.yml, change your database).
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/20-install.sql
psql:/docker-entrypoint-initdb.d/20-install.sql:1: NOTICE: installing required extension "documentdb_core"
psql:/docker-entrypoint-initdb.d/20-install.sql:1: NOTICE: installing required extension "pg_cron"
2025-09-30 06:23:15.653 UTC [76] ERROR: can only create extension in database postgres
psql:/docker-entrypoint-initdb.d/20-install.sql:1: ERROR: can only create extension in database postgres
DETAIL: Jobs must be scheduled from the database configured in cron.database_name, since the pg_cron background worker reads job descriptions from this database.
HINT: Add cron.database_name = 'database_name' in postgresql.conf to use the current database.