How sarishtshreshth0/ecommerce works
Project Type & Purpose
• This is a full‑stack Flask e‑commerce web application with user authentication, profile management, contact/ticket features, and email OTP verification. It uses MongoDB for persistence and Gmail SMTP for email services.
File Structure Analysis
• Top-level:
• app.py – main Flask application and route definitions
• requirements.txt, Procfile – dependencies & deployment hints
• templates/ – Jinja2 HTML views (login, signup, product list, cart, profile, contact, OTP, reset password, etc.)
• No separate “static” folder implies CSS/JS may be inlined or served elsewhere; templates drive the UI.
Key Technologies & Patterns
• Flask (request routing, session management via Flask-Session)
• MongoDB (via PyMongo) with three collections: db_user, db_otp, db_contact
• Flask‑Mail for SMTP email
• MVC‑style:
• Views = HTML templates
• Controllers = Flask route functions in app.py
• Model = MongoDB collections
Main Components for the Flowchart
A. User Browser (UI)
B. Flask Application Server
– Route Handlers (login, signup, verify, contact, ticket raise, settings)
– OTP & Email Functions (send_otp, send_mail)
C. MongoDB
– db_user, db_otp, db_contact
D. External Email Service
– Gmail SMTP
Component Interactions & Data Flows
1. User → HTTP Request → Flask Route
2. Flask Route ↔ MongoDB (read/write user, OTP, contact data)
3. OTP route → send_otp() → store OTP in db_otp → send_mail() → Gmail SMTP → User Email
4. Contact form route → store message in db_contact → send_mail() (optional)
5. Flask → HTTP Response → User Browser
Architectural Patterns & Design Principles
• Stateless HTTP with session cookies stored by Flask-Session
• Separation of concerns: routing, business logic, data access
• Use environment variables for secrets (not hard‑coded)
• Simple MVC in a monolithic service