A real-time text messaging web application built with Node.js, Express, Socket.io, and SQLite for session storage and chat history persistence.
- Public chat room visible to all users
- Private messaging between users
- Real-time typing indicators
- Online users list
- Persistent sessions using SQLite session store
- Chat history saved in memory (can be extended to DB)
- Responsive and simple frontend UI
- Backend: Node.js, Express, Socket.io, express-session, connect-sqlite3, SQLite
- Frontend: HTML, CSS, JavaScript (Socket.io client)
- Deployment: Deployed on Render.com (or any Node.js hosting)
- Node.js (v14 or later recommended)
- npm (comes with Node.js)
- Git (for cloning repository)
- Clone the repository
git clone https://github.com/HSA-ATTOCK/chat-app.git
cd chat-app- Install dependencies
npm install- Run the application locally
npm start- Open your browser and navigate to
http://localhost:5000
chat-app/
├── public/ # Frontend files (HTML, CSS, JS)
│ ├── index.html
│ ├── script.js
│ └── style.css
├── server.js # Node.js backend server
├── package.json # Project manifest
└── README.md # This documentation file
- The backend server manages WebSocket connections with Socket.io.
- Users connect and can set their username.
- Users can send messages publicly or privately.
- Chat messages and typing indicators are broadcasted in real-time.
- Session middleware persists usernames across reconnects.
- Chat history is stored in-memory for public and private chats.
-
Push your project to GitHub.
-
Create a new Web Service on Render.com.
-
Connect your GitHub repository.
-
Set the following in Render’s deployment settings:
- Build Command:
npm install - Start Command:
node server.js
- Build Command:
-
Deploy and access your app at the provided Render URL.
- The server listens on port specified by environment variable
PORTor defaults to 5000. - Sessions use SQLite store to persist user sessions (
connect-sqlite3).
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
Created by HSA-ATTOCK.
Feel free to reach out for any questions or collaboration.