Skip to content

Studi.io: A real-time collaborative study platform built with the MERN stack (MongoDB, Express, React, Node.js) and TypeScript. Features include shared whiteboards, live chat, organized resource hubs, and user authentication.

Notifications You must be signed in to change notification settings

vimalyad/studi.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

92 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ“š Studi.io

GitHub stars GitHub issues GitHub forks

Studi.io is a modern, collaborative study platform that brings students together in virtual study rooms. Built with real-time communication, resource sharing, and interactive whiteboards, Studi.io makes group studying productive and engaging.

Project Screenshot

πŸ”— Live Demo: https://studiio.netlify.app


✨ Features

🎯 Core Features

  • πŸšͺ Create & Join Rooms – Easily create or join public/private study rooms
  • πŸ’¬ Real-time Chat – Instant messaging with Socket.IO for seamless communication
  • πŸ”’ Privacy Control – Public or private rooms with customizable access
  • πŸ–ΌοΈ Room Customization – Set custom names, descriptions, and avatars
  • ☁️ Cloud Image Uploads – Profile and room images hosted on Cloudinary
  • βš™οΈ Room Management – Full CRUD operations for room owners and admins
  • πŸ‘₯ Member Management – Admin controls and member permissions
  • πŸ”” Real-time Notifications – Instant feedback with react-hot-toast
  • πŸ“± Responsive Design – Mobile-first UI with Tailwind CSS
  • πŸ” Secure Authentication – JWT-based auth with access/refresh tokens
  • πŸ“§ Email Service – OTP verification and notifications via SendGrid

πŸš€ Upcoming Features

  • πŸ“ Collaborative Whiteboard – Real-time drawing and note-taking
  • πŸ—‚οΈ ResourceHub – Centralized document and link management
  • πŸŽ₯ Video Chat – Built-in video conferencing
  • πŸ“Š Study Analytics – Track study time and productivity
  • πŸ”” Push Notifications – Browser push notifications for updates

πŸ’» Tech Stack

Frontend

Technology Purpose
React 18 UI framework with hooks and modern features
TypeScript Type-safe JavaScript
Tailwind CSS Utility-first CSS framework
Redux Toolkit State management with Redux Persist
React Router Client-side routing
Socket.IO Client Real-time WebSocket communication
Axios HTTP client with interceptors
Lucide React Beautiful icon library
React Hot Toast Toast notifications
Vite Lightning-fast build tool

Backend

Technology Purpose
Node.js JavaScript runtime
Express.js Web framework
MongoDB NoSQL database
Mongoose MongoDB ODM with schemas
Socket.IO Real-time bidirectional communication
JWT JSON Web Tokens for authentication
bcrypt Password hashing
Cloudinary Cloud-based image storage
SendGrid Email delivery service
Multer File upload handling

πŸ—οΈ Architecture

System Design

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client    │◄───────►│    Server    │◄───────►│   MongoDB   β”‚
β”‚  (React)    β”‚  HTTP   β”‚  (Express)   β”‚  CRUD   β”‚  (Database) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β–²                       β–²                         
       β”‚                       β”‚                         
       β”‚    WebSocket          β”‚                         
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         
         Real-time Updates                              

Key Components

  • Authentication Layer: JWT-based with refresh token rotation
  • Real-time Layer: Socket.IO for instant messaging and presence
  • Storage Layer: MongoDB for data, Cloudinary for media
  • Email Layer: SendGrid for OTP verification and notifications

πŸ› οΈ Getting Started

Prerequisites


Installation

1️⃣ Clone the Repository

git clone https://github.com/yamiSukehiro2907/studi.io.git
cd studi.io

2️⃣ Backend Setup

cd server
npm install

Create .env file in server/ directory:

PORT=8000
CONNECTION_STRING=your_mongodb_connection_string
ACCESS_TOKEN_SECRET=your_access_token_secret
REFRESH_TOKEN_SECRET=your_refresh_token_secret
ACCESS_TOKEN_EXPIRATION=3600000
REFRESH_TOKEN_EXPIRATION=604800000
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
EMAIL_USER=your_gmail@gmail.com
SENDGRID_API_KEY=your_sendgrid_api_key
NODE_ENV=production
ALLOWED_ORIGINS=http://localhost:5173,https://studiio.netlify.app

3️⃣ Frontend Setup

cd ../client
npm install

Create .env file in client/ directory:

VITE_API_BASE_URL=http://localhost:8000

Running the Application

Development Mode

Backend:

cd server
npm run dev

Server runs on http://localhost:8000

Frontend:

cd client
npm run dev

Client runs on http://localhost:5173

Production Mode

Backend:

cd server
npm start

Frontend:

cd client
npm run build
npm run preview

πŸ“ Project Structure

studi.io/
β”œβ”€β”€ client/                    # Frontend React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/              # API service functions
β”‚   β”‚   β”œβ”€β”€ assets/           # Images and static files
β”‚   β”‚   β”œβ”€β”€ components/       # Reusable React components
β”‚   β”‚   β”‚   β”œβ”€β”€ Main/         # Main content components
β”‚   β”‚   β”‚   β”œβ”€β”€ Room/         # Room-related components
β”‚   β”‚   β”‚   β”œβ”€β”€ Settings/     # Settings modal components
β”‚   β”‚   β”‚   β”œβ”€β”€ SideBar/      # Sidebar components
β”‚   β”‚   β”‚   β”œβ”€β”€ chat/         # Chat components
β”‚   β”‚   β”‚   └── common/       # Shared components
β”‚   β”‚   β”œβ”€β”€ config/           # Configuration files
β”‚   β”‚   β”‚   β”œβ”€β”€ schema/       # TypeScript interfaces
β”‚   β”‚   β”‚   β”œβ”€β”€ axiosConfig.ts
β”‚   β”‚   β”‚   └── socket.ts
β”‚   β”‚   β”œβ”€β”€ hooks/            # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ pages/            # Page components
β”‚   β”‚   β”œβ”€β”€ redux/            # Redux store and slices
β”‚   β”‚   β”‚   β”œβ”€β”€ slices/
β”‚   β”‚   β”‚   └── store.ts
β”‚   β”‚   β”œβ”€β”€ App.tsx           # Main App component
β”‚   β”‚   └── main.tsx          # Entry point
β”‚   β”œβ”€β”€ .env                  # Environment variables
β”‚   └── package.json
β”‚
β”œβ”€β”€ server/                    # Backend Node.js application
β”‚   β”œβ”€β”€ config/               # Configuration files
β”‚   β”‚   β”œβ”€β”€ cloudinary.config.js
β”‚   β”‚   β”œβ”€β”€ mail.config.js
β”‚   β”‚   β”œβ”€β”€ mongoDB.config.js
β”‚   β”‚   └── multer.js
β”‚   β”œβ”€β”€ constants/            # Constants and utilities
β”‚   β”‚   β”œβ”€β”€ otp.generate.js
β”‚   β”‚   β”œβ”€β”€ token.js
β”‚   β”‚   └── username.create.js
β”‚   β”œβ”€β”€ controllers/          # Route controllers
β”‚   β”‚   β”œβ”€β”€ auth.controller.js
β”‚   β”‚   β”œβ”€β”€ message.controller.js
β”‚   β”‚   β”œβ”€β”€ otp.controller.js
β”‚   β”‚   β”œβ”€β”€ studyroom.controller.js
β”‚   β”‚   └── user.controller.js
β”‚   β”œβ”€β”€ handler/              # Socket.IO handlers
β”‚   β”‚   └── socketHandler.js
β”‚   β”œβ”€β”€ middleware/           # Express middleware
β”‚   β”‚   β”œβ”€β”€ socketAuth.js
β”‚   β”‚   └── validation.js
β”‚   β”œβ”€β”€ models/               # Mongoose models
β”‚   β”‚   β”œβ”€β”€ message.model.js
β”‚   β”‚   β”œβ”€β”€ otp.model.js
β”‚   β”‚   β”œβ”€β”€ resource.model.js
β”‚   β”‚   β”œβ”€β”€ section.model.js
β”‚   β”‚   β”œβ”€β”€ studyRoom.model.js
β”‚   β”‚   └── user.model.js
β”‚   β”œβ”€β”€ routers/              # Express routes
β”‚   β”‚   β”œβ”€β”€ auth.route.js
β”‚   β”‚   β”œβ”€β”€ message.route.js
β”‚   β”‚   β”œβ”€β”€ otp.route.js
β”‚   β”‚   β”œβ”€β”€ room.route.js
β”‚   β”‚   └── user.route.js
β”‚   β”œβ”€β”€ .env                  # Environment variables
β”‚   β”œβ”€β”€ index.js              # Server entry point
β”‚   └── package.json
β”‚
└── README.md                 # This file

πŸ” Authentication Flow

sequenceDiagram
    participant User
    participant Client
    participant Server
    participant Database
    
    User->>Client: Sign Up
    Client->>Server: POST /auth/register
    Server->>Database: Create User
    Server->>User: Send OTP Email
    User->>Client: Enter OTP
    Client->>Server: POST /otp/verify-otp
    Server->>Database: Verify & Update User
    Server->>Client: Success Response
    
    User->>Client: Login
    Client->>Server: POST /auth/login
    Server->>Database: Verify Credentials
    Server->>Client: Set Access & Refresh Tokens
    Client->>Client: Store User in Redux
Loading

πŸ”„ Real-time Communication

Socket.IO Events

Client β†’ Server

Event Payload Description
join-room { roomId } Join a study room
sendMessage { roomId, content } Send a message
leave-room { roomId } Leave a room

Server β†’ Client

Event Payload Description
newMessage Message New message received
user-joined { userId, userName } User joined room
user-left { userId, userName } User left room
messageError { message } Error occurred

πŸ”’ Security Features

  • Password Hashing: bcrypt with 10 salt rounds
  • JWT Tokens: Separate access (1h) and refresh (7d) tokens
  • HTTP-Only Cookies: Tokens stored securely
  • CORS Protection: Configured for specific origins
  • Input Validation: Server-side validation for all inputs
  • Rate Limiting: Protection against brute force attacks
  • XSS Protection: Sanitized user inputs
  • Email Verification: Required for account activation
  • Socket Authentication: JWT verification for WebSocket connections

🀝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/AmazingFeature
  3. Commit your changes: git commit -m 'Add some AmazingFeature'
  4. Push to the branch: git push origin feature/AmazingFeature
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style
  • Write meaningful commit messages
  • Update documentation for new features
  • Add tests for new functionality
  • Ensure all tests pass before submitting PR

πŸ› Bug Reports & Feature Requests

Found a bug or have a feature idea? Please open an issue on GitHub Issues.

When reporting bugs, please include:

  • Clear description of the issue
  • Steps to reproduce
  • Expected vs actual behavior
  • Screenshots (if applicable)
  • Browser/OS information

πŸ“„ API Documentation

Authentication Endpoints

POST /auth/register

Register a new user

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securePassword123"
}

POST /auth/login

Login with email/username

{
  "identifier": "john@example.com",
  "password": "securePassword123"
}

POST /auth/logout

Logout current user (clears tokens)

POST /auth/refresh

Refresh access token using refresh token

Room Endpoints

POST /rooms/create

Create a new study room (requires auth)

{
  "name": "Physics Study Group",
  "description": "Preparing for finals"
}

GET /rooms

Get all rooms user is a member of (requires auth)

GET /rooms/public?term=physics

Search public rooms (requires auth)

POST /rooms/join/:id

Join a public room (requires auth)

POST /rooms/update/:id

Update room details (requires auth, owner/admin only)

DELETE /rooms/:id

Delete a room (requires auth, owner only)

Message Endpoints

GET /messages/:roomId?page=1

Get paginated messages for a room (requires auth)

User Endpoints

GET /user/profile

Get current user profile (requires auth)

POST /user/update

Update user profile (requires auth, supports multipart/form-data)

POST /user/change-password

Change password with current password (requires auth)


🌐 Deployment

Frontend (Netlify)

  1. Build the project: npm run build
  2. Deploy the dist folder to Netlify
  3. Set environment variable: VITE_API_BASE_URL=your_backend_url

Backend (Render/Heroku)

  1. Push code to GitHub
  2. Connect repository to hosting platform
  3. Set all environment variables
  4. Deploy with Node.js environment

πŸ“Š Performance Optimizations

  • Code Splitting: React lazy loading for routes
  • Image Optimization: Cloudinary automatic optimization
  • Caching: Redux Persist for offline support
  • Debouncing: Search queries debounced by 500ms
  • Pagination: Messages paginated (50 per page)
  • Connection Pooling: MongoDB connection optimization
  • Gzip Compression: Reduced payload sizes

πŸ”— Links


πŸ‘¨β€πŸ’» Author

Vimal Yadav


πŸ“ž Support

Need help? Reach out:


Made with ❀️ by the Studi.io Team

⭐ Star us on GitHub β€” it motivates us a lot!

Report Bug Β· Request Feature

About

Studi.io: A real-time collaborative study platform built with the MERN stack (MongoDB, Express, React, Node.js) and TypeScript. Features include shared whiteboards, live chat, organized resource hubs, and user authentication.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published