fndn

command module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 1 Imported by: 0

README ΒΆ

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:

  • Framework

Gin Fiber Echo Chi Gorilla/mux

  • Database

Postgresql MariaDB ClickHouse MongoDB FerretDB Neo4J

  • Message Queue

Nats RabbitMQ Kafka Amazon SQS

  • Cache

Redis Valkey Dragonfly Redict

  • Object Storage

Rustfs Seaweedfs Minio

  • Deployment

Docker

πŸ“ƒ 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:

  1. 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.
  2. 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.
  3. 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
  4. 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:

  1. .air.toml: Check your repository readme for special notes if it's not working on windows
  2. .env.example: check your repository readme for what should you do to this file
  3. 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.
  4. config.local.yaml: check your repository readme for what should you do to this file
  5. 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.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL