This guide walks you through every step needed to run TalkBox on your local machine — from cloning the repository to opening a conversation between two browser tabs. The server starts on portDocumentation 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.
3000 and the Vite dev server on port 5173; both are pre-configured in the provided .env.example files so you need only supply a MongoDB connection string and a JWT secret to be up and running.
Prerequisites
Make sure you have the following before you start:
- Node.js 18 or later — nodejs.org
- npm (bundled with Node.js)
- MongoDB instance — a locally running MongoDB daemon, or a free MongoDB Atlas cluster URI
Setup Steps
Clone the repository
Clone TalkBox from GitHub and move into the project root.The repository contains two independent packages —
server/ and client/ — each with their own package.json and .env.example. You will configure and start them separately.Configure the server environment
Copy the example environment file and fill in the required values.Open
.env in your editor and set each variable:| Variable | Description |
|---|---|
PORT | The port the Express server listens on. Defaults to 3000. |
MONGO_URI | Full MongoDB connection string. Can be a local URI such as mongodb://localhost:27017/talkbox or an Atlas connection string. |
JWT_SECRET | A long, random string used to sign and verify JSON Web Tokens. Use at least 32 characters in production. |
CLIENT_URL | The origin of the React app. Used by Express CORS and Socket.IO CORS to allow cross-origin requests. Keep http://localhost:5173 for local development. |
Start the server
Install dependencies and start the server with The startup sequence connects to MongoDB first, then begins listening on the configured port, and finally attaches the Socket.IO server:If you see
nodemon for live reloading.[DATABASE] Failed to connect to MongoDB, verify your MONGO_URI is correct and that your Atlas cluster IP allowlist includes your current IP address.Configure the client environment
Open a new terminal, navigate to the The default values in
client/ directory, and copy its environment file..env.example already point to the local server, so no changes are needed for local development:| Variable | Description |
|---|---|
VITE_API_URL | Base URL for all Axios REST requests and the Socket.IO connection. Must match the server’s address and port. |
Vite only exposes environment variables prefixed with
VITE_ to client-side code. Any variable without this prefix is ignored at build time.Start the client
Install dependencies and launch the Vite development server.Vite will print the local URL once the build is ready:Open http://localhost:5173 in your browser. You will be redirected to the login page because no session exists yet.
Register two accounts and start chatting
To test real-time messaging you need two separate sessions.
- In your first browser tab, navigate to Register, create an account (e.g.
alice), and log in. - Open a second browser tab (or a private/incognito window), navigate to Register, create a second account (e.g.
bob), and log in. - In Alice’s tab, find Bob in the user list on the left sidebar and click his name to open a conversation.
- Type a message and press Send. Bob’s tab will receive the message instantly via the
newMessageSocket.IO event — no refresh needed. - Switch to Bob’s tab and reply. You will see both sides of the conversation update in real time.
Using MongoDB Atlas (Recommended for Cloud)
Verifying a Healthy Startup
When both processes are running correctly, your two terminals should look like this: Server terminaljoin event, you will also see:
VITE_API_URL), Axios requests will fail with a network error and the Socket.IO connection will not establish. Confirm both values point to http://localhost:3000 and that the server process is still running.