How tdk-bwcb/campus-lost-found-market works
Project Type and Purpose
• This is a full-stack Flask web application ("Campus Hub") that provides two main user-facing features:
• Lost & Found item submission/tracking
• Peer-to-peer Marketplace listings (buy/sell/trade)
• Key characteristics from README and file tree:
• Python/Flask backend with Jinja2 templates
• SQLite for persistent storage
• Flask-Login/Flask-Session for authentication & sessions
• Flask-Mail (Gmail SMTP) for email verification/alerts
• Blueprint-based modular routing (auth, lost_and_found, marketplace)
File Structure Analysis
• Top-level application entry: Main.py
• extensions.py and models.py initialize and register core services (DB, mail, login, session)
• blueprints/…: three distinct route modules (auth, lost_and_found, marketplace)
• static/ & templates/: front-end assets and view templates (organized per blueprint)
• flask_session/: server-side session store (file system backend)
• reset_db.py: utility to bootstrap/reset the SQLite schema
Core Components
a. Frontend (Client)
• Browser → HTTP(S) requests
b. Web Server Layer
• (Optional) Nginx/Apache reverse proxy or Flask built-in dev server
c. Flask Application
• Application Factory (Main.py + extensions.py)
• Blueprint Modules:
– Auth Blueprint (routes: register, login, profile)
– Lost & Found Blueprint (dashboard, report, detail, edit)
– Marketplace Blueprint (dashboard, create, detail, edit)
• Template Engine (Jinja2) renders UI with static assets (Tailwind-ready)
d. Business Logic & Persistence
• models.py: ORM-like definitions interacting with SQLite DB
• Flask-Login + Flask-Session: session & user state management (filesystem store)
e. External Services
• Gmail SMTP (Flask-Mail) for email verification & alerts
Interactions & Data Flows
• Client ↔ Web Server: HTTP(S) requests/responses
• Web Server → Flask App: routes mapped via blueprints
• Flask App → SQLite DB: CRUD operations via models.py
• Flask App → SMTP Server: transactional emails (registration, notifications)
• Flask App ↔ Session Store (flask_session folder): session read/write
• Flask App renders templates, serves static files
Architectural Patterns & Design Principles
• MVC (Model–View–Controller) separation:
• Controllers = Flask blueprints
• Models = models.py + SQLite
• Views = Jinja2 templates + static assets
• Modularization by feature (three blueprints)
• Explicit application factory pattern (central init in Main.py/extensions.py)
• Single-schema SQLite for simplicity (monolithic persistence)
• Clear component labels: Browser, Nginx/Flask Server, Flask Application (with sub-components), SQLite DB, SMTP Service
• Green = User/Client
• Blue = Application core (blueprints & extensions)
• Orange = Data stores (DB, session files)
• Purple = External services (SMTP)