A full-stack web application for hobby enthusiasts to connect, participate in events, engage in real-time chatrooms, and share learning resources.
- Frontend: React + Vite + Tailwind CSS
- Backend: Node.js + Express
- Database: MongoDB (Mongoose)
- Realtime: Socket.io
- Authentication: JWT (httpOnly cookies)
- β JWT-based authentication (Sign up, Login, Logout)
- β Hobby selection after signup
- β Personal dashboard with profile and events
- β Real-time chatrooms for each hobby
- β Event hosting and joining
- β Resource sharing system
- β Responsive design (mobile-first)
- Node.js (v16 or higher)
- MongoDB (local or MongoDB Atlas)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd Hobbyhub
-
Install dependencies
npm run install-all
-
Set Up MongoDB
Quick Start (Recommended): Use MongoDB Atlas (cloud) - see
MONGODB_SETUP.mdfor detailed instructions.Quick Steps:
- Sign up at mongodb.com/cloud/atlas (free tier available)
- Create a cluster, database user, and whitelist your IP
- Get your connection string from the "Connect" button
-
Environment Variables
Create a
.envfile in theserverdirectory:For MongoDB Atlas (Cloud):
MONGO_URI=mongodb+srv://username:password@cluster0.xxxxx.mongodb.net/hobbyhub?retryWrites=true&w=majority JWT_SECRET=your-super-secret-jwt-key-change-this-in-production CLIENT_URL=http://localhost:5173 PORT=5000
For Local MongoDB:
MONGO_URI=mongodb://localhost:27017/hobbyhub JWT_SECRET=your-super-secret-jwt-key-change-this-in-production CLIENT_URL=http://localhost:5173 PORT=5000
π Detailed MongoDB setup instructions: See
MONGODB_SETUP.mdOptionally, create a
.envfile in theclientdirectory for production:VITE_API_URL=http://localhost:5000
-
Start Development Servers
npm run dev
This will start:
- Frontend on
http://localhost:5173 - Backend on
http://localhost:5000
- Frontend on
Hobbyhub/
βββ client/ # React frontend
β βββ src/
β β βββ components/ # Reusable components
β β βββ context/ # React Context (Auth)
β β βββ pages/ # Page components
β β βββ App.jsx # Main app component
β βββ package.json
βββ server/ # Express backend
β βββ config/ # Configuration files
β βββ controllers/ # Route controllers
β βββ models/ # Mongoose models
β βββ routes/ # Express routes
β βββ server.js # Entry point
β βββ package.json
βββ package.json # Root package.json
- User signs up with email and password
- After signup, user is redirected to hobby selection
- User selects their hobbies
- User is redirected to dashboard
- JWT token is stored in httpOnly cookies and localStorage
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user
PUT /api/users/hobbies- Update user hobbies
GET /api/events- Get all events (optional ?hobby= filter)GET /api/events/:id- Get event by IDPOST /api/events- Create new eventPOST /api/events/:id/join- Join an eventPOST /api/events/:id/leave- Leave an event
GET /api/chat/hobbies- Get list of hobbiesGET /api/chat/:hobby- Get messages for a hobby
GET /api/resources- Get all resources (optional ?hobby= filter)GET /api/resources/:id- Get resource by IDPOST /api/resources- Create new resourceDELETE /api/resources/:id- Delete resource
- Create a new Web Service on Render
- Connect your repository
- Set build command:
cd server && npm install - Set start command:
cd server && npm start - Add environment variables:
MONGO_URI- Your MongoDB connection stringJWT_SECRET- A secure random stringCLIENT_URL- Your frontend URL (e.g.,https://hobbyhub-client.onrender.com)PORT-5000(Render will providePORTenv var automatically)NODE_ENV-production
- Create a new Static Site on Render
- Connect your repository
- Set build command:
cd client && npm install && npm run build - Set publish directory:
client/dist - Add environment variable:
VITE_API_URL- Your backend URL (e.g.,https://hobbyhub-server.onrender.com)
- Use MongoDB Atlas (free tier available)
- Get your connection string
- Add it to your backend environment variables
npm run dev- Start both client and server concurrentlynpm run server- Start backend server onlynpm run client- Start frontend dev server onlynpm run build- Build frontend for productionnpm run install-all- Install dependencies for root, server, and client
- Hero section
- Features showcase
- About section
- Benefits section
- Testimonials
- Call-to-action
- User profile information
- Selected hobbies
- Hosted events
- Joined events
- Quick link to host new event
- Browse all hobby chatrooms
- Highlight user's selected hobbies
- Real-time messaging with Socket.io
- Browse all events
- Filter by hobby
- Host new events
- Join/leave events
- View event details
- Browse learning resources
- Filter by hobby
- Share new resources
- Delete own resources
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open source and available under the MIT License.
- Ensure MongoDB is running locally, or
- Check your MongoDB Atlas connection string
- Verify network access in MongoDB Atlas if using cloud
- Ensure
CLIENT_URLin server.envmatches your frontend URL - Check that credentials are enabled in axios requests
- Verify the socket URL in
Chatroom.jsx - Check that the backend Socket.io server is running
- Ensure CORS is properly configured for Socket.io
For issues and questions, please open an issue on the repository.