TalkBox is a full-stack JavaScript application. The server runs on Node.js and leans on a small, focused set of battle-tested libraries; the client is a React single-page application built and served by Vite. Both sides share the same Socket.IO major version (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/abdelhafid37/talkbox/llms.txt
Use this file to discover all available pages before exploring further.
^4.8.3) so the client and server transports are always compatible. The sections below walk through each dependency, drawn directly from the project’s package.json files.
- Backend
- Frontend
The server’s
Dev dependency
The entry point is
package.json lists the following runtime dependencies:| Package | Version | Purpose |
|---|---|---|
express | ^5.2.1 | HTTP server framework. Mounts the three route groups (/api/auth, /api/users, /api/messages) and the root health-check endpoint. Express 5 is used here for its improved async error handling. |
mongoose | ^9.7.4 | MongoDB ODM. Defines the User and Message schemas, handles connection lifecycle via connectDB, and provides the populate helper used when resolving sender/receiver usernames on messages. |
socket.io | ^4.8.3 | WebSocket server. Attached to the same Node.js http.Server instance as Express. Manages the onlineUsers presence Map and delivers the newMessage event to connected clients in real time. |
jsonwebtoken | ^9.0.3 | Signs and verifies JWTs. Used in the auth controller to issue tokens on login and in authMiddleware (REST) and the Socket.IO middleware to validate them on every protected request. |
bcrypt | ^6.0.0 | Password hashing. Hashes plaintext passwords before they are stored in MongoDB and compares submitted passwords against stored hashes during login. |
cors | ^2.8.6 | Cross-Origin Resource Sharing middleware. Configured with origin: process.env.CLIENT_URL so only the known React client origin can make cross-origin requests to the API. |
dotenv | ^17.4.2 | Loads .env variables (PORT, MONGO_URI, JWT_SECRET, CLIENT_URL) into process.env at the very start of server.js before any other module runs. |
| Package | Version | Purpose |
|---|---|---|
nodemon | ^3.1.14 | Watches the src/ directory during development and automatically restarts the server when a source file changes, invoked via npm run dev. |
src/server.js, which loads environment variables, opens the MongoDB connection, starts the Express listener, and then calls initializeSocket(server) to attach Socket.IO — all in a single async startup() function.Both
socket.io (server) and socket.io-client (client) are pinned to ^4.8.3. Keeping these in sync is important — mismatched major versions can cause silent handshake failures or missing event support.