PollChat is a real-time chat application that allows users to send messages, upvote them, and prioritize chats based on upvotes. The application is built with a Node.js and TypeScript backend using WebSockets, and a React frontend with Tailwind CSS for a sleek and modern user interface.
- Real-Time Messaging: Chat with others in real-time using WebSockets.
- Upvote Messages: Upvote messages to highlight important ones.
- Priority Chats: View messages with the highest upvotes in a dedicated section.
- Room-Based Chats: Join specific chat rooms using a unique Room ID.
- WebSocket Communication: Real-time message broadcasting and upvote handling.
- Room Management: Tracks users and messages in specific rooms.
- In-Memory Store: Efficient message and user management during runtime.
- Cleanup Logic: Handles user disconnections and resource cleanup.
root/
├── backend/ # Backend code
│ ├── src/ # Source files
│ ├── .env # Environment variables
│ ├── package.json # Backend dependencies and scripts
│ └── README.md # Backend documentation
├── frontend/ # Frontend code
│ ├── src/ # Source files
│ ├── .env # Environment variables
│ ├── package.json # Frontend dependencies and scripts
│ └── README.md # Frontend documentation
├── README.md # Main repository documentation
└── LICENSE # License file
- Node.js (v16 or higher)
- npm (v7 or higher)
-
Clone the repository:
git clone https://github.com/bPavan16/pollchat.git cd pollchat -
Install dependencies:
- Backend:
cd backend npm install - Frontend:
cd ../frontend npm install
- Backend:
-
Set up environment variables:
- Backend (.env):
PORT=8080 NODE_ENV=development
- Frontend (.env):
VITE_WEBSOCKET_URL=ws://localhost:8080
- Backend (.env):
-
Run the application:
- Start the backend:
cd backend npm run dev - Start the frontend:
cd ../frontend npm run dev
- Start the backend:
-
Open the application in your browser:
http://localhost:5173
- Push the repository to GitHub.
- Import the frontend directory into Vercel.
- Add the environment variable:
VITE_WEBSOCKET_URL: The WebSocket URL of your backend.
- Deploy the backend to a platform like Vercel, Railway, or Render.
- React: Component-based UI development.
- shadcn/ui: Modern UI components.
- Tailwind CSS: Utility-first CSS framework.
- Vite: Fast development server and build tool.
- Node.js: JavaScript runtime for the backend.
- TypeScript: Type-safe development.
- WebSocket: Real-time communication.
- dotenv: Environment variable management.
A welcoming screen where users can join or create chat rooms.
The main chat interface showing real-time messages and upvotes.
A view highlighting priority messages based on upvotes.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your message here" - Push to the branch:
git push origin feature/your-feature-name
- Open a pull request.
This project is licensed under the MIT License.
For questions or support, please contact:
- GitHub: bPavan16
Made with love by Pavan ❤️
Happy coding! 🚀


