A full-stack chat application with real-time messaging, authentication (including Google), file uploads, group chat, and more.
- Backend: NestJS (Node.js, TypeScript)
- Frontend: Angular
- Database: MongoDB (local, via Docker)
- Containerized: Docker & Docker Compose
- User Authentication: Email/password, Google OAuth
- Real-time Chat: WebSocket-based messaging (Socket.IO)
- Group & Private Chat: Create groups, manage friends, direct messages
- File Uploads: Send images, files, and media in chat
- Notifications: In-app notifications for new messages, friend requests, etc.
- Media Support: Audio, video, and image messages
- Password Reset: Email-based password reset flow
- Responsive UI: Modern Angular frontend
- Admin/Moderator Tools: (if enabled in backend)
- Extensible: Modular backend and frontend structure
chat-app/
chat/ # Backend (NestJS)
src/
auth/ # Authentication logic (controllers, services, DTOs)
chat/ # Chat gateway, services, DTOs
friendship/ # Friend management
group/ # Group chat logic
db/ # Database schemas and services
upload/ # File upload endpoints
utils/ # Utilities, decorators, filters
guard/ # Auth and rate-limiting guards
main.ts # App entry point
public/ # Static files
templates/ # Email templates (e.g., password reset)
...
front-end/ # Frontend (Angular)
src/
app/
components/ # UI components (auth, chat, home, etc.)
service/ # Angular services (API, auth, chat, etc.)
store/ # NgRx state management
reducers/ # State reducers
theme/ # Theme and styling
types/ # TypeScript types
...
assets/ # Images, icons, videos
environments/ # Environment configs
...
Docker-compose.yml # Multi-service orchestration
Readme.md # This file
Recommended for local development and testing.
-
Copy or create environment files:
- Backend:
chat/.env(see below for required variables)
- Backend:
-
Build and run all services:
docker-compose up --build
-
Access the app:
- Frontend: http://localhost:4200
- Backend API: http://localhost:3000
- MongoDB: localhost:27017 (for local tools)
cd chat
npm install
# Create .env file (see below)
npm run start:devcd front-end
npm install
ng serve
# Open http://localhost:4200Backend (chat/.env):
NODE_ENV='dev'
ACCESS_TOKEN=''
REFRESH_TOKEN=''
ACCESS_TOKEN_EXPIRE_TIME='7d'
REFRESH_TOKEN_EXPIRE_TIME='14d'
RESET_PASS_TOKEN=''
RESET_PASS_TOKEN_EXPIRED='360s'
GOOGLE_CLIENT_ID=''
GOOGLE_SECRET=''
FACEBOOK_CLIENT_ID=''
FACEBOOK_SECRET=''
DB_URL="mongodb://mongo:27017/test"
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USER=''
MAIL_PASS=''
MAIL_FROM="My App support@myapp.com"
FRONTEND_URL='http://localhost:4200/'
Adjust as needed for your environment.
Frontend:
API endpoints are configured in front-end/src/environments/environment.ts.
- Backend:
npm run test # Unit tests npm run test:e2e # End-to-end tests npm run test:cov # Coverage
- Frontend:
ng test
- Generate Angular components/services:
ng generate component my-component ng generate service my-service
- Backend hot-reload: Use
npm run start:dev - API Docs: If enabled, Swagger UI is usually at
/apion the backend.
- MongoDB runs as a local service, data persisted in a Docker volume.
- Backend connects to MongoDB using the internal Docker network.
- Frontend is served on port 4200 (using Angular CLI's dev server).
- All services are networked together for easy communication.
MIT