GithubHelp home page GithubHelp logo

kelvin-oo / werewolves-assistant-api-next Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antoinezanardi/werewolves-assistant-api-next

0.0 0.0 0.0 28.43 MB

๐Ÿบ Werewolves Assistant API provides over HTTP requests a way of manage Werewolves games to help the game master.

License: MIT License

Shell 0.21% JavaScript 1.69% TypeScript 78.33% CSS 0.01% Dockerfile 0.05% Gherkin 19.71%

werewolves-assistant-api-next's Introduction

logo


TypeScript Nest Mongoose

โš™๏ธ Build Workflow ๐Ÿš€ Deploy To Production Workflow

GitHub release semantic-release: conventional commits GitHub license DependenciesKnown Vulnerabilities

Tests count Scenarios Mutation testing badge

Technical Debt Duplicated Lines (%) Code Smells

๐Ÿ“‹ Table of Contents

  1. ๐Ÿบ What is this API ?
  2. ๐Ÿƒ Available roles
  3. ๐Ÿ”จ Installation
  4. ๐Ÿš€ Build
  5. ๐Ÿณ Docker
  6. ๐Ÿ’ฏ Tests
  7. ๐ŸŒฟ Env variables
  8. โ˜‘๏ธ Code analysis and consistency
  9. ๐Ÿ“ˆ Releases & Changelog
  10. ๐Ÿ™ GitHub Actions
  11. โœจ Misc commands
  12. ยฉ๏ธ License
  13. โค๏ธ Contributors

Werewolves Assistant API provides over HTTP requests a way of manage Werewolves games to help the game master.

This is the next version of the current Werewolves Assistant API. It is still under development.

๐Ÿค” Want to know more about this awesome project ? Check out the dedicated about page.

30 different official roles are available to play :


Werewolf

Big Bad Wolf

Accursed Wolf-Father

White Werewolf

Villager

Villager-Villager

Seer

Cupid

Witch

Hunter

Little Girl

Defender

Elder

Scapegoat

Idiot

Two Sisters

Three Brothers

Fox

Bear Tamer

Stuttering Judge

Rusty Sword Knight

Wild Child

Wolf-Hound

Thief

Angel

Pied Piper

Scandalmonger

Prejudiced Manipulator

Actor

Devoted Servant

To install this project, you will need to have on your machine :

Node PNPM Docker

We recommend to use the node version specified in the .nvmrc file.

If you don't have pnpm installed, you can still use npm for all commands below, but we recommend to use pnpm for faster and more reliable installs.

Then, run the following commands :

# Install dependencies and Husky hooks
pnpm install

# Run the app in dev mode
pnpm run start:dev

The above command will start the app in development mode and watch for changes on local.

You can also run the app in development mode with Docker, more information in the Docker section.

In order to build the app for production, run the following command :

# Build the app
pnpm run build

# Run the app in production mode
pnpm run start:prod

You can also run the app in production mode with Docker, more information in the Docker section.

This app is Docker ready !

The Dockerfile is available at the root of the project.

๐Ÿ”จ Development mode

To run the app in development mode with Docker, multiple commands are available :

# Run the app in development mode with Docker
pnpm run docker:dev:start

# Stop the app in development mode with Docker
pnpm run docker:dev:stop

# Reset the app in development mode with Docker (stop, remove image, containers and volumes, then start)
pnpm run docker:dev:reset

When starting the app in development mode with Docker, a container for the API and a container for the MongoDB database are created.

Docker compose will use the development step of the Dockerfile to build the image.

For more information, please check the docker-compose.yml file.

๐Ÿš€ Production mode

To run the app in production mode with Docker, multiple commands are available :

# Run the app in production mode with Docker
pnpm run docker:production:start

# Stop the app in production mode with Docker
pnpm run docker:production:stop

# Reset the app in production mode with Docker (stop, remove image, containers and volumes, then start)
pnpm run docker:production:reset

When starting the app in production mode with Docker, a container for the API and a container for the MongoDB database are created.

Docker compose will use the production step of the Dockerfile to build the image.

For more information, please check the docker-compose.yml file.

๐Ÿงช Test mode

To run the tests available in this project thanks to Docker, multiple commands are available :

# Deploy test containers (4 databases are created to parallelize tests)
pnpm run docker:test:start

# Stop test containers
pnpm run docker:test:stop

# Reset test containers (stop, remove image, containers and volumes, then start)
pnpm run docker:test:reset

For more information, please check the docker-compose.yml file.

๐Ÿงช Unit and E2E tests

Jest

Tests count

Covered Statements

Covered Branches

Covered Functions

Covered Lines

๐Ÿฅ’ Acceptance tests

Cucumber

Scenarios

Click on the badge below ๐Ÿ‘‡ to see the reports.

ScenariosReports

๐Ÿ‘ฝ Mutant testing

Stryker

Mutation testing badge

You can also check the mutation testing report.

โ–ถ๏ธ Commands

Before testing, you must follow the installation steps.

Then, run one of the following commands :

# Assure you started test Docker containers (4 databases are created to parallelize tests)
pnpm run docker:test:start

# Run unit tests with coverage
pnpm run test:unit:cov

# Run e2e tests with coverage
pnpm run test:e2e:cov

# Run both unit and e2e tests with coverage
pnpm run test:cov

# Run both unit and e2e tests only on staged files (run on pre-commit)
pnpm run test:staged

# Run acceptance tests
pnpm run test:cucumber

# Run acceptance tests and publish the report
pnpm run test:cucumber:publish

# Run mutant tests with coverage
pnpm run test:stryker

# Run mutant tests with coverage from scratch (without using the incremental file)
pnpm run test:stryker:force

Environnement files are available in the env directory.

You can create a .env file in this directory to override the default values when starting the API locally with pnpm run start command.

Environment variables are :

Name Description Required Default value Limitations
HOST Host on which the API will be available โŒ 127.0.0.1 If set, can't be empty string
PORT Port on which the API will be available โŒ 8080 If set, must be a number between 0 and 65535
ENVIRONNEMENT Environment in which the API will run โœ… โŒ Must be development, production or test
DATABASE_HOST MongoDB database host URL โœ… โŒ Can't be empty string
DATABASE_PORT MongoDB database port โŒ undefined If set, must be a number between 0 and 65535
DATABASE_NAME MongoDB database name โœ… โŒ Can't be empty string
DATABASE_USERNAME MongoDB database user โœ… โŒ Can't be empty string
DATABASE_PASSWORD MongoDB database password โœ… โŒ Can't be empty string
CORS_ORIGIN CORS allowed origin โŒ * If set, can't be empty string

๐Ÿ” Code linting & formatting

ESLint

In order to keep the code clean, consistent and free of bad TS practices, more than 300 ESLint rules are activated !

Complete list of all enabled rules is available in the .eslintrc.js file.

โ–ถ๏ธ Commands

Before linting, you must follow the installation steps.

Then, run one of the following commands :

# Lint 
pnpm run lint

# Lint and fix
pnpm run lint:fix

# Lint and fix only on staged files (runs on pre-commit)
pnpm run lint:staged:fix

# Display all configs and rules used in browser using @eslint/config-inspector
pnpm run lint:inspect-config

๐Ÿฅ‡ Project quality scanner

Multiple tools are set up to maintain the best code quality and to prevent vulnerabilities :

CodeQL

You can check the CodeQL analysis report here.

SonarCloud

SonarCloud summary is available here.

Coverage Duplicated Lines (%) Quality Gate Status

Technical Debt Vulnerabilities Code Smells

Reliability Rating Security Rating Bugs

Releases on main branch are generated and published automatically by :

Semantic Release

It uses the conventional commit strategy.

Each change when a new release comes up is listed in the CHANGELOG.md file.

Also, you can keep up with changes by watching releases via the Watch GitHub button at the top of this page.

This project uses GitHub Actions to automate some boring tasks.

You can find all the workflows in the .github/workflows directory.

๐ŸŽข Workflows

Name Description & Status Triggered on
โš™๏ธ Build Various checks for app health, code quality and tests coverage

โš™๏ธ Build Workflow
push on develop and all pull requests to develop
๐Ÿ”ƒ Lint PR Name Into Develop Workflow Checks if pull request name respects conventionnal-commit rules

๐Ÿ”ƒ Lint PR Name Into Develop Workflow
pull-request created or updated
โ›ต๏ธ Push On Develop Branch Workflow Uploads app with develop version to Docker Hub

โ›ต๏ธ Push On Develop Branch Workflow
push on develop
๐Ÿ”ƒ๏ธ Upsert PR Release Workflow Creates or updates pull request to main depending on commits on develop since last release

๐Ÿ”ƒ๏ธ Upsert PR Release Workflow
push on develop
๐Ÿท๏ธ Release Creation Workflow Creates a new release using semantic-release with tag and updated changelog

๐Ÿท๏ธ Release Creation Workflow
push on main
๐Ÿš€ Deploy To Production Workflow Deploys app with last tag version to Docker Hub and GCP

๐Ÿš€ Deploy To Production Workflow
tag-creation

๐ŸŒณ Animated tree visualisation of the project's evolution with Gource

# Please ensure that `gource` is installed on your system.
pnpm run gource

๐Ÿ”€ Create git branch with a conventional name

pnpm run script:create-branch

โคด๏ธ Create pull request against the develop branch from current branch

pnpm run script:create-pull-request

๐Ÿ“ฃ To all IntelliJ IDEs users (IntelliJ, Webstorm, PHPStorm, etc.)

All the above commands are available in the .run directory at the root of the project.

You can add them as run configurations in your IDE.

This project is licensed under the MIT License.

There is no contributor yet. Want to be the first ?

If you want to contribute to this project, please read the contribution guide.

werewolves-assistant-api-next's People

Contributors

dependabot[bot] avatar antoinezanardi avatar semantic-release-bot avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.