A complete full-stack web application for sharing study materials with community chat, user profiles, and admin controls.
It now includes an assembly learning toolkit (asm/) for low-level systems study.
- β User registration and login
- π€ Upload study materials (PDFs, images, documents, etc.)
- π₯ Download shared files
- π¬ Community chat for discussions
- π€ User profiles with customizable profile pictures
- π Achievement badges based on contributions
- π Search and filter files
- π Personal statistics (uploads, messages)
- ποΈ Delete any user's files
- ποΈ Delete any user's messages
- π Admin badge on profile
- π‘οΈ Full moderation capabilities
StudyShare_App/
βββ frontend/ # Client-side application
β βββ index.html # Main HTML file
β βββ styles.css # Styling
β βββ app.js # Frontend logic
β
βββ backend/ # Server-side application
β βββ server.js # Main server file
β βββ package.json # Node.js dependencies
β βββ .env # Environment variables
β βββ config/ # Database configuration
β βββ routes/ # API routes
β βββ middleware/ # Authentication middleware
β βββ uploads/ # File storage
β
βββ database/ # Database files
βββ schema.sql # Database schema
βββ init_admin.js # Admin initialization
βββ README.md # Database setup guide
βββ asm/ # Assembly language enrichment toolkit
β βββ x86_64/ # NASM sources
β βββ aarch64/ # ARM64 sources
β βββ build.sh # Build helper
β βββ README.md # Assembly docs
- Node.js (v14 or higher)
- MySQL or MariaDB
- npm or yarn
- Install MySQL/MariaDB
- Create database:
mysql -u root -p
CREATE DATABASE studyshare_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
exit;- Import schema:
cd database
mysql -u root -p studyshare_db < schema.sql- Initialize admin user:
node init_admin.js- Navigate to backend folder:
cd backend- Install dependencies:
npm install- Configure
.envfile:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=studyshare_db
DB_PORT=3306
PORT=3000
NODE_ENV=development
JWT_SECRET=change_this_to_random_secret_key
MAX_FILE_SIZE=10485760
UPLOAD_DIR=uploads- Start backend server:
npm startThe API will be available at http://localhost:3000
- Open
frontend/app.jsand verify API_BASE_URL:
const API_BASE_URL = 'http://localhost:3000/api';- Serve the frontend:
Option A - Using Python:
cd frontend
python -m http.server 8080Option B - Using Node.js:
npm install -g http-server
cd frontend
http-server -p 8080Option C - Using VS Code Live Server:
- Install Live Server extension
- Right-click on
index.html - Select "Open with Live Server"
- Access the application at
http://localhost:8080
- Username: ShiroOni
- Password: Shiro
- AWS Account
- EC2 instance (Ubuntu recommended)
- Security Group configured for ports: 22, 80, 443, 3000, 8080
- Choose Ubuntu Server 20.04 LTS or higher
- t2.micro or larger
- Configure security group to allow HTTP (80), HTTPS (443), and custom ports
# Update system
sudo apt update && sudo apt upgrade -y
# Install Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
# Install MySQL
sudo apt install -y mysql-server
# Secure MySQL
sudo mysql_secure_installation# From your local machine
scp -r StudyShare_App ubuntu@your-ec2-ip:/home/ubuntu/Or use Git:
# On EC2 instance
git clone your-repository-url
cd StudyShare_Appsudo mysql -u root -p
CREATE DATABASE studyshare_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'studyshare_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON studyshare_db.* TO 'studyshare_user'@'localhost';
FLUSH PRIVILEGES;
exit;
# Import schema
cd database
mysql -u root -p studyshare_db < schema.sql
# Initialize admin
node init_admin.jscd backend
npm install
# Update .env with production settings
nano .envUpdate .env:
DB_HOST=localhost
DB_USER=studyshare_user
DB_PASSWORD=secure_password
DB_NAME=studyshare_db
PORT=3000
NODE_ENV=production
JWT_SECRET=generate_random_secret_here# Install PM2
sudo npm install -g pm2
# Start backend
cd backend
pm2 start server.js --name studyshare-api
# Set PM2 to start on boot
pm2 startup
pm2 save# Install Nginx
sudo apt install -y nginx
# Create Nginx configuration
sudo nano /etc/nginx/sites-available/studyshareNginx config:
server {
listen 80;
server_name your-domain.com; # or EC2 public IP
# Frontend
location / {
root /home/ubuntu/StudyShare_App/frontend;
index index.html;
try_files $uri $uri/ /index.html;
}
# API proxy
location /api {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Uploads
location /uploads {
proxy_pass http://localhost:3000;
}
}Enable site:
sudo ln -s /etc/nginx/sites-available/studyshare /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginxsudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable# Install Certbot
sudo apt install -y certbot python3-certbot-nginx
# Get SSL certificate
sudo certbot --nginx -d your-domain.com- Frontend:
http://your-ec2-iporhttp://your-domain.com - API:
http://your-ec2-ip/apiorhttp://your-domain.com/api
POST /api/auth/signup- Register new userPOST /api/auth/login- User login
GET /api/files- Get all filesPOST /api/files/upload- Upload fileGET /api/files/download/:id- Download fileDELETE /api/files/:id- Delete file
GET /api/chat/messages- Get all messagesPOST /api/chat/send- Send messageDELETE /api/chat/messages/:id- Delete message
GET /api/users/profile- Get user profilePOST /api/users/profile-image- Upload profile image
- HTML5
- CSS3 (with modern gradients and animations)
- Vanilla JavaScript (ES6+)
- Fetch API for HTTP requests
- Node.js
- Express.js
- MySQL2
- JWT for authentication
- Bcrypt for password hashing
- Multer for file uploads
- MySQL/MariaDB
Users earn badges based on contributions:
- π First Upload - Upload first file
- π Knowledge Sharer - Upload 5 files
- π Top Contributor - Upload 10 files
- π Elite Member - Upload 20 files
- π Administrator - Admin role
- π PDFs
- πΌοΈ Images (JPG, PNG, GIF, WebP)
- π Documents (DOC, DOCX, TXT)
- π₯ Videos (MP4, AVI, MOV)
- π΅ Audio (MP3, WAV, OGG)
- π¦ Archives (ZIP, RAR, 7Z)
- π» Code files (JS, PY, JAVA, etc.)
- Password hashing with bcrypt
- JWT-based authentication
- File size limits
- SQL injection protection
- XSS protection
- CORS configured
- Admin-only routes protected
- Check if MySQL is running
- Verify .env configuration
- Ensure database exists
- Check if port 3000 is available
- Verify backend is running
- Check API_BASE_URL in app.js
- Check browser console for CORS errors
- Ensure CORS is enabled in backend
- Check file size limits
- Verify uploads directory exists and is writable
- Check disk space
- Verify MySQL credentials
- Check if database exists
- Ensure MySQL is running
- Check firewall settings
MIT License - Feel free to use for educational purposes
Created by ShiroOni
This is a complete educational project. Feel free to fork and enhance!
Happy Studying! πβ¨