A chat app build from scatch and utilize with Node.js, Graphql, MongoDB and Redis.
You can also run it with Docker!
Use jest to implement unit test for this project.
✅ Able to One to One send messages
✅ Able to get JWT Token & Check authorization
✅ Support Dockerfile & Docker Compose
✅ Support Unit Test
✅ Full Typescript type checked
You can use volta to intall correct Node.js version. install Volta
# install Volta
curl https://get.volta.sh | bash
# install Node
volta install nodeThen, clone this repository
git clone https://github.com/AmberYen/ChattingApp.git
cd ChattingApp
Edit docker-compose.yml first, mark server section
# Docker Compose for Chatting app
version: '3.7'
services:
mongo:
image: "mongo:3.6"
ports:
- "27017:27017"
volumes:
- mongodata:/data/db
redis:
image: "redis:alpine"
ports:
- "6379:6379"
# server:
# build: .
# image: chatting-app
# environment:
# DB_URL: "mongodb://mongo:27017/chatting-app"
# JWT_AUTH_SALT: amberyan
# REDIS_DOMAIN_NAME: redis
# ports:
# - "3000:3000"
# depends_on:
# - mongo
# - redis
# Storage Volumes (non-volatile)
volumes:
mongodata:
driver: localRun MongoDB and Redis with docker compose
docker-compose upNext, go to server folder and install the project dependencies
cd server
yarnBuild the project for the first time
yarn buildChange .env.example file to .env
mv .env.example .env
vim .env // you can change salt or anything in the .envInsert some seed data
node dist/seeds/seedUsers.jsAnd finally, start the project
yarn devAfter server build process completed, you should see GraphQL API running on http://localhost:3000/graphql
After you modify anything in the server folder, you can build it in the docker image and run it with docker compose.
Unmark docker-compose.yml
# Docker Compose for Chatting app
version: '3.7'
services:
mongo:
image: "mongo:3.6"
ports:
- "27017:27017"
volumes:
- mongodata:/data/db
redis:
image: "redis:alpine"
ports:
- "6379:6379"
server:
build: .
image: chatting-app
environment:
DB_URL: "mongodb://mongo:27017/chatting-app"
JWT_AUTH_SALT: amberyan
REDIS_DOMAIN_NAME: redis
ports:
- "3000:3000"
depends_on:
- mongo
- redis
# Storage Volumes (non-volatile)
volumes:
mongodata:
driver: localBuild image
docker-compose buildRun server with docker command
docker-compose upAfter docker run process completed, you should see GraphQL API running on http://localhost:3000/graphql
You can run unit test for this project
cd server
yarn test- Build Frontend page for real chatting
- Build Session service
- Build Graphql API gateway (connect to session service and multiple users with different gateway)
- Implement Send/Delivered/Read status
- Implement user online status
- Cache user online status via Apollo CacheControl
© 2022 Amber Yen, all rights reserved.

