EcoTrack AI is a full-stack web application designed to help individuals track, analyze, and offset their carbon footprint. Utilizing modern web design, interactive charts, and Google's Gemini API, the platform provides users with personalized eco-friendly tips, weekly action plans, gamified challenges, and downloadable PDF carbon audit reports.
- User Authentication: Secure signup and login with hashed password storage in SQLite.
- Interactive Footprint Wizard: A multi-step carbon calculator covering transport, utilities, food habits, and recycling with live real-time emissions projections.
- Dynamic Dashboard: Highlights totals, offsets, and category trends via Chart.js, featuring checking off daily eco challenges and tracking level progression.
- AI-Powered Recommendations: Integrates Google Gemini API to analyze carbon footprints and deliver personalized impact summaries, sustainability tips, and a 7-day action roadmap. Includes a local rule-based fallback if the API is offline.
- Gamification & Milestones: Earn points (XP), unlock levels, and earn badges (e.g. Eco Novice, Carbon Reducer, Challenge Champion).
- Reports & Exports: Visual history charts with multi-category toggle filters, exporting logs as CSV, and high-fidelity client-side PDF document downloads using
html2pdf.js. - Leaderboard & Rankings: A global leaderboard displaying ranked users based on their percentage carbon footprint reduction, incentivizing ecological action.
- Admin Console: Monitored view showing platform statistics (registered users, average platform carbon score) and a user directory leaderboard.
- Dual Theme UI: Sleek, glassmorphic layout supporting a Deep Forest Dark Mode (default) and Fresh Mint Light Mode with ambient gradient animations.
- Frontend: HTML5, CSS3 (Vanilla Custom Properties & Glassmorphism), JavaScript (ES6, AJAX, Chart.js, html2pdf.js)
- Backend: Python (Flask)
- Database: SQLite (SQLAlchemy ORM)
- AI Engine: Google Gemini API (
gemini-1.5-flashmodel REST API calls)
promptwar 3/
├── app.py # Main Flask controller & endpoint routes
├── models.py # SQLAlchemy Database schemas & user badges logic
├── gemini_helper.py # Gemini API client & intelligent local fallbacks
├── requirements.txt # PIP dependencies list
├── render.yaml # Render infrastructure blueprint
├── wsgi.py # production WSGI runner
├── README.md # User guide & local installation instructions
├── static/
│ ├── css/
│ │ └── style.css # Custom design system with light/dark variables
│ └── js/
│ ├── main.js # AJAX requests, theme switching, UI interactions
│ └── calculator.js # Form wizard validation & realtime score estimation
└── templates/
├── base.html # Core HTML frame & navbar metrics indicators
├── index.html # Startup SaaS style landing page
├── login.html # Authentication entry page
├── signup.html # User signup registration page
├── dashboard.html # User analytics, daily challenges & AI advice tabs
├── calculator.html # Multi-step wizard form & submit loader page
├── reports.html # Multi-variable charts, CSV downloads & PDF generator
├── leaderboard.html # Ranked carbon footprint reduction community board
├── profile.html # Profile settings, SVG avatars & account data reset
└── admin.html # Global platform insights & stats
- Python 3.8 or higher installed on your machine.
- Pip (Python Package Installer).
Navigate into the project directory:
cd "promptwar 3"Install the required packages:
pip install -r requirements.txtGet a free Gemini API key from Google AI Studio. Set the key in your terminal session:
- Windows PowerShell:
$env:GEMINI_API_KEY="your-api-key-here"
- macOS/Linux:
export GEMINI_API_KEY="your-api-key-here"
Note: If the key is not set or the connection fails, EcoTrack AI automatically utilizes an intelligent, local rule-based system to formulate recommendations, ensuring no breaks in the user experience.
Launch the Flask development server:
python app.pyOpen http://127.0.0.1:5000 in your web browser.
EcoTrack AI includes a comprehensive test suite covering models, route validations, API mock fallbacks, and gamification calculations.
Run the entire unittest suite locally using:
python -m unittest discover -s testsFor more details on automated test cases, manual testing procedures, and checklist instructions, please refer to the TESTING.md guide.
- Register a new account via the Sign Up page.
- Complete your first calculation. The app will automatically guide you through.
To examine the Platform Admin Console:
- Go to the Login page.
- Enter the default administrator credentials:
- Username/Email:
admin - Password:
admin123
- Username/Email:
- A "Admin Panel" link will appear in gold in the navigation bar. Click it to view global analytics and the user ranking leaderboard.
Note: Any new account registered with a username/email starting with admin is automatically elevated to administrator privileges.
This project includes a render.yaml configuration for immediate deployment on Render:
- Push this code to your GitHub repository.
- Link your GitHub account to Render.
- Deploy a new service by selecting Blueprints and pointing to this repository.
- Render will automatically parse the
render.yamlfile, build the environment, generate a secureSECRET_KEY, and deploy the web service using Gunicorn. - Make sure to define the
GEMINI_API_KEYenvironment variable in your Render dashboard under the service's Environment settings.




