Skip to main content

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.

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 (^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.
The server’s package.json lists the following runtime dependencies:
PackageVersionPurpose
express^5.2.1HTTP 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.4MongoDB 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.3WebSocket 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.3Signs 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.0Password hashing. Hashes plaintext passwords before they are stored in MongoDB and compares submitted passwords against stored hashes during login.
cors^2.8.6Cross-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.2Loads .env variables (PORT, MONGO_URI, JWT_SECRET, CLIENT_URL) into process.env at the very start of server.js before any other module runs.
Dev dependency
PackageVersionPurpose
nodemon^3.1.14Watches the src/ directory during development and automatically restarts the server when a source file changes, invoked via npm run dev.
The entry point is 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.
// server/src/app.js — route mounting
app.use("/api/auth", authRoutes);
app.use("/api/users", userRoutes);
app.use("/api/messages", messageRoutes);
// server/src/server.js — startup sequence
async function startup() {
  await connectDB();
  const server = app.listen(PORT, () => {
    console.log(`[SERVER] Running on port ${PORT}`);
  });
  initializeSocket(server);
}
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.

Build docs developers (and LLMs) love