Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Latest commit

 

History

History

backend

Backend

The backend service is the backend for Fortify's website and is a GraphQL API. The GraphQL API is built on top of Apollo and has a (dynamically mapped GraphQL to) REST API for third parties (based on Sofa API).

It's main purpose is dealing with authentication, authorization, access control rules, handling communication with databases and forwarding Pub/Sub messages.

Production Endpoints

Setup

Nodejs installation

The backend is written in TypeScript, which requires a local Node.js development environment.

To install the latest version of Node.js head over to their website, download and install the corresponding version for your operating system.

Environment variables

In order to prevent environment variables containing potential dev secrets or tokens from leaking, a dot env file is used for local development.

Copy the .env.example file in place and rename the newly created file to .env

Next fill in missing values and save the file.

Installing dependencies

Installing all necessary dependencies can be done using:

npm install

Development

To start the service in development mode, please run:

npm run dev

Local development endpoints:

The service's sources are located in the ./src folder.

The backend heavily relies on code generation by graphql-codegen. This enables one to write the GraphQL schema in DSL generate the Apollo ResolverTypes, resulting in strictly typed resolvers and function invocations.

To invoke the resolver type code generation, run:

npm run types

As most of this project has been developed using VS Code, I'm recommending to use VS Code with Fortify's recommended extensions and opening each service in an individual VS Code window.

Before committing

Before committing changes make sure that your code:

  • Can successfully compile using:

    npm run compile
  • Has no linting errors using:

    npm run check
  • The package.json version has been increased according to SemVer.