โจ Key Featuress
- ๐ Comprehensive Carbon Tracking: Log daily activities across Travel, Food, Energy, and Shopping with region-specific (India & Global) emission factors.
- ๐ค AI Sustainability Tips: Integrates with Anthropic's Claude AI to generate highly personalized, actionable advice based on your recent activity history.
- ๐ Gamification & Leaderboards: Earn EcoPoints, maintain daily Streaks, climb global rankings, and unlock eco-tiers (Seedling to Eco Champion).
- ๐ Advanced Analytics: Visualize your footprint with interactive Recharts (Bar, Pie, Trend lines) and compare your usage against national and global benchmarks.
- โก Blazing Fast Performance: Next.js App Router, dynamic imports for heavy charts, React memoization, and strict API AbortControllers ensure a seamless, app-like experience.
- ๐จ Premium Dark UI: A stunning, fully responsive glassmorphic dark-mode interface built with Tailwind CSS and Framer Motion animations.
๐ ๏ธ Tech Stack
Frontend (Client)
- Framework: Next.js 14 (App Router)
- Styling: Tailwind CSS, Shadcn/UI, Framer Motion
- Data Viz: Recharts
- Testing: Jest, React Testing Library
Backend (API)
- Runtime: Node.js, Express.js
- Database: MongoDB (Mongoose)
- Authentication: JWT, bcryptjs
- AI Integration: Anthropic API (Claude 3.5 Sonnet)
- Testing: Supertest, Jest
๐ Project Architecture
EcoStep/
โโโ ecostep-frontend/ # Next.js Application
โ โโโ app/ # Route definitions & Pages (Dashboard, Leaderboard, etc.)
โ โโโ components/ # Reusable UI components & Layouts
โ โโโ lib/ # API helpers, Carbon Factors
โ โโโ __tests__/ # Frontend Unit & Component Tests
โ
โโโ ecostep-backend/ # Node.js/Express API
โโโ controllers/ # Route logic (Auth, Activities, Insights, Users)
โโโ models/ # Mongoose Schemas (User, Activity)
โโโ routes/ # API Endpoints
โโโ lib/ # Shared Carbon calculation logic
โโโ __tests__/ # API Integration Tests
๐ Quick Start (Local Development)
Prerequisites
- Node.js (v18+)
- MongoDB Atlas cluster (or local MongoDB instance)
- Anthropic API Key
1. Clone the repository
git clone https://github.com/adii0018/EcoStep.git
cd EcoStep
2. Setup Backend
cd ecostep-backend
npm install
Create a .env file in the ecostep-backend directory:
PORT=5000
MONGODB_URI=mongodb+srv://<your_username>:<your_password>@cluster0.mongodb.net/ecostep?retryWrites=true&w=majority
JWT_SECRET=your_super_secret_jwt_key
JWT_EXPIRES_IN=7d
ANTHROPIC_API_KEY=sk-ant-api03-...
CLIENT_URL=http://localhost:3000
Start the backend server:
npm run dev
3. Setup Frontend
Open a new terminal window:
cd ecostep-frontend
npm install
Create a .env.local file in the ecostep-frontend directory:
NEXT_PUBLIC_API_URL=http://localhost:5000/api
Start the frontend development server:
npm run dev
Your app will be running at http://localhost:3000.
๐งช Testing
EcoStep is built with reliability in mind, featuring comprehensive test suites across both stacks.
Frontend Tests (Jest + React Testing Library)
Tests cover component rendering, calculation edge cases, and API mocking.
cd ecostep-frontend
npm run test # Run all tests
npm run test:coverage # Generate coverage report
Backend Tests (Supertest)
Tests cover route protection, data validation, and database operations.
cd ecostep-backend
npm run test
For more detailed testing instructions and troubleshooting (e.g., PowerShell execution policies), see TESTING.md.
๐ Emission Factors Reference
EcoStep calculations are localized for improved accuracy (including Indian-specific grid parameters).
| Category | Type | Factor | Unit |
|---|---|---|---|
| โก Energy | Indian Grid Electricity | 0.72 |
kg COโ/kWh |
| โก Energy | LPG cooking | 2.9 |
kg COโ/kg |
| ๐ Travel | Auto-rickshaw (India) | 0.05 |
kg COโ/km |
| ๐ Travel | Car (petrol) | 0.18 |
kg COโ/km |
| ๐ฝ๏ธ Food | Beef meal | 6.0 |
kg COโ/meal |
| ๐ฝ๏ธ Food | Vegan meal | 0.5 |
kg COโ/meal |
A complete list is maintained within lib/carbonFactors.js on both the frontend and backend.
๐ License
This project is licensed under the MIT License.
Built with โค๏ธ to save the ๐.
Log in or sign up for Devpost to join the conversation.