Server for Brainflash application, which is a flashcard portal.
This repository was created with clean architecture in mind. Each of the application layers is separated by abstraction.
You need to have installed the following software:
git clone git@github.com:Miczeq22/brainflash-api.git
cd brainflash-api
npm i
cp .env.dist .env
docker-compose up -d
Please remember that .env
must be implemented for proper work.
To run lambdas locally, use:
npx sls offline start
-
build
: Builds production ready application. -
start
: Start production ready environment. Must be preceded by abuild
script. -
docker-build-prod
: Builds production ready docker image for API.
test
: Runjest
in standard mode.test:watch
: Runjest
in watch mode.test:ci
: Runjest
for CI purposes with coverage and database as docker container.
typecheck
: Runtypescript
in dry-mode (no output). Type errors will be printed to console.format
: Runprettier
to format all files. Gets invoked by the pre-commit hook.lint
: Runeslint
andprettier
. Output any errors.
dev
: Run application in development mode by usingnodemon
.version
: GeneratesCHANGELOG
file based on commit messages.
This project follows clean architecture rules. Each of the layers communicates with each other using abstraction and the lower layers know nothing about the upper layers.
We can distinguish four layers in this repository:
-
api
- here a server is prepared to communicate with the outside world using the REST API powered byexpress
. With the lower layer it communicates only using thecommand bus
andquery bus
. -
app
- this layer is responsible for the implementation of commands and queries available in the application. According to the CQRS pattern. -
infrastructure
- layer responsible for concrete implementations of external tools, e.g. persistence layer is implemented using postgresql. -
core
- layer that is responsible for creating and managing domain objects.
- For easier commit type recognition commit messages are prefixed with an emoji
- See available commit-emojis