Skip to content

diegoclair/go_boilerplate

Repository files navigation

GO BOILERPLATE

This is a boilerplate that you can use for your go projects :)

Coverage Status last-commit build status Go Report

Developed with the software and tools below.

Description

This project is a boilerplate for creating API projects in Go, incorporating key principles of Domain-Driven Design and Clean Architecture. It reflects my expertise in Golang, drawn from previous projects, and is structured to facilitate maintainability and scalability.

All layers of the codebase are tested to ensure reliability and robustness. The project is open to contributions and improvements. Feel free to fork the repository, submit pull requests, or open issues to discuss enhancements or report bugs.

Project architecture:

For the presentation layer, which I refer to as the transport layer, its purpose is to handle data transportation. It is responsible for receiving and responding to various types of requests, including API calls, gRPC, and messaging via RMQ, among others.

Tests:

For unit tests with MySQL and Redis, we are using real dependencies with testcontainers. It’s like putting our functions through a real-world.
And we are also using mocks to test the errors scenarios, this way we can achieve 100% of cover. 💪

💻 Getting Started

Prerequisites ❗

  • Ensure Docker is installed on your machine.
  • An installation of Go 1.21.0 or later. For installation instructions, see Installing Go.

▶️ Launching the Application

To start the application, execute the command:

docker-compose up

Once you see the message your server started on [::]:5000, the application is up and running!

📝 API Documentation:

For detailed API endpoint documentation, navigate to the /docs directory where you will find the Swagger documentation.
These swagger docs was generated using goswag

Running tests

make tests

Generating docs

make docs

Contributing

Contributions are welcome! Here are several ways you can contribute:

  • Submit Pull Requests: Review open PRs, and submit your own PRs.
  • Join the Discussions: Share your insights, provide feedback, or ask questions.
  • Report Issues: Submit bugs found or log feature requests for Go_boilerplate.
Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a Git client.
    git clone https://github.com/<your_username>/go_boilerplate
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.


License

This project is protected under the MIT License License. For more details, refer to the LICENSE file.


:bowtie: