A comprehensive platform for tracking product lifecycles with sustainability insights, powered by AI analysis and multi-platform integration.
- 🌱 Product Lifecycle Tracking - Track your products from purchase to disposal
- 🤖 AI-Powered Analysis - OpenAI integration for product analysis and lifecycle insights
- 📱 Telegram Bot Integration - Report lifecycle events via Telegram
- 🌐 Chrome Extension - Track products directly from web pages
- 📊 Rolling Summaries - AI-generated summaries every 50 lifecycle steps
- 🔐 SingPass Authentication - Singapore government authentication
- ♻️ Sustainability Scoring - EcoScore tracking and recommendations
- 📈 Analytics Dashboard - Comprehensive insights and reporting
- Frontend: Next.js 14 with TypeScript, TailwindCSS, Shadcn/ui
- Backend: Next.js API routes with Prisma ORM
- Database: PostgreSQL (Neon)
- Authentication: Stack Auth + SingPass OAuth
- AI Integration: OpenAI GPT-4o-mini, Gemini API
- Extensions: Chrome Extension, Telegram Bot (Python)
- Node.js 18+ and npm
- PostgreSQL database (Neon recommended)
- OpenAI API key
- Python 3.8+ (for Telegram bot)
git clone <repository-url>
cd ecotrack
npm installcp .env.example .envFill in your environment variables in .env:
DATABASE_URL- PostgreSQL connection stringOPENAI_API_KEY- OpenAI API key for AI featuresNEXTAUTH_URL- Your app URL (http://localhost:3080)NEXTAUTH_SECRET- Random secret key (32+ characters)
TELEGRAM_BOT_TOKEN- For Telegram integrationTELEGRAM_BOT_SECRET- Webhook authenticationSINGPASS_CLIENT_ID- For SingPass authenticationSINGPASS_CLIENT_SECRET- SingPass client secretGEMINI_API_KEY- Google Gemini API key
# Generate Prisma client
npx prisma generate
# Run database migrations
npx prisma db push
# (Optional) Seed sample data
npx prisma db seednpm run devThe app will be available at http://localhost:3080
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked" and select the
chrome-extensionfolder - The extension will appear in your extensions list
- Click the extension icon on any product page
- The extension will analyze the page and allow you to track the product
- Lifecycle events can be viewed in the web dashboard
cd telegram-bot
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Create a bot with @BotFather
- Add
TELEGRAM_BOT_TOKENto your.env - Set
TELEGRAM_BOT_SECRETto a secure random string - Update
LIFE_APP_API_URLin.envto your API URL
cd telegram-bot
source venv/bin/activate
python main.pyUse the web dashboard to link your Telegram account, then start using the bot:
- Send photos of products with descriptions
- Use quick action buttons for common events
- Type
/helpfor available commands
POST /api/products/track- Track a new productGET /api/products/my-products- Get user's tracked productsPOST /api/products/analyze- Analyze product from contentGET /api/products/recommend- Get product recommendations
POST /api/lifecycle/telegram-event- Process Telegram bot eventsGET /api/products/[id]/lifecycle/summary- Get AI lifecycle summaryPOST /api/lifecycle/generate-summary- Generate new summary
POST /api/auth/login- User loginGET /api/auth/callback- SingPass OAuth callbackPOST /api/telegram/link- Link Telegram account
Key models:
- User - User accounts with SingPass and Telegram linking
- Product - Product catalog with sustainability metrics
- ProductTracking - User-product tracking relationships
- ProductLifecycleStep - Individual lifecycle events
- ProductLifecycleSummary - AI-generated summaries every 50 steps
# Development server
npm run dev
# Build for production
npm run build
# Database operations
npx prisma studio # Database GUI
npx prisma db push # Push schema changes
npx prisma generate # Generate client
npx prisma db seed # Seed sample data
# AI Summary generation
npm run generate-summaries # Generate summaries for existing dataDATABASE_URL- Primary database connectionDATABASE_URL_UNPOOLED- Direct connection without pooling
NEXTAUTH_URL- Application URLNEXTAUTH_SECRET- NextAuth secret keySINGPASS_CLIENT_ID- SingPass OAuth client IDSINGPASS_CLIENT_SECRET- SingPass OAuth secretSINGPASS_ENVIRONMENT- sandbox/production
OPENAI_API_KEY- OpenAI API key (required)GEMINI_API_KEY- Google Gemini API key (optional)
TELEGRAM_BOT_TOKEN- Bot token from @BotFatherTELEGRAM_BOT_SECRET- Security token for webhooksLIFE_APP_API_URL- API base URL for bot communication
NEXT_PUBLIC_STACK_PROJECT_ID- Stack Auth project IDNEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY- Public client keySTACK_SECRET_SERVER_KEY- Server secret key
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Ensure
NEXTAUTH_URLpoints to your production URL - Deploy
The app is configured for Neon PostgreSQL. Update connection strings in your environment variables for production.
- Build the extension for production
- Upload to Chrome Web Store
- Update
CHROME_EXTENSION_IDin production environment
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and ensure builds pass
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the documentation
- Search existing issues
- Create a new issue with detailed description
Built with ❤️ using Next.js, TypeScript, and modern web technologies.