Skip to content

StudyShare is a full-stack web application that allows students to upload, share, and discover academic resources. Built with the MERN stack (MongoDB, Express, React, Node.js) and integrated with AWS S3 for file storage, it provides a centralized platform for educational content sharing.

Notifications You must be signed in to change notification settings

viraj-gavade/STUDY-SHARE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š StudyShare

A Modern Platform for Academic Resource Sharing

License: MIT TypeScript React Node.js MongoDB AWS S3

🌐 Live Demo β€’ πŸ“– Documentation β€’ πŸ› Report Bug β€’ ✨ Request Feature


πŸ“‹ Table of Contents


🎯 Overview

StudyShare is a comprehensive full-stack web application designed to revolutionize how students share and discover academic resources. Built with the MERN stack and powered by AWS S3, it provides a secure, scalable, and user-friendly platform for educational content collaboration.

🌟 Why StudyShare?

  • πŸ“€ Seamless Sharing: Upload and organize study materials with rich metadata
  • πŸ” Smart Discovery: Advanced search and filtering to find exactly what you need
  • πŸ‘₯ Community Driven: Upvote, comment, and engage with educational content
  • πŸ”’ Secure & Reliable: JWT authentication and AWS S3 for enterprise-grade security
  • ⚑ Lightning Fast: Built with modern tech stack for optimal performance

✨ Key Features

πŸ” Authentication & Security

  • βœ… Secure user registration with email verification
  • βœ… JWT-based authentication system
  • βœ… Password reset via email with secure tokens
  • βœ… Protected routes and role-based access control

πŸ“ Resource Management

  • βœ… Multi-format file uploads (PDF, DOCX, PPTX, images)
  • βœ… Rich metadata tagging (subject, department, semester)
  • βœ… Intelligent categorization system
  • βœ… Full CRUD operations on resources
  • βœ… Cloud storage with AWS S3 integration

πŸ”Ž Advanced Search & Discovery

  • βœ… Full-text search across resources
  • βœ… Filter by department, semester, and file type
  • βœ… Sort by recency, popularity, or engagement
  • βœ… Tag-based discovery system

πŸ‘₯ Social Engagement

  • βœ… Upvote system to highlight quality content
  • βœ… Threaded comment discussions
  • βœ… User profiles and contribution tracking
  • βœ… Activity dashboard

πŸ“Š User Dashboard

  • βœ… Personal profile management
  • βœ… Upload history and analytics
  • βœ… Favorite resources collection
  • βœ… Activity timeline

πŸ› οΈ Tech Stack

Backend

Technology Purpose
Node.js Runtime environment
Express Web framework
TypeScript Type safety
MongoDB Database
Mongoose ODM
JWT Authentication
AWS S3 File storage

Frontend

Technology Purpose
React UI library
TypeScript Type safety
Vite Build tool
TailwindCSS Styling
React Router Routing
Axios HTTP client
Framer Motion Animations

🌐 Live Deployment

StudyShare is deployed on Render using a microservices architecture:

Service URL Status
🎨 Frontend study-share-frontend.onrender.com Status
βš™οΈ Backend API study-share-backend.onrender.com/api Status

πŸ—οΈ Deployment Architecture

Despite being developed as a monorepo, the application is deployed as two independent services:

graph LR
    A[User] --> B[Frontend - Render]
    B --> C[Backend API - Render]
    C --> D[MongoDB Atlas]
    C --> E[AWS S3]
    
    style A fill:#61DAFB
    style B fill:#646CFF
    style C fill:#339933
    style D fill:#47A248
    style E fill:#FF9900
Loading

Frontend Service Configuration

Build Command: npm install && npm run build
Publish Directory: dist
Environment Variables:
  VITE_API_URL: https://study-share-backend.onrender.com/api

Backend Service Configuration

Build Command: npm install && npm run build
Start Command: node dist/server.js
Environment Variables:
  PORT: 10000
  MONGODB_URI: <mongodb_connection_string>
  JWT_SECRET: <jwt_secret>
  AWS_ACCESS_KEY_ID: <aws_key>
  AWS_SECRET_ACCESS_KEY: <aws_secret>
  AWS_REGION: <aws_region>
  S3_BUCKET_NAME: <bucket_name>
  FRONTEND_URL: https://study-share-frontend.onrender.com

⚠️ Known Issues

Express 5.x Path-to-RegExp Error

If you encounter this error:

TypeError: Missing parameter name at 1: https://git.new/pathToRegexpError

Solution: Ensure all routes follow Express 5.x path syntax. See the Express 5 Migration Guide.


πŸš€ Getting Started

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

⚑ Quick Start

1️⃣ Clone the Repository

git clone https://github.com/yourusername/study-share.git
cd study-share

2️⃣ Backend Setup

# Navigate to backend directory
cd Backend

# Install dependencies
npm install

# Create environment file
cp .env.example .env

# Configure your .env file (see configuration below)
nano .env

# Start development server
npm run dev

Backend Environment Variables (.env):

# Server Configuration
PORT=5000
NODE_ENV=development

# Database
MONGODB_URI=mongodb://localhost:27017/studyshare
# Or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/studyshare

# Frontend URL
FRONTEND_URL=http://localhost:5173

# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRY=7d

# AWS S3 Configuration
AWS_ACCESS_KEY_ID=your-aws-access-key-id
AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key
AWS_REGION=us-east-1
AWS_S3_BUCKET=your-s3-bucket-name

# Email Configuration (for password reset)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-specific-password
EMAIL_FROM=noreply@studyshare.com

3️⃣ Frontend Setup

# Open a new terminal and navigate to frontend directory
cd Frontend

# Install dependencies
npm install

# Create environment file
cp .env.example .env

# Configure your .env file
nano .env

# Start development server
npm run dev

Frontend Environment Variables (.env):

# API Configuration
VITE_API_URL=http://localhost:5000/api
VITE_APP_ENV=development

# For Production (Render deployment)
# VITE_API_URL=https://study-share-backend.onrender.com/api
# VITE_APP_ENV=production

4️⃣ Access the Application

Open your browser and navigate to:


☁️ AWS S3 Configuration

Setting Up Your S3 Bucket

  1. Create an S3 Bucket

    • Login to AWS Console
    • Navigate to S3 service
    • Click "Create bucket"
    • Choose a unique bucket name
    • Select your preferred region
    • Uncheck "Block all public access" (we'll use bucket policy for security)
  2. Configure CORS Policy

    Add this CORS configuration to your bucket:

    [
      {
        "AllowedHeaders": ["*"],
        "AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
        "AllowedOrigins": [
          "http://localhost:5173",
          "https://study-share-frontend.onrender.com"
        ],
        "ExposeHeaders": ["ETag"],
        "MaxAgeSeconds": 3000
      }
    ]
  3. Set Bucket Policy

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "PublicReadGetObject",
          "Effect": "Allow",
          "Principal": "*",
          "Action": ["s3:GetObject"],
          "Resource": ["arn:aws:s3:::your-bucket-name/*"]
        }
      ]
    }
  4. Create IAM User

    • Navigate to IAM service
    • Create a new user with programmatic access
    • Attach policy: AmazonS3FullAccess
    • Save the Access Key ID and Secret Access Key

πŸ“– API Documentation

Base URL

Development: http://localhost:5000/api
Production: https://study-share-backend.onrender.com/api

πŸ” Authentication Endpoints

POST /auth/register - Register a new user

Request Body:

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securePassword123",
  "department": "Computer Science",
  "semester": 3
}

Response:

{
  "success": true,
  "message": "User registered successfully",
  "data": {
    "user": {
      "id": "user_id",
      "name": "John Doe",
      "email": "john@example.com"
    },
    "token": "jwt_token"
  }
}
POST /auth/login - User login

Request Body:

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

Response:

{
  "success": true,
  "data": {
    "user": {
      "id": "user_id",
      "name": "John Doe",
      "email": "john@example.com"
    },
    "token": "jwt_token"
  }
}
POST /auth/forgot-password - Request password reset

Request Body:

{
  "email": "john@example.com"
}

Response:

{
  "success": true,
  "message": "Password reset code sent to email"
}

πŸ“š Resource Endpoints

POST /resources - Upload a resource (πŸ”’ Protected)

Request: Multipart form-data

file: [File]
title: "Introduction to Algorithms"
description: "Comprehensive guide to algorithms"
subject: "Data Structures"
department: "Computer Science"
semester: 3
tags: ["algorithms", "data structures", "tutorial"]

Response:

{
  "success": true,
  "data": {
    "id": "resource_id",
    "title": "Introduction to Algorithms",
    "fileUrl": "https://s3.amazonaws.com/...",
    "uploadedBy": {
      "id": "user_id",
      "name": "John Doe"
    }
  }
}
GET /resources - Get all resources

Query Parameters:

  • page: Page number (default: 1)
  • limit: Items per page (default: 10)
  • sort: Sort by (recent, popular, comments)

Response:

{
  "success": true,
  "data": {
    "resources": [...],
    "pagination": {
      "total": 100,
      "page": 1,
      "pages": 10
    }
  }
}
GET /resources/search - Search resources

Query Parameters:

  • q: Search query
  • department: Filter by department
  • semester: Filter by semester
  • fileType: Filter by file type
  • tags: Filter by tags (comma-separated)

Response:

{
  "success": true,
  "data": {
    "resources": [...],
    "count": 25
  }
}
POST /resources/:id/upvote - Upvote a resource (πŸ”’ Protected)

Response:

{
  "success": true,
  "data": {
    "upvoted": true,
    "upvoteCount": 42
  }
}
POST /resources/:id/comment - Add a comment (πŸ”’ Protected)

Request Body:

{
  "text": "Great resource! Very helpful."
}

Response:

{
  "success": true,
  "data": {
    "comment": {
      "id": "comment_id",
      "text": "Great resource! Very helpful.",
      "user": {
        "name": "John Doe"
      },
      "createdAt": "2025-01-30T10:00:00Z"
    }
  }
}

πŸ‘€ User Endpoints

GET /users/me - Get current user profile (πŸ”’ Protected)

Response:

{
  "success": true,
  "data": {
    "user": {
      "id": "user_id",
      "name": "John Doe",
      "email": "john@example.com",
      "department": "Computer Science",
      "semester": 3,
      "resourcesUploaded": 15,
      "createdAt": "2025-01-01T00:00:00Z"
    }
  }
}

πŸ“ Project Structure

Backend Structure

Backend/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app.ts                 # Express app configuration
β”‚   β”œβ”€β”€ server.ts              # Application entry point
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ aws.ts            # AWS S3 configuration
β”‚   β”‚   └── database.ts       # MongoDB connection
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ auth.controller.ts
β”‚   β”‚   β”œβ”€β”€ resource.controller.ts
β”‚   β”‚   └── user.controller.ts
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ User.ts           # User schema
β”‚   β”‚   β”œβ”€β”€ Resource.ts       # Resource schema
β”‚   β”‚   └── Comment.ts        # Comment schema
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ auth.routes.ts
β”‚   β”‚   β”œβ”€β”€ resource.routes.ts
β”‚   β”‚   └── user.routes.ts
β”‚   β”œβ”€β”€ middlewares/
β”‚   β”‚   β”œβ”€β”€ auth.middleware.ts    # JWT verification
β”‚   β”‚   β”œβ”€β”€ upload.middleware.ts  # Multer S3 config
β”‚   β”‚   └── validation.middleware.ts
β”‚   └── utils/
β”‚       β”œβ”€β”€ jwt.ts            # JWT utilities
β”‚       β”œβ”€β”€ email.ts          # Email service
β”‚       └── validators.ts     # Input validators
β”œβ”€β”€ package.json
└── tsconfig.json

Frontend Structure

Frontend/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.tsx              # Application entry
β”‚   β”œβ”€β”€ App.tsx               # Root component
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ ui/               # shadcn-ui components
β”‚   β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.tsx
β”‚   β”‚   β”‚   └── Footer.tsx
β”‚   β”‚   └── resources/
β”‚   β”‚       β”œβ”€β”€ ResourceCard.tsx
β”‚   β”‚       β”œβ”€β”€ ResourceList.tsx
β”‚   β”‚       └── UploadForm.tsx
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Home.tsx
β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx
β”‚   β”‚   β”œβ”€β”€ Resources.tsx
β”‚   β”‚   β”œβ”€β”€ ResourceDetail.tsx
β”‚   β”‚   β”œβ”€β”€ Upload.tsx
β”‚   β”‚   └── Auth/
β”‚   β”‚       β”œβ”€β”€ Login.tsx
β”‚   β”‚       └── Register.tsx
β”‚   β”œβ”€β”€ context/
β”‚   β”‚   └── AuthContext.tsx   # Authentication state
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ useAuth.ts
β”‚   β”‚   └── useResources.ts
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ api.ts            # Axios instance
β”‚   β”‚   β”œβ”€β”€ auth.service.ts
β”‚   β”‚   └── resource.service.ts
β”‚   └── utils/
β”‚       β”œβ”€β”€ constants.ts
β”‚       └── helpers.ts
β”œβ”€β”€ package.json
β”œβ”€β”€ vite.config.ts
└── tailwind.config.js

πŸ“Έ Screenshots

🏠 Home Page

Home Page Clean, modern landing page with featured resources

πŸ“Š User Dashboard

Dashboard Comprehensive dashboard with upload history and analytics

πŸ“€ Upload Interface

Upload Resources Intuitive file upload with rich metadata options

πŸ” Resources Listing

Resources Page Advanced search and filtering capabilities

πŸ“„ Resource Details

Resource Details Detailed view with comments and engagement options


🀝 Contributing

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

How to Contribute

  1. Fork the repository

    git clone https://github.com/yourusername/study-share.git
  2. Create a feature branch

    git checkout -b feature/amazing-feature
  3. Make your changes

    • Write clean, documented code
    • Follow existing code style
    • Add tests if applicable
  4. Commit your changes

    git commit -m 'Add some amazing feature'
  5. Push to the branch

    git push origin feature/amazing-feature
  6. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Use meaningful variable and function names
  • Write comments for complex logic
  • Ensure all tests pass before submitting PR
  • Update documentation if needed

πŸ› Bug Reports & Feature Requests

Found a bug or have a feature idea?


πŸ“ License

This project is licensed under the MIT License - see below for details:

MIT License

Copyright (c) 2025 Viraj Gavade

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

Viraj Gavade


πŸ™ Acknowledgments

  • Thanks to all contributors who have helped shape this project
  • Inspired by the need for better academic resource sharing
  • Built with ❀️ for students, by students

⭐ Star this repo if you find it helpful!

Made with ❀️ and TypeScript

⬆ Back to Top

About

StudyShare is a full-stack web application that allows students to upload, share, and discover academic resources. Built with the MERN stack (MongoDB, Express, React, Node.js) and integrated with AWS S3 for file storage, it provides a centralized platform for educational content sharing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages