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 -dPlease 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 abuildscript. -
docker-build-prod: Builds production ready docker image for API.
test: Runjestin standard mode.test:watch: Runjestin watch mode.test:ci: Runjestfor CI purposes with coverage and database as docker container.
typecheck: Runtypescriptin dry-mode (no output). Type errors will be printed to console.format: Runprettierto format all files. Gets invoked by the pre-commit hook.lint: Runeslintandprettier. Output any errors.
dev: Run application in development mode by usingnodemon.version: GeneratesCHANGELOGfile 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 busandquery 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