📚✨ Static Public Pages
These HTML files form the public-facing pages of the digital library. They include navigation, styling, and references to shared assets.
This is the landing page.
- 🧭 Responsive navbar (Home, About, Pricing, Contact, User Dashboard)
- 🎨 Loads Bootstrap, Google Fonts, Font Awesome
- 🎞️ Hero section, features, footer
- ⚙️ Scripts:
animations.js,simple-books.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Digital Library – Home</title>
<link rel="stylesheet" href="/static/css/main.css">
</head>
<body>
<nav>…</nav>
<section class="hero">…</section>
<footer>…</footer>
<script src="/static/js/animations.js"></script>
<script src="/static/js/simple-books.js"></script>
</body>
</html>- 🚀 Particle animations (
particles.js) - 🪪 Team & mission section
- 🟦 Uses
about.css&about.js
- 📦 Subscription tiers: Free & Premium
- 🔄 Billing cycle toggle
- 🔗 Redirects via
dashboard.js
- 📮 Contact form: Name, Email, Message
- ✔️ Validation via
contact.js - 📤 Submits to
/api/contact
🔐 Public Authentication Pages
- 📧 Email + Password login
- 🔗 Register / Forgot Password links
- ⚙️ Uses
auth.js→/api/auth/login
- 📝 Name, Email, Password
- 💪 Password strength meter
- 📤 Sends data via
auth.js
- 2-step reset: Email → Token + New Password
- 🔄 Controlled by
user-forgot-password.js
⚙️ JavaScript Modules
- Scroll animations
- Parallax & particle effects
- Loads stats → displays counters/cards
- Form validation
- POST to
/api/contact
- Login/Register utility
- Token storage, redirects
- Multi-step password recovery handler
- Fetch/update user details
- Borrowing stats → charts/tables
- Tab logic, theme switch, charts
- Fetch & render book list
- Admin CRUD for books
- Admin user table (search, pagination)
- Shared admin API & notifications
- Admin login handler
- Admin registration
- Admin password reset
- Loads system-wide stats
- Ban/unban, user edits
- Custom 404/500 routing
🖋️ Server-Side Templates (Jinja2)
- Friendly messages for HTTP errors
- User dashboard shell
- Profile editing page
- Filterable book list
- Login, signup, forgot password
- Dashboard, book management, user management
🐍 Backend Application
- Flask app setup
- JWT auth
- API routes for users, books, admin, borrowings
- Error handlers
@app.route('/api/auth/login', methods=['POST'])
def login():
return jsonify({'status':'success','data':{'access_token':access,'refresh_token':refresh}})- MySQL pooling
- Auto-create DB
get_db()helper
🗃️ Database Schema
erDiagram
users {
int id PK
string name
string email
string password
bool is_admin
bool is_subscriber
string status
datetime created_at
}
books {
int id PK
string title
string author
string category
decimal price
int rating
int total_copies
int available_copies
text description
datetime created_at
}
borrowings {
int id PK
int user_id FK
int book_id FK
datetime borrowed_at
datetime due_at
datetime returned_at
string status
}
password_resets {
int id PK
int user_id FK
string token
datetime expires_at
bool used
datetime created_at
}
refresh_tokens {
int id PK
int user_id FK
string token
datetime created_at
}
🧰 Tech Stack
- Python 3
- Flask 2
- Jinja2
- PyJWT
- passlib
- python-dotenv
- MySQL / MariaDB
- mysql-connector-python
- HTML5, CSS3, JS (ES6+)
- Bootstrap 5
- Font Awesome 6
- Custom JS modules
- Mermaid diagrams
- venv
- Flask dev server