How bahaamohamed98/eco-dispose works
Project Type and Purpose
• Eco-Dispose is a full-stack web application for e-waste management and recycling.
• Frontend: Vue.js single-page application (SPA) built with Vite.
• Backend: Flask REST API serving device evaluation, user authentication, and offer management.
• Data persistence via a relational database (SQLAlchemy models in backend/app/models.py).
• Users submit devices via web UI, track status, and admins review submissions.
File Structure
• Top-level directories:
• frontend/ – Vue.js SPA code, components, views, router, Vuex stores.
• backend/ – Flask API server, .env configuration, app package (auth.py, devices.py, models.py, util.py, config.py).
• assets/ – project-level images and preview screenshots.
• Key files:
• backend/app.py – entry point for Flask application.
• backend/requirements.txt – Python dependencies.
• frontend/src/main.js – Vue app bootstrap.
• frontend/src/router/routes.js – client-side routing.
• frontend/src/store/* – Vuex modules for user, devices, toasts, API interactions.
• Patterns:
• Client–Server separation (Vue.js UI ↔ Flask REST API).
• RESTful endpoints for auth and device workflows (see docs/api/auth.md and devices.md).
• MVC-like structure in Flask (views/controllers in auth.py & devices.py, models in models.py).
README for Additional Insights
• Describes user flows: registration, login, device upload with photos, status tracking, admin dashboard.
• Indicates environment-driven configuration for database, secret keys, file storage.
Main Components
a. Frontend (Vue.js SPA)
• Browser clients render App.vue, navigate via router, manage state in Vuex stores (userStore, deviceStore).
• Static assets (photos, CSS) served from frontend/public/assets.
b. Backend (Flask API)
• app.py initializes Flask, loads config, registers auth and device blueprints.
• Controllers handle HTTP requests, invoke models and utility functions (util.py).
c. Database
• Relational database (e.g., PostgreSQL or SQLite) accessed via SQLAlchemy ORM.
• Core entities: Users, Devices, Offers, StatusHistory.
d. File Storage
• Local or cloud‐based storage for uploaded images (configured via .env).
e. External Services (if any)
• Email/SMS for notifications (possible future extension, not explicit in code).
f. Admin Dashboard
• A protected SPA view accessing admin endpoints for device evaluation and offer management.
Relationships and Data Flows
• User’s browser → HTTP(S) → Frontend SPA
• Frontend SPA dispatches REST calls to Flask API (Auth, Devices, Offers endpoints).
• Flask API ↔ Database for CRUD operations on Users and Devices.
• Flask API ↔ File Storage for image uploads and retrieval.
• Admin user uses SPA admin views → API → Database/Storage.
Architectural Patterns and Principles
• Layered architecture: Presentation (SPA) → Application (Flask controllers) → Persistence (ORM + DB).
• RESTful design: clearly separated endpoints in backend/app/auth.py and devices.py.
• State management on client using Vuex (separation of UI and business logic).
• Configuration-driven deployment (via .env).
Essential Elements
• Labels on each component (e.g., “Vue.js SPA”, “Flask Auth API”, “Device Service”).
• Annotations for security (JWT tokens in headers), file upload workflow, and admin-only endpoints.