π Want to deploy to Render? See DEPLOY_TO_RENDER.md for complete deployment guide with all specific details.
β οΈ Having issues? See TROUBLESHOOTING.md for solutions to common problems.
This repository contains EcoBuddy, a full-featured energy-saving dashboard app with:
- React + Vite (Frontend)
- React Router for navigation
- Tailwind CSS (mobile-first)
- Chart.js with React Chart.js 2 for data visualization
- Express.js + PostgreSQL Backend
- User Authentication & Data Persistence
- Seeds Currency System
- Streak Tracking
- Friends & Social Features
- Real-time energy usage tracking based on completed tasks
- Weekly consumption charts
- Usage breakdown by category (heating, cooling, lighting, appliances)
- Key performance indicators (KPIs)
- Savings metrics and COβ impact
- NEW: Shows actual data only - zeros for new users
- Friends leaderboard showing completed tasks and seeds
- See friends' EcoBuddy mascots
- Track friends' streaks and progress
- NEW: No default friends - only real connections
- Active challenges with real progress tracking
- NEW: Completable challenges that award seeds
- Mark progress and complete challenges
- Earn seeds for each completion
- Track completed challenges history
- Start new challenges from available pool
- Interactive EcoBuddy mascot with transparent image
- NEW: Seeds-based economy (replaced points)
- Customizable accessories (sunglasses, top hat, crown, scarf)
- Accessories properly positioned on mascot
- NEW: Daily login streak tracking
- Level progression and XP system
- Feed and play with EcoBuddy using seeds
- Mobile-optimized bottom navigation bar
- Smooth transitions between pages
- Active route highlighting
Before starting development, run the diagnostic tool to check your environment:
npm run diagnosticThis will check:
- Node.js version
- Environment variables
- Dependencies
- Configuration files
- Install dependencies:
npm install- Run the dev server:
npm run dev- Build:
npm run build- Preview production build locally:
npm run preview- Install backend dependencies:
cd backend
npm install- Set up PostgreSQL database:
createdb energyteen- Create
.envfile inbackend/directory:
DATABASE_URL=postgresql://username:password@localhost:5432/energyteen
JWT_SECRET=your-secret-key-here
NODE_ENV=development
PORT=3001
FRONTEND_URL=http://localhost:5173- Run database migrations:
npm run db:migrate- Start backend server:
npm run devBackend will run on http://localhost:3001
- Create
.envfile in root directory:
VITE_API_URL=http://localhost:3001/api- Install dependencies:
npm install- Start frontend dev server:
npm run devFrontend will run on http://localhost:5173
Now you can signup/login and all data will be saved to the database!
- Frontend Framework: React 18
- Build Tool: Vite 5
- Routing: React Router DOM v6
- Styling: Tailwind CSS 3
- Charts: Chart.js 4 + React Chart.js 2
- Framework: Express.js
- Database: PostgreSQL
- Authentication: JWT (JSON Web Tokens)
- Password Hashing: bcrypt
- Validation: express-validator
βββ backend/ # Backend API (v1.4+)
β βββ src/
β β βββ config/
β β β βββ database.js # PostgreSQL configuration
β β β βββ migrate.js # Database migrations
β β βββ middleware/
β β β βββ auth.js # JWT authentication
β β βββ models/
β β β βββ User.js # User data model
β β βββ routes/
β β β βββ auth.js # Auth endpoints
β β β βββ user.js # User endpoints
β β βββ server.js # Express server
β βββ package.json
β βββ README.md
β
βββ src/ # Frontend
β βββ components/
β β βββ NavBottom.jsx # Bottom navigation bar
β β βββ KpiCard.jsx # Key performance indicator card
β β βββ ProgressBar.jsx # Progress bar component
β β βββ ChartLine.jsx # Line chart component
β β βββ ChartPie.jsx # Pie/doughnut chart component
β βββ context/
β β βββ AuthContext.jsx # Authentication context
β βββ pages/
β β βββ Login.jsx # Login page
β β βββ Signup.jsx # Signup page
β β βββ Home.jsx # Home dashboard
β β βββ Analytics.jsx # Analytics page
β β βββ Leaderboard.jsx # Rankings page
β β βββ Tasks.jsx # Challenges page
β β βββ Profile.jsx # User profile page
β βββ services/
β β βββ api.js # API service layer
β βββ App.jsx # Main app with routing
β βββ main.jsx # App entry point
β βββ index.css # Global styles
β
βββ BACKEND_DEPLOYMENT.md # Backend deployment guide
βββ render.yaml # Render deployment config
βββ package.json
β User Authentication
- Secure signup and login with JWT
- Password hashing with bcrypt
- Session management
β Data Persistence
- PostgreSQL database
- User profiles saved permanently
- Progress tracking across sessions
β Real Backend API
- RESTful API endpoints
- User progress updates
- Challenge management
- Leaderboard functionality
- Energy usage tracking
β Production Ready
- Deployable to Render
- Environment variable configuration
- CORS protection
- Input validation
Design source: Energy-Saving Teen App Prototype.make (in repo root)
- Push notifications for challenges
- Social features (friends, sharing)
- Data export and reporting
- Advanced analytics and insights
π Complete Guide: DEPLOY_TO_RENDER.md β START HERE for all deployment details
This comprehensive guide includes:
- β Two deployment options (Blueprint & Manual with exact steps)
- β All environment variables with exact values
- β Database setup and migration instructions
- β Complete troubleshooting section
- β Cost breakdown and free tier information
- β Verification procedures
π― Quick Reference: DEPLOY_QUICK_REFERENCE.md β For experienced users
π All Guides: DEPLOYMENT_GUIDE_INDEX.md β Navigation to all deployment docs
The application requires full-stack deployment:
- Sign in to Render
- New + β Blueprint
- Connect repository (
gang1103app/figmafigmaboi) - Select branch
1.4 - Configure environment variables (see complete guide)
- Run database migration via backend Shell
Time: 15-30 minutes | Cost: Free tier available
See DEPLOY_TO_RENDER.md for complete step-by-step instructions with all specific details.
βββββββββββββββββββ
β Frontend β Static Site (Vite + React)
β Render β https://your-app.onrender.com
ββββββββββ¬βββββββββ
β
β HTTPS API Calls
βΌ
βββββββββββββββββββ
β Backend API β Node.js + Express
β Render β https://your-api.onrender.com
ββββββββββ¬βββββββββ
β
β PostgreSQL Connection
βΌ
βββββββββββββββββββ
β Database β PostgreSQL
β Render β Managed Database
βββββββββββββββββββ
β οΈ Backend required - App needs API to functionβ οΈ Database required - PostgreSQL for data persistenceβ οΈ Environment variables required - Set API URLs- β
Automatic deployments on git push to branch
1.4 - β Free tier available on Render (with limitations)
- β Secure authentication with JWT tokens
- β Data persistence across sessions
This is a demonstration project for the Energy Saving Teen app. For contributions or questions, please open an issue or pull request.
Private repository - All rights reserved