Skip to content

mandarine-io/Backend

Repository files navigation

Mandarine (Backend)

Technologies

Getting started

Here you describe how to run project locally

Prerequisites

To launch a project, you need:

Cloning

Сlone this project:

git clone https://github.com/mandarine-io/Backend

Configuration

YAML file

YAML configuration file contains all base application settings. Use the config/config.example.yaml as reference to create your configuration file:

cp config/config.example.yaml config/config.yaml
nano config/config.yaml

Environment variables

To overwrite some properties from YAML file, you can use environment variables. Use the config/.env.example as reference to create your env file .env:

cp config/.env.example .env
nano .env

Launch

To start server, you can run Makefile command:

make start

or you can run manually to use custom YAML config file and environment variables file:

go mod tidy
go build -o build/server cmd/api
MANDARINE_CONFIG_FILE=config/config.yaml ./build/server

Development

To start server with hot reload (development mode), you can run Makefile command:

make start.dev

Formatting

To format code, you can run Makefile command:

make format

With fixing found issues:

make format.fix

Linting

All linters and its settings describes file golangcli.yaml. To run linters, you can execute Makefile command:

make lint

With fixing found issues:

make lint.fix

Testing

The system is covered with various types of tests.

Unit tests

Created unit tests for services, various custom managers and clients, and util functions:

make test.unit

After finishing, you can see the results in the logs/unit-test folder (logs and coverage reports).

E2E tests

The main business scenarios are covered with e2e tests, and for them a test environment is deployed in Docker containers:

make test.e2e

After finishing, you can see the results in the logs/e2e-test folder (logs and coverage reports).

Load tests

To test the system under load and identify bottlenecks, load tests are written:

make test.load LOAD_TEST_NAME=<test-file-name>

After finishing, you can see the results in the logs/load-test folder (logs and performance reports).

License

This project is licensed under the Apache 2.0 License.