• Stars
    star
    158
  • Rank 237,131 (Top 5 %)
  • Language
    Go
  • License
    Other
  • Created over 2 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generate GO project layout with essential boilerplate code

Goro

Telegram

GORO is a tool that creates a neat and easily expandable project layout for your Golang code, including all the essential boilerplate.

Project Status

โš ๏ธ Alpha Stage: Work in Progress

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.

Why use GORO?

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.

Key Benefits:

  • 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.

Getting started

To install GORO, run:

go install github.com/hanagantig/goro@latest

Run an example service

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.

Youtube presentation

You can get more details from the Youtube video (in Russian):

ะั€ั…ะธั‚ะตะบั‚ัƒั€ะฐ Go ะฟั€ะพะตะบั‚ะฐ ะฝะฐ ะฟั€ะฐะบั‚ะธะบะต

You can also access the slides from the video through this link from the video

Layout

Layout schema

โ”œโ”€โ”€ 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

Connect with Us

Stay updated and join our community on Telegram:

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.