Connect, share, and engage with your campus community through real-time interactions
- Overview
- Features
- Tech Stack
- Quick Start
- Installation
- Configuration
- Usage
- API Documentation
- Project Structure
- Contributing
- Deployment
- Support
CampusTree is a feature-rich social media platform designed specifically for campus communities. Built with the MERN stack and enhanced with real-time capabilities through Socket.IO, it offers a seamless experience for students to connect, share content, and stay updated with campus activities.
- Real-time Communication: Instant notifications and live updates
- Campus-Focused: Tailored for academic and student communities
- Modern Architecture: Built with industry-standard technologies
- Responsive Design: Works perfectly on all devices
- Scalable Backend: Designed to handle growing user bases
- JWT-based secure authentication
- Protected routes and session management
- Password encryption with bcrypt
- Rate limiting for API endpoints
- Posts: Create, edit, and delete posts with rich text
- Interactions: Like, comment, and share functionality
- Real-time Updates: Live notifications and activity feeds
- User Profiles: Customizable profiles with image uploads
- Activity Feed: Personalized content timeline
- Responsive design for all screen sizes
- Dark/Light mode toggle
- Infinite scroll for posts
- Image optimization and lazy loading
- Smooth animations and transitions
- RESTful API architecture
- Real-time WebSocket connections
- File upload handling
- Database optimization
- Error handling and logging
- React 18.2 - UI library with hooks and context
- Tailwind CSS - Utility-first CSS framework
- Node.js - JavaScript runtime
- Express.js - Web application framework
- MongoDB - NoSQL database
- Socket.IO - Real-time bidirectional communication
- JWT - Authentication tokens
- Multer - File upload middleware
- Git - Version control
- npm - Package management
- dotenv - Environment variables
- cors - Cross-origin resource sharing
- helmet - Security middleware
Add screenshots of your application here to showcase the UI/UX
Get CampusTree running on your local machine in just a few steps:
# Clone the repository
git clone https://github.com/saiteja181/campustree.git
# Navigate to project directory
cd campustree
# Install dependencies
npm run install-all
# Set up environment variables
cp .env.example .env
# Start the application
npm run devVisit http://localhost:3000 to see the application in action!
Before you begin, ensure you have the following installed:
- Node.js (v16.0 or higher) - Download here
- npm (v8.0 or higher) - Comes with Node.js
- MongoDB - Local installation or MongoDB Atlas
- Git - Download here
-
Clone the Repository
git clone https://github.com/saiteja181/campustree.git cd campustree -
Install Backend Dependencies
npm install
-
Install Frontend Dependencies
cd client npm install cd ..
-
Set Up Environment Variables Create a
.envfile in the root directory:cp .env.example .env
-
Start MongoDB
- Local MongoDB: Start your local MongoDB service
- MongoDB Atlas: Use your connection string
-
Run the Application
# Start both frontend and backend concurrently npm run dev # Or run them separately: # Terminal 1 - Backend npm run server # Terminal 2 - Frontend npm run client
Create a .env file in the root directory with the following variables:
# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGO_URL=mongodb://localhost:27017/campustree
# For MongoDB Atlas:
# MONGO_URL=mongodb+srv://username:password@cluster.mongodb.net/campustree
# Authentication
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRE=30d
# File Upload
MAX_FILE_SIZE=5000000
UPLOAD_PATH=./uploads
# Socket.IO
CLIENT_URL=http://localhost:3000
# Email Configuration (Optional)
EMAIL_SERVICE=gmail
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_passwordThe following scripts are available:
{
"scripts": {
"start": "node server.js",
"server": "nodemon server.js",
"client": "cd client && npm start",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"install-all": "npm install && cd client && npm install",
"build": "cd client && npm run build",
"test": "npm run test:server && npm run test:client",
"test:server": "jest",
"test:client": "cd client && npm test"
}
}- Registration: Create an account with your NITC email and password
- Login: Access your account securely
- Create Posts: Share your thoughts, images, and updates
- Interact: Like, comment, and engage with other users' content
- Profile: Customize your profile and upload a profile picture
- Real-time: Receive instant notifications for interactions
- API Endpoints: Use the RESTful API for custom integrations
- Real-time Events: Listen to Socket.IO events for live updates
- Database Models: Extend the MongoDB schemas as needed
- Authentication: Implement JWT-based auth in your features
http://localhost:5000/api
POST /api/auth/register # Register new user
POST /api/auth/login # User login
POST /api/auth/logout # User logout
GET /api/auth/profile # Get user profile
PUT /api/auth/profile # Update user profileGET /api/posts # Get all posts
GET /api/posts/:id # Get specific post
POST /api/posts # Create new post
PUT /api/posts/:id # Update post
DELETE /api/posts/:id # Delete post
POST /api/posts/:id/like # Like/unlike postGET /api/posts/:id/comments # Get post comments
POST /api/posts/:id/comments # Add comment
PUT /api/comments/:id # Update comment
DELETE /api/comments/:id # Delete comment// Client-side event listeners
socket.on('newPost', (post) => { /* Handle new post */ });
socket.on('newComment', (comment) => { /* Handle new comment */ });
socket.on('newLike', (like) => { /* Handle new like */ });
socket.on('notification', (notification) => { /* Handle notification */ });campustree/
โโโ ๐ client/ # React frontend
โ โโโ ๐ public/
โ โ โโโ index.html
โ โ โโโ favicon.ico
โ โโโ ๐ src/
โ โ โโโ ๐ components/ # Reusable UI components
โ โ โ โโโ Header.js
โ โ โ โโโ PostCard.js
โ โ โ โโโ CommentForm.js
โ โ โโโ ๐ pages/ # Page-level components
โ โ โ โโโ Home.js
โ โ โ โโโ Login.js
โ โ โ โโโ Register.js
โ โ โ โโโ Profile.js
โ โ โโโ ๐ redux/ # State management
โ โ โ โโโ store.js
โ โ โ โโโ authSlice.js
โ โ โ โโโ postsSlice.js
โ โ โโโ ๐ hooks/ # Custom React hooks
โ โ โโโ ๐ utils/ # Utility functions
โ โ โโโ ๐ styles/ # CSS and styling
โ โ โโโ App.js
โ โ โโโ index.js
โ โโโ package.json
โ โโโ tailwind.config.js
โโโ ๐ server/ # Backend API
โ โโโ ๐ controllers/ # Route handlers
โ โ โโโ authController.js
โ โ โโโ postsController.js
โ โ โโโ commentsController.js
โ โโโ ๐ middleware/ # Custom middleware
โ โ โโโ auth.js
โ โ โโโ upload.js
โ โ โโโ errorHandler.js
โ โโโ ๐ models/ # Database models
โ โ โโโ User.js
โ โ โโโ Post.js
โ โ โโโ Comment.js
โ โโโ ๐ routes/ # API routes
โ โ โโโ auth.js
โ โ โโโ posts.js
โ โ โโโ comments.js
โ โโโ ๐ utils/ # Helper functions
โ โโโ ๐ uploads/ # File uploads
โโโ ๐ socket/ # Socket.IO configuration
โ โโโ socketHandlers.js
โโโ server.js # Main server entry point
โโโ socketServer.js # Socket.IO server
โโโ .env # Environment variables
โโโ .env.example # Environment template
โโโ .gitignore # Git ignore rules
โโโ package.json # Backend dependencies
โโโ README.md # Project documentation
We welcome contributions from the community! Here's how you can help:
-
Fork the Repository
git clone https://github.com/yourusername/campustree.git
-
Create a Feature Branch
git checkout -b feature/amazing-feature
-
Make Your Changes
- Write clean, commented code
- Follow the existing code style
- Add tests for new features
-
Commit Your Changes
git commit -m "Add: amazing new feature" -
Push to Your Branch
git push origin feature/amazing-feature
-
Open a Pull Request
- Provide a clear description of your changes
- Reference any related issues
- Use ES6+ JavaScript features
- Follow React best practices and hooks patterns
- Write self-documenting code with clear variable names
- Add comments for complex logic
- Use Prettier for code formatting
- Follow conventional commit messages
If you find a bug or have a feature request, please:
- Check existing issues first
- Create a detailed issue report
- Include steps to reproduce (for bugs)
- Suggest solutions or improvements
-
Build the application
cd client npm run build -
Deploy to Netlify
- Connect your GitHub repository
- Set build command:
npm run build - Set publish directory:
client/build
-
Deploy to Vercel
npm install -g vercel vercel --prod
-
Create a Procfile
web: node server.js -
Deploy to Heroku
heroku create campustree-api heroku config:set NODE_ENV=production heroku config:set MONGO_URL=your_mongodb_atlas_url git push heroku main
-
Deploy to Railway
- Connect your GitHub repository
- Set environment variables
- Deploy automatically
- Create a MongoDB Atlas account
- Create a new cluster
- Add your connection string to environment variables
- Configure network access and database users
- Documentation: Check this README and inline code comments
- Issues: Report bugs or request features on GitHub Issues
- Email: Contact the maintainer at [kuramdasusaiteja@gmail.com]
Q: How do I reset my password? A: Currently, password reset is not implemented. You can manually update the password in the database or implement the feature.
Q: Can I use this for commercial purposes? A: Yes.
Q: How do I add new features? A: Fork the repository, create a feature branch, implement your changes, and submit a pull request.
Q: Is there a live demo? A: please deploy your own instance.


