Skip to content

Fur-Fight-Club/ffc-main-service

Repository files navigation

ffc-logoFury Fight Club

mistergooddeal-pp

Milan CAMUS

@MisterGoodDeal

norudah-pp

Romain Pierucci

@Norudah

samizerrai-pp

Sami Zerrai

@SamiZerrai

SylvainBoudacher-pp

Sylvain Boudacher

@SylvainBoudacher

 

ffc-main-service is the main service, the entry point of the Fury Fight Club project. It is a REST API that acts like a proxy for the mobile app and the NextJS app. It's role is to communicate with each services and do some business logic such as CRUD operations on Arenas, Matches, Monsters and Tournaments.

This service is communicating with other services using HTTP requests and with another layer of security consisting in authenticating each services with a JWT token. It's implementing a strongly typed API in TypeScript allowing us to keep a consistent typing across each services. This API can be found under this folder.

The main service is working with three main "components":

nestjs-logo imgur-logo prisma-logo

NestJS

NestJS is the core of this project. It allow us to create the REST API

Imgur API

The Imgur API allow us to delegate everything related to any images

prisma-package

This is a custom npm package including our TypeScript database model

 

🏃‍♂️ Start the service

First things first, make sure you're running at least Node 18 and that you've installed all the dependencies with npm install.

There is two ways to run the project. This first one is to use Docker, but It's not recommended since the docker is meant to be used with the Kubernetes cluster (running production version of the NestJS service). But if you want to do it like that, feel free to run the following command:

docker-compose up -d
Now if you want to run it and get the auto-refresh and all that kind of stuff, you can run the following command:
 
 
The project will start under the port 4000 and will be available at the following URL: http://localhost:4000
 

📝 API documentation

The project is implementing the @nestjs/swagger library. This library allow use to generate a Swagger page for each routes and document them properly.

You can access this documentation at the following URL: http://localhost:4000/swagger

🕸️ K8S deployment

As we said earlier, this project is meant to be deployed on a Kubernetes cluster. You can either run it locally using an instance of minikube or you can deploy it on a cloud cluster like Google Cloud Provider.

There is a few prerequisites if you want to deploy it to a K8S cluster:

  • Install kubectl with brew install kubectl
  • Install Gcloud SDK with brew cask install google-cloud-sdk (optional)
  • Install k9s with brew install k9s (optional)

 

Then you can deploy the app using the deployement files provided in the k8s/ folder by running the following commands:

# Deploy the app
kubectl apply -f k8s/deployment.yaml

# Expose the service
kubectl apply -f k8s/service.yaml

The app can be automatically deployed to a Google Kubernetes Engine using GitHub Actions that you can found in the folder .github/workflows.

The app is built when a new tag is created on the main branch. A Docker image is built inside the action and pushed to the Docker Hub repository. The image can be found here.

 

🧪 Tests

The project has been tested along every projects using Jest (except ffc-mobile-app and ffc-web-app). There is an average of 75% of coverage for every projects.

The app is tested on each commits in order to insure a proper code delivery.

But you can run tests locally by using the following command:

npm run test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages