A modern, full-featured web platform for students to share and access educational resources including notes, assignments, and study materials.
- User registration and login with JWT
- Secure password hashing with bcrypt
- Role-based access control (User/Admin)
- User profiles with customization
- Upload multiple file types (PDF, DOC, DOCX, PPT, PPTX, TXT, Images)
- Categorize uploads by subjects
- Add tags for better searchability
- Admin approval system for quality control
- Download tracking and view counters
- Advanced search functionality
- Filter by category, type (notes/assignments/resources)
- Pagination for better performance
- Real-time search with debouncing
- Dashboard with key statistics
- User management (activate/deactivate)
- Upload moderation (approve/reject)
- Category management
- Comprehensive analytics
- Beautiful dark theme with glassmorphism
- Smooth animations and transitions
- Fully responsive design
- Premium gradients and color schemes
- Interactive micro-animations
- Node.js - Runtime environment
- Express.js - Web framework
- MySQL - Database
- Sequelize - ORM
- JWT - Authentication
- Multer - File uploads
- bcryptjs - Password hashing
- Vanilla JavaScript - No framework dependencies
- Modern CSS - Custom design system
- HTML5 - Semantic markup
- Google Fonts (Inter) - Typography
- Node.js (v14 or higher)
- MySQL (v8.0 or higher)
- npm or yarn package manager
cd studyhub_v0.5npm installMake sure MySQL is running. Create a database:
CREATE DATABASE studyhub;Copy the example environment file and update with your configuration:
cp .env.example .envEdit .env file with your database credentials:
PORT=3000
NODE_ENV=development
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_NAME=studyhub
DB_USER=root
DB_PASSWORD=your_mysql_password
# JWT Secret (change this to a random string)
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
# Admin Credentials
ADMIN_EMAIL=admin@studyhub.com
ADMIN_PASSWORD=admin123Populate the database with initial data including admin user and sample content:
npm run seedThis will create:
- Admin user
- Sample users
- Categories (Computer Science, Mathematics, Physics, etc.)
- Sample uploads
For development with auto-reload:
npm run devFor production:
npm startThe application will be available at http://localhost:3000
- Email: admin@studyhub.com
- Password: admin123
- Email: john@example.com | Password: password123
- Email: jane@example.com | Password: password123
- Email: mike@example.com | Password: password123
studyhub_v0.5/
βββ config/
β βββ database.js # Database configuration
βββ controllers/
β βββ authController.js # Authentication logic
β βββ uploadController.js # Upload management
β βββ adminController.js # Admin operations
βββ middleware/
β βββ auth.js # JWT authentication
β βββ upload.js # File upload handling
βββ models/
β βββ User.js # User model
β βββ Category.js # Category model
β βββ Upload.js # Upload model
β βββ index.js # Model associations
βββ public/
β βββ css/
β β βββ style.css # Complete styling
β βββ js/
β β βββ app.js # Frontend application
β βββ index.html # Main HTML page
βββ routes/
β βββ auth.js # Auth routes
β βββ uploads.js # Upload routes
β βββ admin.js # Admin routes
βββ uploads/ # Uploaded files storage
βββ .env # Environment variables
βββ .gitignore
βββ package.json
βββ seed.js # Database seeding script
βββ server.js # Application entry point
βββ README.md
-
Register an Account
- Click "Sign Up" in the navigation
- Fill in your details
- Verify your email (optional in current version)
-
Browse Resources
- Click "Explore" to see all available resources
- Use search and filters to find specific content
- Click on any card to view details
-
Upload Resources
- Login to your account
- Click "Upload" button
- Fill in details and select your file
- Wait for admin approval (unless you're an admin)
-
Download Resources
- Click on any resource card
- View details in the modal
- Click "Download" button
-
Access Admin Panel
- Login with admin credentials
- Click "Admin" in navigation
-
Moderate Uploads
- View pending uploads
- Approve or reject submissions
- Monitor all uploads
-
Manage Users
- View all registered users
- Activate or deactivate accounts
- Change user roles
-
Manage Categories
- Add new categories
- Set category icons and colors
- Delete unused categories
- JWT Authentication - Secure token-based auth
- Password Hashing - bcrypt with salt rounds
- Rate Limiting - Protection against brute force
- File Type Validation - Only approved file types
- File Size Limits - 10MB maximum
- SQL Injection Protection - Sequelize ORM
- XSS Protection - Input sanitization
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update profile
POST /api/uploads- Create upload (requires auth)GET /api/uploads- Get all uploads (with filters)GET /api/uploads/:id- Get single uploadGET /api/uploads/:id/download- Download fileDELETE /api/uploads/:id- Delete upload (requires auth)
GET /api/admin/dashboard- Get statisticsGET /api/admin/users- Get all usersPUT /api/admin/users/:userId- Update userGET /api/admin/uploads/pending- Get pending uploadsPUT /api/admin/uploads/:uploadId/moderate- Approve/rejectGET /api/admin/categories- Get categoriesPOST /api/admin/categories- Create categoryDELETE /api/admin/categories/:id- Delete category
Edit public/css/style.css and modify CSS variables:
:root {
--primary: #6366f1; /* Primary color */
--secondary: #8b5cf6; /* Secondary color */
--success: #10b981; /* Success color */
--danger: #ef4444; /* Danger color */
/* ... more variables */
}Edit middleware/upload.js and add to allowedTypes:
const allowedTypes = [
'application/pdf',
'your/mime-type', // Add here
// ...
];- id, username, email, password, fullName, role, bio, avatar, isActive, timestamps
- id, name, description, icon, color, timestamps
- id, title, description, type, fileName, filePath, fileSize, fileType, tags, downloads, views, isApproved, isActive, userId, categoryId, timestamps
- Verify MySQL is running
- Check
.envdatabase credentials - Ensure database exists
- Check
uploads/directory exists and is writable - Verify file size and type restrictions
- Check disk space
- Change PORT in
.envfile - Or kill the process using the port
- Email verification
- Password reset functionality
- Comments and ratings on uploads
- User bookmarks/favorites
- Advanced analytics dashboard
- File preview functionality
- Real-time notifications
- Social sharing features
- Mobile app version
This project is open source and available under the MIT License.
For issues, questions, or contributions, please create an issue in the repository.
Built with β€οΈ for the student community