No Description

chris bf2822f75d zap log encoding 2 years ago
cmd 673a5a05a0 add gracefully shutdown 2 years ago
config bf2822f75d zap log encoding 2 years ago
deploy b80f9e0ff3 Replace repository with dao 2 years ago
internal bf2822f75d zap log encoding 2 years ago
pkg bf2822f75d zap log encoding 2 years ago
script b80f9e0ff3 Replace repository with dao 2 years ago
test bf2822f75d zap log encoding 2 years ago
web e5886f8d04 add code 2 years ago
.gitignore bf2822f75d zap log encoding 2 years ago
LICENSE 695f77cc1a Initial commit 2 years ago
README.md bf2822f75d zap log encoding 2 years ago
README_zh.md bf2822f75d zap log encoding 2 years ago
go.mod 673a5a05a0 add gracefully shutdown 2 years ago
go.sum 673a5a05a0 add gracefully shutdown 2 years ago

README.md

Nunu

中文介绍

Nunu is an application scaffold based on Golang. Its name comes from the character Nunu in League of Legends, who is a little boy riding on the shoulder of a snowman. Like Nunu, This Project also stands on the shoulders of giants, and it is composed of various third-party libraries, including gin, gorm, wire, viper, zap, golang-jwt, go-redis, testify, sonyflake, go-survey, cobra, etc. These libraries are very popular in the Golang ecosystem, and their combination can help you quickly build an efficient and reliable application.

Nunu

Features

Preview

Nunu

Directory Structure

.
├── cmd
│   └── server
│       ├── wire
│       │   ├── wire.go
│       │   └── wire_gen.go
│       └── main.go
├── config
│   ├── local.yml
│   └── prod.yml
├── internal
│   ├── dao
│   │   ├── dao.go
│   │   └── user.go
│   ├── handler
│   │   ├── handler.go
│   │   └── user.go
│   ├── middleware
│   │   └── cors.go
│   ├── model
│   │   └── user.go
│   ├── provider
│   │   └── provider.go
│   ├── server
│   │   └── http.go
│   └── service
│       ├── service.go
│       └── user.go
├── pkg
│   ├── config
│   │   └── config.go
│   ├── helper
│   │   ├── md5
│   │   │   └── md5.go
│   │   ├── resp
│   │   │   └── resp.go
│   │   ├── sonyflake
│   │   │   └── sonyflake.go
│   │   └── uuid
│   │       └── uuid.go
│   ├── http
│   │   └── http.go
│   └── log
│       └── log.go
├── LICENSE
├── README.md
├── README_zh.md
├── go.mod
└── go.sum

This is the directory structure of a classic Golang project, 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.
    • dao: Contains the code for Data Access Objects (DAOs).
    • 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.

Requirements

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

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

Installation

You can install Nunu using the following command:

go install github.com/go-nunu/nunu@latest

Usage

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 dao user

or

nunu create hsd user

These commands will create components named UserHandler, UserService, and UserDao, 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.

Contributing

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!

License

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