This is a Realtime Chat Application built with a NestJS backend and a React + TypeScript frontend. It uses WebSockets for real-time communication and is containerized with Docker for easy deployment.
-
Backend:
-
Frontend:
-
DevOps:
- Dockerized backend and frontend for consistent environments.
- CI/CD pipeline using GitHub Actions for automated testing, building, and deployment.
- Production-ready
docker-composefor easy multi-service orchestration.
.
├── backend/ # NestJS backend
│ ├── src/ # Source code
│ ├── test/ # Unit and E2E tests
│ ├── Dockerfile # Production Dockerfile
│ ├── Dockerfile.dev # Development Dockerfile
│ └── package.json # Backend dependencies and scripts
├── frontend/ # React + Vite frontend
│ ├── src/ # Source code
│ ├── public/ # Static assets
│ ├── Dockerfile # Production Dockerfile
│ └── package.json # Frontend dependencies and scripts
├── docker-compose.dev.yml # Docker Compose for development
├── docker-compose.prod.yml # Docker Compose for production
└── .github/workflows/ # CI/CD workflows
- Node.js (v20+ recommended)
- Docker and Docker Compose
- Git
-
Clone the repository:
git clone https://github.com/your-username/realtime-chat-application.git cd realtime-chat-application -
Start the development environment using Docker Compose:
docker-compose -f docker-compose.dev.yml up --watch
-
Access the services:
- Backend API: http://localhost:3000
- Backend WebSocket: http://localhost:3030
- Frontend: http://localhost:5173
This project uses GitHub Actions for CI/CD. The pipeline includes the following steps:
-
Backend CI/CD:
- Install dependencies.
- Run unit and E2E tests.
- Build the Docker image and push it to Docker Hub.
-
Frontend CI/CD:
- Install dependencies.
- Run linting and tests.
- Build the Docker image and push it to Docker Hub.
-
Deployment:
- Pull the latest Docker images from Docker Hub.
- Restart the services using
docker-compose.prod.yml.
The CI/CD workflow is defined in .github/workflows/ci-cd.yml:
To simplify service management, you can use the following commands:
-
Start services:
docker-compose -f docker-compose.prod.yml up -d
-
Stop services:
docker-compose -f docker-compose.prod.yml down
-
View logs:
docker-compose -f docker-compose.prod.yml logs -f
This project is licensed under the MIT License. See the LICENSE file for details.