GORO is a tool that creates a neat and easily expandable project layout for your Golang code, including all the essential boilerplate.
This project is currently in the alpha stage, indicating that it's in the early phases of development. It may contain bugs, undergo frequent changes, and lack certain features. Use it cautiously and feel free to contribute to its improvement. Check the issues for known problems or planned enhancements.
Starting a new Golang project often involves setting up a project layout and defining a solid architecture. GORO, the code generation tool, simplifies this process, allowing you to focus on the core of your project rather than getting bogged down by the initial setup.
-
Rapid Project Kickstart: GORO provides a clean and easily extendable Golang project layout, enabling you to kickstart your project swiftly. Say goodbye to the tedious task of manually structuring your project each time.
-
Consistent Code Architecture: With GORO, maintain a single, consistent approach to your code architecture across projects. This ensures a streamlined development process and facilitates easier collaboration among team members.
-
Time Savings: GORO saves you valuable time by automating the project initialization process. The time spent on setting up a new project with GORO is significantly less than manual implementation, allowing you to dive into your project's core functionalities sooner.
-
Reduced Error Rate: GORO minimizes the chances of errors during project setup. By automating the generation of a clean and organized project structure, GORO reduces the risk of common mistakes, letting you focus on the creative and innovative aspects of your project.
-
Flexibility with Frameworks: GORO is designed to integrate seamlessly with various web frameworks. Whether you prefer a specific framework or want the flexibility to switch between them, GORO provides the adaptability you need.
Give GORO a try and experience a faster, more efficient start to your Golang projects.
To install GORO, run:
go install github.com/hanagantig/goro@latest
Goro uses yaml configuration for your service modules. Download an example config goro.yaml.
After that you can run init
command with the config:
goro init --config /path/to/config/goro.yaml
You will be prompted for the workir directory. Provide an absolute path for your service root path.
Voilร ! Your service is ready. You can run and check the ping
http method generated by default.
Go to your workdir and run command:
go run . http --config=./config/app.conf.yaml
Open in your browser http://localhost:8095/api/v1/ping
And you can see pong
for your ping
.
You can get more details from the Youtube video (in Russian):
You can also access the slides from the video through this link from the video
โโโ api - your api specs (swagger, protobuf etc.)
โ โโโ v1 - version and particular specs inside
โ โ โโโ swagger.yaml
โ โ
โโโ build - folder with docker files, docker-compose files and so on
โ โโโ Dockerfile
โ โโโ ...
โโโ cmd - folder with commands provided by your service
โ โโโ command_name.go - service command implementation
โ โโโ ...
โโโ configs - service config files
โ โโโ prod.conf.yaml
โ โโโ local.conf.yaml
โ โโโ dev.conf.yaml
โ
โโโ internal - folder for your internal package. Usually you write code here.
โ โโโ app - App structure with bootstrapping, definitions and DI
โ โ
โ โโโ entity - service entity (they should be used globally through all layers as a data transmitters)
โ โ
โ โโโ service - list of our services with business logic. This layer interacts with adapter layer.
โ โ
โ โโโ usecase - usecase layer represent our service behaviour. It's describes all app features - interface for whole service.
โ โ Use case orchestrate with services and aggregate service methods calls. It can be used only in handler layer.
โ โโโ adapter - your infrastructure is here. Adapter folder contains packages for database connection, other http/grpc service clients, AMQP connections etc. ...
โ โ โโโ webapi
โ โ โโโ sqlrepository
โ โ โโโ ...
โ โโโ config - you can find here a code for parsing and loading service configs
โ โโโ handler - our handlers - a layer to communicate with client. It describes our transport and request/response models.
โ โโโ http - http protocol handler
โ โ โโโ http.go - http server implementation
โ โ โโโ router.go - base router implementation
โ โ โโโ api - package for service http API methods
โ โ โโโ v1
โ โ โโโ models - request/response methods (usually generated from swagger file)
โ โ โโโ handler.go - api methods implementation
โ โ โโโ router.go - api methods routing
โ โโโ grpc - grpc protocol handlers
โ โโโ amqp - amqp protocol handlers
โ โโโ ...
โโโ pkg - your public pkgs
Stay updated and join our community on Telegram:
We value your feedback, comments, and suggestions! Feel free to share your thoughts in our Telegram channel. Whether you have questions, ideas for improvement, or just want to say hello, we'd love to hear from you.