A real-time chat application built with React frontend and Node.js backend, featuring file uploads, private messaging, and Docker deployment.
- Real-time messaging with Socket.IO
- User authentication (sign up/sign in)
- File upload support (images and documents)
- Private messaging between users
- Online user list
- Responsive UI with Tailwind CSS
- Docker containerization
- React 19
- TypeScript
- Vite
- Tailwind CSS
- Socket.IO Client
- React Router DOM
- Axios
- Node.js
- Express.js
- Socket.IO
- Sequelize (PostgreSQL)
- JWT Authentication
- Multer (file uploads)
- bcrypt
- Docker and Docker Compose
- Node.js 18+ (for local development)
- PostgreSQL (handled by Docker)
-
Set up environment variables
# Copy environment files cp server/.env.example server/.env cp client/.env.example client/.env -
Build and run with Docker Compose
docker-compose up --build
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:5005
-
Navigate to server directory
cd server cp .env.example .env -
Install dependencies
npm install
-
Start PostgreSQL (or use Docker)
docker run --name postgres -e POSTGRES_USER=app -e POSTGRES_PASSWORD=app -e POSTGRES_DB=appdb -p 5432:5432 -d postgres:16-alpine
-
Start the server
npm run dev
-
Navigate to client directory
cd client cp .env.example .env -
Install dependencies
npm install
-
Start the development server
npm run dev
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=app
DB_PASSWORD=app
DB_DATABASE=appdb
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here
# Server Configuration
PORT=5005
CLIENT_URL=http://localhost:3000
# CORS Configuration
CORS_ORIGIN=http://localhost:3000# API Configuration
VITE_API_URL=http://localhost:5005# Build and start all services
docker-compose up --build
# Start services in background
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logs
# Rebuild specific service
docker-compose up --build backendPOST /auth/sign-up- User registrationPOST /auth/sign-in- User loginGET /auth/current-user- Get current user info
GET /messages- Get all public messagesGET /messages/private/:userId- Get private messages with specific userPOST /messages- Send message (supports file uploads)
GET /users- Get users list
The application supports uploading images and documents. Files are stored in the server/uploads/ directory and served via the /uploads endpoint.
- Frontend: React SPA with real-time updates via Socket.IO
- Backend: Express.js API server with Socket.IO for real-time communication
- Database: PostgreSQL with Sequelize ORM
- File Storage: Local file system (can be extended to cloud storage)
- Authentication: JWT tokens stored in cookies
- The application uses TypeScript for better type safety
- Real-time messaging is handled through Socket.IO events
- File uploads are processed via multipart/form-data
- The UI is responsive and uses Tailwind CSS for styling
- Docker setup includes PostgreSQL database and both frontend/backend services