Implementation of clean architecture based on Uncle Bob's book
Clean Architecture was proposed by Robert Martin (also known as Uncle Bob) in his book "Clean Architecture: A Craftsman's Guide to Software Structure and Design" published in 2017. The goal of Clean Architecture is to create a flexible, extensible and easily maintainable software architecture.
The main idea of Clean Architecture is to divide the program into layers, where each layer has its own responsibility and depends only on the layers below. This makes it easy to change or replace components within each layer without affecting the rest of the system.
Name | Link |
---|---|
Database schema | http://link.com |
Design | http://figma.com |
Technical task | http://docs.google.com |
Clone project from GitHub:
git clone https://github.com/waffle-frame/clean-architecture-template.git
cd clean-architecture-template
Before running or building a project, make sure that all the necessary dependencies are installed on your OS. This will also install the dependencies required by the golong application and install them if necessary.
To find out information about it, you can use the command:
make check-dependencies
Note: To add one or more applications to the list of dependencies, you will need to edit the DEPENDENCIES
variable in the Makefile
Example:
# Project dependencies
DEPENDENCIES = Golang="go version" \
Keycloak="docker exec 1ca7b3a28abb cat /opt/keycloak/version.txt" \
...
In this example I accessed the docker image and got the keycloak version
sudo -u postgres psql -c 'CREATE DATABASE clean_arch;'
An instance of the config file is located along the path. You can supplement it with your own data. Also, in order for you to be able to use the configurations in the application, you need to add an identical structure in config.go file.
If successful, the ImportConfigs
function will return your entry in the content.
Note: If you don't want to populate the config file, you can use the instance using the following command:
cp ref/example-config.json config.json
For the swagger to work properly, you need to replace the {{}}
constructs in the swagger.go file.
The names of the variables speak for themselves, so there is no need to explain the meaning of the variables.
To apply the changes, you need to run the command:
make docs
To run in development mode, use the command:
make run
To build the application, use the command:
make
# or
make build
The assembly contains a dependency check, the generation of a swagger file and the assembly itself The binary file will be located on the path ./build/app
- Implement CI/CD
- Add information to other readme files
- Сreate a project that will have an example of using this blog-based template