Skip to content

A Fullstack fastify, next js chat app that can accomodate all your friends w/0 crashing. Uses Socket.io, redis, fastify, docker and next js.

Notifications You must be signed in to change notification settings

Ajaydeep123/Chat_anon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Horizontally scaling chat app

App Overview

image

Features

  • Send and receive messages
  • Show current connection count

Technologies

  1. Typescript
  2. Fastify - Backend
  3. Websockets - Realtime
  4. Next.js - Frontend
  5. Tailwind & Shadcn UI - Styling
  6. Redis - Pub/Sub
  7. Caddy - Load Balancer
  8. Docker/docker-compose - Containerization
  9. GitHub actions - CI/CD
  10. DigitalOcean - Host the backend
  11. Vercel - Host the frontend

Local setup

git clone https://github.com/Ajaydeep123/Chat_anon.git
cd Chat_anon
  • Change the url in the Caddyfile
{
    debug
}

http://127.0.0.1 {
    reverse_proxy chat-app-1:3001 chat-app-2:4000 chat-app-3:5000 {
        header_down Strict-Transport-Security max-age=315360000
    }
}
  • Run the backend server
cd chatapp
pnpm install
vi run.sh  // create a run.sh script and fill the details form example.run.sh file
./run.sh
  • Run the client
cd ..
cd ui
pnpm install
pnpm dev

Summary

The provided code is a Node.js server built with the Fastify web framework, incorporating real-time communication with clients via websockets and using Redis as a message broker.
We are using Caddy as Load Balancer. The reverse_proxy directive in the Caddyfile is being used to distribute incoming requests evenly among the available instances of the chat application. The header_down directive can be used to set the Strict-Transport-Security header for added security.

About

A Fullstack fastify, next js chat app that can accomodate all your friends w/0 crashing. Uses Socket.io, redis, fastify, docker and next js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published