fndn
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.
π Features
- ποΈ Clean architecture scaffolding
- π οΈ Customizable set of techstack
- β‘ Interactive CLI with Bubble Tea
- π³ Docker & containerization ready
- π¦ Go modules setup
[!NOTE]
v0.7.0 now is stable, latest version, and generating one set of application with its driver to 3rd party. in this version, you can generate different framework, database, message queue, in-memory store, and object storage.
π₯ Get started
go run github.com/daffadon/fndn@v0.7.0 init .
* . generate in current directory
OR
go run github.com/daffadon/fndn@v0.7.0 --help
to see how can you use the tools
[!NOTE]
For The first time, it will take longer than expected to generate depends on go cache, go modcache, and your internet speed.
After the project is generated, you can also generate a config for another techstack provided by using below command.
go run github.com/daffadon/fndn@v0.7.0 generate [command]
command: framework, database, mq, cache, storage
π¦ Installation
If you want to install the tools to your system, you can either using go install or download the binary in available release:
go install github.com/daffadon/fndn@v0.7.0
π οΈ The techstack
Currently, the generation are in default mode and custom mode with a freedom to choose framework, database, message queue, in-memory store, object storage that you need. the Default mode is using the first techstack from each section. the generated techstack that you can use are:






π Config Reference
π What fndn do for you (v0.*)
it's generating the folder structure that use 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.sum
The folder structure is grouped by its usage:
cmd: where the command is exist to running the application. there are several folder, which is for bootstraping, dependency injection, construct the server. main.go is the entrypoint for all of those.
config: store all the configs; connection to 3rd party, instantiation of an dependency, configuration for http server, and certificate for tls. furthermore you can add more like grpc server config, log emitter, or any other configuration.
internal: the place where you put on your app logic business that is not should be exposed. this is special folder for golang cause the module can't be imported from anywhere even when the repository is publicly accessible. see more
script: this is shell script for build the app. there are two scripts, one for build the binary and one for build the docker image.
for the files, there are several files that is generated and 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 should you do to this file
Dockerfile: this is generated Dockerfile that use 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 should you do to this file
docker-compose.yml: this is for production purpose. for development, this file is purposed to run the 3rd party for your app.
π how to read the code
|----> 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.go
[!NOTE]
All of dependencies are injected in the cmd/di/di.go. So, calling to the infra in the repository/todo.go is not drawed.
π¨ Troubleshoot
Air is not working on wsl
[!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"
go run command can't be stopped on wsl
[!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.
FerretDB is not working as expected
[!NOTE]
due to limitation, you can't use any database. instead use, postgres database. if you find similar log with 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.