Lynx-layout :Lynx Microservice Template
Welcome aboard! 🎉 This Microservice Template Project serves as a scaffold for quickly initiating microservice logic development. It's designed to facilitate the creation of microservices by providing a well-structured, easy-to-navigate project layout.
The project has a strong association with Polaris, utilizing its service discovery, rate limiting, and degradation functions.
Here's a tree-like representation of the project structure:
📦Microservice Template Project
┣ 📂api
┃ ┗📚 Protobuf files for API declaration and management
┣ 📂biz
┃ ┗🏢 Business logic, focusing on the overall process
┣ 📂bo
┃ ┗🔄 Data flow management between `biz` and `data` layers
┣ 📂code
┃ ┗🏷 Application status codes for quick issue identification
┣ 📂conf
┃ ┗⚙️ Configuration files with customizable mappings
┣ 📂data
┃ ┗💽 Data processing, including database and remote calls
┣ 📂service
┃ ┗🛎️ Service declarations, parameter validation, and data conversion
┗ 📂server
┗🖥️ Service configuration for API interfaces
Quick Install
If you want to use this microservice code template, all you need to do is execute the following command to install the Lynx CLI command-line tool, and then run the new command to automatically initialize a runnable project (the new command can support multiple project names).
go install github.com/go-lynx/lynx/cmd/lynx@latest
lynx new demo1 demo2 demo3
Quick Start Code
To get your microservice up and running in no time, use the following code (Some functionalities can be plugged in or out based on your choice.):
func main() {
boot.LynxApplication(wireApp).Run()
}
This code initializes and runs the application with essential components like HTTP, gRPC with TLS, MySQL, Redis, Tracer, and Token.
We hope this guide helps you navigate our Microservice Template Project. Happy coding! 🎉