This is a boilerplate that you can use for your go projects :)
Developed with the software and tools below.
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.
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.
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. 💪
- Ensure Docker is installed on your machine.
- An installation of Go 1.21.0 or later. For installation instructions, see Installing Go.
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!
For detailed API endpoint documentation, navigate to the /docs
directory where you will find the Swagger documentation.
These swagger docs was generated using goswag
make tests
make docs
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
- Fork the Repository: Start by forking the project repository to your GitHub account.
- Clone Locally: Clone the forked repository to your local machine using a Git client.
git clone https://github.com/<your_username>/go_boilerplate
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to GitHub: Push the changes to your forked repository.
git push origin new-feature-x
- 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.
This project is protected under the MIT License License. For more details, refer to the LICENSE file.