This repository provides a structured template for creating Golang projects, adhering to the "clean architecture" paradigm.
-
api/v1: Contains API specifications for the first version of your service, including Swagger files.
-
cmd/appname: The entry point of your application. Here is the main function to start your service.
-
config: A place for configuration files and code that loads them.
-
db: Contains everything related to the database: migration files and code for working with the database.
-
Docker: Files for creating a Docker image of your application.
-
internal: Code that is specific to this application and is not intended for external use.
- middleware: Middleware handlers for your web server.
- models: Data models and business logic.
- utils: Helper functions and utilities.
-
pkg: Code that can be reused in other projects (common libraries and utilities).
-
server: Code for setting up and running your web server.
-
tests: Tests for your application, divided into integration and unit tests.
- Clone this repository.
- Update the configuration files in the
config
folder according to your requirements. - Add your database migrations to the
db/migrations
folder. - Implement your business logic in the
internal
folder. - Start your application from the
cmd/appname
folder.
- Build your Docker image using
Docker/dockerfile
. - Use
Docker/docker-compose.yaml
to run your application in a container.
If you have suggestions or improvements for this template, feel free to create issues or pull requests.