How hamzaavvan/library-management-system works
Project type and purpose
• This is a full‑stack web application built in Python/Flask for library management (users, books, admin).
• It follows an MVC/DAO pattern:
– Models (data access) live under Models/
– Controllers (business logic) live under Controllers/
– Views (HTML) live under templates/ with Jinja2 rendering
File structure
Top‑level components:
• app.py – Flask entry point, registers routes/blueprints
• routes/ – Defines HTTP endpoints per domain (admin, book, user)
• Controllers/ – Implements managers: AdminManager, BookManager, UserManager
• App/ – Domain entities or service classes (Actor.py, Books.py, etc.)
• Models/ – DAO layer: generic DAO.py, DB.py, AdminDAO.py, BookDAO.py, UserDAO.py
• static/ & templates/ – Frontend assets and Jinja2 templates
• db/ – SQL schema (lms.sql)
• requirements.txt – Flask, MySQL connector, and other dependencies
README for additional insights
• Confirms Flask + MySQL service
• No external microservices—entire stack lives in one process + a MySQL database
• Dev workflow: set environment variables, flask run
Main components
A. Client (Browser)
B. Flask Application Server
1. HTTP Router (Flask’s routes/)
2. Controller Layer (Controllers/)
3. Domain/Service Layer (App/)
4. Data Access Layer (Models/ + db/ schema)
5. Templating Engine (Jinja2 in templates/)
6. Static File Server (static/)
C. MySQL Database (external service)
Relationships and data flows
• Browser → HTTP Request → Flask Router (routes/)
• Router extracts URL, dispatches to corresponding Controller
• Controller calls Domain/Service classes in App/ → applies business rules
• Service classes invoke DAO methods in Models/ → run SQL against MySQL
• DAO returns records → back up through Service → Controller
• Controller passes data to Jinja2 Templates → rendered HTML
• Flask returns HTML/JSON → Browser
• Static assets (CSS/JS/Images) served directly by Flask’s static handler
Architectural patterns & design principles
• MVC with clear separation of concerns
• DAO pattern for database interaction
• Layered architecture: Presentation → Business → Data Access → Persistence
• Blueprints or modular routing (routes/) for domain separation