How manpreetsingh-345/chat-app works
Chatlify is a React/Vite chat application with an Express/TypeScript backend providing registration, token-based authentication, MongoDB persistence, and a basic Socket.IO connection handler. The user-facing path spans landing, signup or login, and a dashboard whose sampled implementation contains local conversation UI and refreshes credentials through the API. Backend routes dispatch authentication and user requests to controllers and services. The README documents Socket.IO message events, but the sampled dashboard does not show a socket client; that connection is therefore shown as unverified. Some frontend routing/auth wiring is present but not fully connected in the sampled route configuration.
Main entry points: AppRoutes.tsx Page routing · app.ts HTTP server · Dashboard.tsx Chat dashboard · api.ts API client
Components 25
Frontend experience
- Page routing
frontend/app/AppRoutes.tsx - Landing page
frontend/app/pages/Home.tsx - Shared layout
frontend/app/components/HomeLayout.tsx - Navigation
frontend/app/components/Navbar.tsx - Login page
frontend/app/pages/Login.tsx - Signup page
frontend/app/pages/Signup.tsx - Chat dashboard
frontend/app/pages/Dashboard.tsx - Mobile dashboard
frontend/app/pages/MobileDashboard.tsx - Auth state
frontend/app/hooks/useAuth.tsx - API client
frontend/app/api/api.ts
Backend API
- HTTP server
backend/src/app.ts - Auth routes
backend/src/routes/authRoute.ts - User routes
backend/src/routes/userRoute.ts - Auth controller
backend/src/controllers/authController.ts - User controller
backend/src/controllers/userController.ts - Token verification
backend/src/middleware/verifyAuthUser.ts
Identity and storage
- User service
backend/src/services/userService.ts - Token service
backend/src/services/tokenService.ts - User records
backend/src/models/User.ts - Refresh tokens
backend/src/models/RefreshToken.ts - MongoDB setup
backend/src/db/db.ts
Realtime messaging
- Socket handler
backend/src/utils/handleSocketConnection.ts
Other components
- User
- Socket clients
- MongoDB
Connections 28
- User → Page routing: uses pages
frontend/app/AppRoutes.tsx - Page routing → Shared layout: renders layout
frontend/app/AppRoutes.tsx - Page routing → Landing page: routes to
frontend/app/AppRoutes.tsx - Page routing → Login page: routes to
frontend/app/AppRoutes.tsx - Page routing → Signup page: routes to
frontend/app/AppRoutes.tsx - Page routing → Chat dashboard: routes to
frontend/app/AppRoutes.tsx - Shared layout → Navigation: renders
frontend/app/components/HomeLayout.tsx - Login page → API client: calls API
frontend/app/pages/Login.tsx - Signup page → API client: calls API
frontend/app/pages/Signup.tsx - Chat dashboard → API client: calls API
frontend/app/pages/Dashboard.tsx - Chat dashboard → Auth state: reads auth
frontend/app/pages/Dashboard.tsx - Mobile dashboard → Chat dashboard: renders
frontend/app/pages/MobileDashboard.tsx - API client → HTTP server: sends requests
README.md - HTTP server → Auth routes: mounts routes
backend/src/app.ts - HTTP server → User routes: mounts routes
backend/src/app.ts - Auth routes → Auth controller: dispatches to
backend/src/routes/authRoute.ts - Auth routes → Token verification: protects route
backend/src/routes/authRoute.ts - User routes → User controller: dispatches to
backend/src/routes/userRoute.ts - User routes → Token verification: protects route
backend/src/routes/userRoute.ts - Auth controller → User service: finds users
backend/src/controllers/authController.ts - Auth controller → Token service: manages tokens
backend/src/controllers/authController.ts - User controller → User service: persists users
backend/src/controllers/userController.ts - User service → User records: reads and saves
backend/src/services/userService.ts - Token service → Refresh tokens: persists tokens
backend/src/services/tokenService.ts - HTTP server → MongoDB setup: initializes
backend/server.ts - MongoDB setup → MongoDB: connects to
README.md - HTTP server → Socket handler: initializes
backend/server.ts - Socket clients → Socket handler: emits messages
README.md