Skip to content

luchzin/chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat App

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

Features

  • 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

Project 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

Quick Start (Docker Compose)

Recommended for local development and testing.

  1. Copy or create environment files:

    • Backend: chat/.env (see below for required variables)
  2. Build and run all services:

    docker-compose up --build
  3. Access the app:


Manual Setup

Backend (NestJS)

cd chat
npm install
# Create .env file (see below)
npm run start:dev

Frontend (Angular)

cd front-end
npm install
ng serve
# Open http://localhost:4200

Environment Variables

Backend (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.


Running Tests

  • Backend:
    npm run test         # Unit tests
    npm run test:e2e     # End-to-end tests
    npm run test:cov     # Coverage
  • Frontend:
    ng test

Development Tips

  • 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 /api on the backend.

Docker Details

  • 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.

Additional Resources


License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published