Skip to content

teamfacade/sigmate-backend

Repository files navigation

Sigmate Backend

Server side code for sigmate services.

Prerequisites

MySQL Server

macOS (Homebrew)

brew install mysql
mysql_secure_installation
mysql.server start

Windows

Download MySQL server (community edition)

Requirements

Install Node packages

npm install

Generate key pairs for token signing

# Generate the keys
git clone https://github.com/teamfacade/sigmate-security.git
cd sigmate-security
cd jwt-secret
./gen-jwt-secret.sh

# Replace $SIGMATE_BACKEND_PATH with the actual path to the sigmate-backend repo
# Move the keys to the correct location
mkdir $SIGMATE_BACKEND_PATH/keys
mv *.pem $SIGMATE_BACKEND_PATH/keys/

Set the environment variables

NODE_ENV=
PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
DB_HOST=
DB_PORT=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
PATH_PUBLIC_KEY=keys/cert.pem
PATH_PRIVATE_KEY=keys/private-key.pem

Create database

Create a database as with the same name as the environment variable DB_DATABASE. Replace DB_DATABASE with the actual database name.

CREATE DATABASE `DB_DATABASE`;

Running

Development Build (Slower)

Uses ts-node and nodemon to compile Typescript in just-in-time, and automatically re-build and restart the server on code change.

npm run dev

Production Build (Faster)

Compile the entire Typescript code base into JavaScript before running the server. Longer build times are expected, but the server is more responsive.

npm run build
npm run start

About

Sigmate server-side code repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published