Miczeq22 / brainflash-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brainflash API

Production Build Lint Check Test


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.

πŸ“– Table of Contents

✨ Getting started

Prerequisites

You need to have installed the following software:

Bootstrap

  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

πŸ“œ Scripts

Build

  • build: Builds production ready application.

  • start: Start production ready environment. Must be preceded by a build script.

  • docker-build-prod: Builds production ready docker image for API.

Test

  • test: Run jest in standard mode.
  • test:watch: Run jest in watch mode.
  • test:ci: Run jest for CI purposes with coverage and database as docker container.

Analyze

  • typecheck: Run typescript in dry-mode (no output). Type errors will be printed to console.
  • format: Run prettier to format all files. Gets invoked by the pre-commit hook.
  • lint: Run eslint and prettier. Output any errors.

Development

  • dev: Run application in development mode by using nodemon.
  • version: Generates CHANGELOG file based on commit messages.

πŸ“ Rules

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.

Clean architecture

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 by express. With the lower layer it communicates only using the command bus and query 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.

πŸ“š Documentation

Commit Message Guideline

  • For easier commit type recognition commit messages are prefixed with an emoji
  • See available commit-emojis

About

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:TypeScript 98.9%Language:JavaScript 0.9%Language:Dockerfile 0.1%Language:Handlebars 0.1%