Study Materials Store
A full-stack web application for selling and distributing study materials with secure password-protected downloads.
π Features
- π User authentication (signup/login)
- π Admin dashboard for managing content
- π Shopping cart functionality
- π³ Checkout system with GST calculation
- π Automatic PDF bill generation
- π Secure one-time password for downloads
- π Subject-wise material organization
- π Search and filter capabilities
- π Easy server management with batch scripts
π οΈ Tech Stack
- Frontend: HTML, CSS, JavaScript
- Backend: Node.js, Express.js
- File Handling: Multer
- PDF Generation: PDFKit
- Security: Crypto for OTP generation
π¦ Prerequisites
- Node.js (v14+ recommended)
- npm (comes with Node.js)
- Python (for serving frontend)
- Web browser with JavaScript enabled
β‘ Quick Start
-
Clone the repository
git clone <repository-url> cd study-materials-app
-
Set up backend
cd backend npm install npm startServer runs at: http://localhost:3000
-
Launch frontend
Using VS Code:- Install "Live Server" extension
- Right-click
frontend/index.html - Select "Open with Live Server"
Or using Python's HTTP server:
cd frontend python -m http.server 5500Access at: http://localhost:5500
-
Automated Server Management
- Start both servers using the batch script:
start-servers.bat
- Stop both servers using the batch script:
stop-servers.bat
- Start both servers using the batch script:
π Project Structure
study-materials-app/
βββ backend/
β βββ server.js # Express server & API endpoints
β βββ admin.json # Admin credentials
β βββ users.json # User data
β βββ files-config.json # File mapping configuration
β βββ subjects.json # Subject definitions
β βββ bills/ # Generated PDF bills
β βββ files/ # Protected study materials
βββ frontend/
β βββ index.html # Main store page
β βββ admin.html # Admin dashboard
β βββ login.html # User login
β βββ signup.html # User registration
β βββ style.css # Main styles
β βββ signup.css # Auth pages styles
β βββ app.js # Core application logic
β βββ items.js # Study materials data
βββ start-servers.bat # Script to start servers
βββ stop-servers.bat # Script to stop servers
π Authentication
User Login
- Email and password based
- Purchase history tracking
- Password change functionality
Admin Login
- Default credentials:
- Email: admin@study.com
- Password: qwerty
- Access to user management
- Material upload capabilities
πΌ Admin Features
-
User Management
- View all users
- Track user purchases
- View purchase history
-
Content Management
- Add/remove study materials
- Set prices and descriptions
- Upload protected PDF files
- Manage subject categories
ποΈ Shopping Features
-
Cart System
- Add/remove items
- Real-time price calculation
- GST (18%) included
-
Checkout Process
- Automatic bill generation
- Unique download passwords
- Purchase history tracking
-
Download Security
- One-time passwords
- Timed download links
- Secure file access
π Security Features
- Password-protected downloads
- One-time use passwords
- Secure file storage
- Token-based downloads
- Admin access control
π οΈ Configuration
Admin Settings
Edit backend/admin.json:
{
"email": "admin@study.com",
"password": "your-secure-password"
}File Storage
Protected files location: backend/files
- Supported format: All(.pdf recommended)
- Auto-configured on upload
π Development Notes
-
Adding New Features
- Backend: Add routes in
server.js - Frontend: Extend
app.jsfunctionality - Styles: Modify appropriate CSS files
- Backend: Add routes in
-
Security Considerations
- Use HTTPS in production
- Implement proper password hashing
- Add rate limiting for downloads
π Production Deployment
-
Backend Preparation
- Set up proper database
- Configure environment variables
- Implement proper security measures
-
Frontend Optimization
- Minify JavaScript and CSS
- Optimize images
- Enable caching
π€ Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a pull request
π License
This project is licensed under the ISC License
Full Changelog: v1.0...v2.0