The project is build using docker, with different configuration for development and production and environment. Language used is TypeScipt (config and lint file is include). I am usingGraphQL-yoga
which is build on top ofApollo
,Express
server.Redis
is used along withexpress-session
for maintain session. Project also consist ofwinston logger
which logs all the errors to error.log file andSentry
library if you wish to track errors on sentryFor persistance, I useMySQL
along withPrisma ORM
which can automatically apply migrations and has nice Django-Admin like UI for adding and dropping data.
Development
- Install Docker Cli and Docker Compose
- Clone the repo and create a
.env
file with following info- SECRET_KEY(Used by Redis)
- NODE_ENV
- HOST
- PORT
- SESSION_NAME
docker-compose -f "docker-compose.dev.yml" -f "docker-compose.yml" up -d --build
- This will build images for Node, MySQL, Redis and Express Server and will run those images in seperate containers.
- Open shell for MySQL container using
docker exec -it {continer_id or name} /bin/sh -c "[ -e /bin/bash ] && /bin/bash || /bin/sh"
and create database. "docker-compose.dev.yml"
run the express server usingnodemon
and mounts the local volume, therfore any edit made in project folder, will triggernodemon
to rebuild the server and therefore enabling development while in docker.
Production
- For deploying the project use
docker-compose.prod.yml
file instead of"docker-compose.dev.yml"
. It creates and run image of NGINX(used as reverse proxy) and Certbot(used for ssl certificate for domains) - You will still need to create databse inside docker, when running this for first time.
WIP