Skip to content
58TinkalPublic

About

A fully functional live chat application with a complete full-stack architecture.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

High‑Level Summary of the Chatt_App Repository

Area Description
Purpose A full‑stack MERN (MongoDB‑Express‑React‑Node) real‑time chat application with user authentication, private and group chats, and live message updates via Socket.io.
Core Features
  • User registration & login with JWT authentication.
  • One‑to‑one and group chat creation.
  • Real‑time messaging (send, receive, read receipts).
  • Chat list, notifications, and profile management.
  • Responsive UI built with Chakra UI.
Tech Stack
  • Backend: Node.js, Express, Mongoose, JWT, Socket.io, bcryptjs.
  • Frontend: React (v17), Chakra UI, Axios, React Router, react‑scrollable‑feed, react‑lottie.
  • Database: MongoDB (via Mongoose ODM).
Repository Layout
├── .gitignore
├── README.md
├── backend
│ ├── config
│ │ ├── db.js # MongoDB connection
│ │ └── generateToken.js # JWT token helper
│ ├── controllers
│ │ ├── chatControllers.js # chat CRUD & group ops
│ │ ├── messageControllers.js# send / fetch messages
│ │ └── userControllers.js # register, login, search users
│ ├── middleware
│ │ ├── authMiddleware.js # JWT protect
│ │ └── errorMiddleware.js # 404 & error handling
│ ├── models
│ │ ├── chatModel.js
│ │ ├── messageModel.js
│ │ └── userModel.js
│ ├── routes
│ │ ├── chatRoutes.js
│ │ ├── messageRoutes.js
│ │ └── userRoutes.js
│ └── server.js # Express entry point
├── frontend
│ ├── .gitignore
│ ├── package.json
│ ├── public # static index.html, icons, manifest
│ ├── src
│ │ ├── App.js & App.css
│ │ ├── index.js (root render)
│ │ ├── Context/ChatProvider.js # global state via React Context
│ │ ├── Pages (Homepage, Chatpage)
│ │ ├── components (Chat UI, auth forms, modals, avatars, loading skeletons)
│ │ ├── config/ChatLogics.js # helper functions for message UI
│ │ └── data/messages.js (sample data)
│ ├── build & dist (generated production bundles)
│ └── package‑lock.json
└── package.json (root, scripts to start server & build frontend)
Key Backend Files • server.js – sets up Express, connects to MongoDB, applies middleware, mounts /api/user, /api/chat, /api/message routes, and initializes Socket.io for real‑time events.
• db.js – async connection helper with console logging.
• generateToken.js – creates JWT valid for 30 days.
• Controllers implement CRUD logic for chats and messages; messageControllers.js uses populate to enrich responses.
Key Frontend Files • App.js – top‑level router (homepage vs. chats).
• ChatProvider.js – stores selected chat, user info, notifications, and chat list in context.
• Homepage – login / signup tabs.
• Chatpage – layout with SideDrawer, MyChats, and Chatbox.
• Chatbox / SingleChat – renders messages using ScrollableChat.
• UI components styled with Chakra UI and custom CSS (styles.css).
Real‑Time Layer Socket.io is instantiated in backend/server.js; client side connects via socket.io-client (imported in relevant components, not shown in the snippet). It handles events like newMessage, typing, stopTyping, and updates chat lists instantly.
Build / Deployment Root package.json defines scripts:
• npm start – runs the backend server.
• npm run server – runs server with nodemon.
• npm run build – installs frontend deps (legacy peer deps), sets OpenSSL legacy flag, and runs React production build. The generated static files reside in frontend/build (or dist).
Environment Variables Expected variables (via .env not included):
• MONGO_URI – MongoDB connection string.
• JWT_SECRET – secret for signing JWTs.
• PORT – optional server port.
Overall Flow 1. User registers / logs in → backend creates a user, hashes password, returns JWT.
2. Frontend stores JWT in localStorage (userInfo).
3. Authenticated requests include Authorization: Bearer <token>; authMiddleware validates and attaches req.user.
4. Chat list (/api/chat) and messages (/api/message/:chatId) are fetched.
5. When a message is sent, the client POSTs to /api/message, the server saves it, updates the chat’s latestMessage, and emits a Socket.io event so other participants receive it instantly.
Potential Extensibility • Add media/file attachments.
• Implement read receipts / typing indicators.
• Deploy with Docker or a cloud service (e.g., Heroku, Render).
• Replace Chakra UI with another design system or customize the theme.

Bottom line: This repository provides a complete, production‑ready starter for a real‑time chat app built on the MERN stack, with a clean separation between backend APIs, real‑time Socket.io handling, and a modern React/Chakra UI front‑end.

About

A fully functional live chat application with a complete full-stack architecture.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages