Nunu: A CLI Tool for Building Go Applications

4 min readJun 8, 2023

If you’re a Golang developer, you know how important it is to have a reliable and efficient application scaffold. That’s where Nunu comes in. Named after a character in League of Legends, Nunu is a CLI tool that helps you quickly build a Golang application using popular libraries in the Golang ecosystem.



Nunu comes with several features that make it a great choice for building Golang applications:

- Gin: A popular HTTP web framework
- Gorm: A powerful ORM library
- Wire: A dependency injection framework
- Viper: A configuration management library
- Zap: A logging library
- Golang-jwt: A JWT library
- Go-redis: A Redis client library
- Testify: A testing library
- Sonyflake: A distributed unique ID generator
- robfig-cron: A cron library

And more…


Nunu offers several benefits that make it a great choice for building Golang applications:

- Low learning cost and customization: Nunu encapsulates popular Golang libraries, making it easy to customize your application to meet specific needs.
- High performance and scalability: Nunu uses the latest technology and best practices to ensure that your application can handle high traffic and large amounts of data.
- Secure and reliable: Nunu uses stable and reliable third-party libraries to ensure the security and reliability of your application.
- Modular and extensible: Nunu is designed to be modular and extensible, allowing you to easily add new features and functionality.
- Complete documentation and testing: Nunu provides comprehensive documentation and examples to help you get started quickly. It also includes a set of test suites to ensure that your application works as expected.


Nunu adopts the classic layered architecture and uses the dependency injection framework Wire to achieve modularity and decoupling.

Directory Structure

├── cmd
│ ├── job
│ │ ├── main.go
│ │ ├── wire.go
│ │ └── wire_gen.go
│ ├── migration
│ │ ├── main.go
│ │ ├── wire.go
│ │ └── wire_gen.go
│ └── server
│ ├── main.go
│ ├── wire.go
│ └── wire_gen.go
├── config
│ ├── local.yml
│ └── prod.yml
├── deploy
├── internal
│ ├── handler
│ │ ├── handler.go
│ │ └── user.go
│ ├── job
│ │ └── job.go
│ ├── middleware
│ ├── migration
│ │ └── migration.go
│ ├── model
│ │ └── user.go
│ ├── repository
│ │ ├── repository.go
│ │ └── user.go
│ ├── server
│ │ └── http.go
│ └── service
│ ├── service.go
│ └── user.go
├── mocks
│ ├── repository
│ │ └── user.go
│ └── service
│ └── user.go
├── pkg
├── scripts
├── storage
├── test
│ └── server
│ ├── handler
│ │ └── user_test.go
│ ├── repository
│ │ └── user_test.go
│ └── service
│ └── user_test.go
├── web
│ └── index.html
├── Makefile
├── coverage.html
├── go.mod
└── go.sum

Nunu follows the classic Golang project directory structure, which includes the following directories:

  • cmd: Contains the code for command-line applications, such as main.go.
    - config: Contains configuration files, such as config.yaml.
    - internal: Contains internal code that is not exposed externally.
  • — repository: Contains the code for Data Access.
    — handler: Contains the code for HTTP request handlers.
    — middleware: Contains the code for HTTP middleware.
    — model: Contains the code for data models.
    — provider: Contains the code for dependency injection.
    — server: Contains the code for HTTP servers.
    — service: Contains the code for business logic.
  • pkg: Contains reusable code that is exposed externally.
    — config: Contains the code for reading configuration files.
    — helper: Contains the code for helper functions.
    — http: Contains HTTP-related code.
    — log: Contains code related to logging.


To use Nunu, you need to install the following software on your system:

  • Golang 1.16 or higher
  • Git
  • MySQL 5.7 or higher (optional)
  • Redis (optional)


You can install Nunu using the following command:

go install

Creating a New Project

You can create a new Golang project using the following command:

nunu new projectName

This command will create a directory named projectName and generate an elegant Golang project structure within it.

Creating Components

You can create handlers, services, and daos for your project using the following commands:

nunu create handler user
nunu create service user
nunu create repository user
nunu create model user

These commands will create components named UserHandler, UserService, UserRepository, and UserModel, respectively, and place them in the correct directories.

Starting the Project

You can quickly start your project using the following command:

nunu run

This command will start your Golang project and support file update hot reload.

Compiling wire.go

You can quickly compile your wire.go file using the following command:

nunu wire

This command will compile your wire.go file and generate the required dependencies.


If you find any issues or have any improvement suggestions, please feel free to raise an issue or submit a pull request. We welcome your contributions!


Nunu is released under the MIT license. See LICENSE for more information.