A full-stack web application for tracking and managing environmental waste, built with React, Express, and PostgreSQL. Users can report waste, track cleanup activities, and earn rewards for environmental contributions.
- Frontend: https://ecotrack-frontend-tzew.onrender.com
- Backend API: https://ecotrack-backend-1.onrender.com
- Real-time waste reporting with GPS coordinates
- Google Maps integration for location selection
- Visual markers for different waste types and severity levels
- Get directions to reported waste locations
- Photo upload for before/after cleanup verification
- Categorize waste by type (plastic, organic, electronic, etc.)
- Set severity levels (low, medium, high, critical)
- Contact information for authorities
- View cleanup activities from other users
- Like and comment on cleanup posts
- Before/after image comparisons
- Points and rewards system
- Secure authentication with JWT tokens
- User profiles with cleanup statistics
- Leaderboard for top contributors
- Reward system for environmental actions
- Personal cleanup statistics
- Community impact metrics
- Cleanup verification rates
- Points earned tracking
- React 18 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- Radix UI for accessible components
- React Router for navigation
- Google Maps API for location services
- Node.js with Express
- TypeScript for type safety
- PostgreSQL database
- JWT for authentication
- CORS enabled for cross-origin requests
- bcryptjs for password hashing
- Render for hosting
- Supabase for PostgreSQL database**
- GitHub for version control
EcoTrack-Backend-main/
βββ client/ # React frontend (development)
βββ server/ # Express backend (development)
βββ shared/ # Shared types and interfaces
βββ ecotrack-frontend/ # Production frontend
βββ ecotrack-backend/ # Production backend
βββ dist/ # Built files
βββ docs/ # Documentation
- Node.js 18+
- PostgreSQL database
- Google Maps API key
-
Clone the repository
git clone https://github.com/HarshYadv5554/EcoTrack-Backend.git cd EcoTrack-Backend -
Install dependencies
npm install
-
Set up environment variables
# Create .env file in root directory DATABASE_URL=postgresql://username:password@localhost:5432/ecotrack JWT_SECRET=your-super-secret-jwt-key CORS_ORIGINS=http://localhost:5173,http://localhost:5174 FRONTEND_URL=http://localhost:5173 -
Start development servers
# Start both frontend and backend npm run dev:full # Or start individually npm run dev # Frontend only npm run dev:server # Backend only
-
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
- Connect your GitHub repository to Render
- Create a new Static Site
- Set build command:
npm install && npm run build - Set publish directory:
dist - Add environment variables:
VITE_API_BASE_URL=https://your-backend-url.onrender.com VITE_GOOGLE_MAPS_API_KEY=your-google-maps-api-key
- Create a new Web Service
- Set build command:
npm install && npm run build - Set start command:
npm start - Add environment variables:
DATABASE_URL=your-supabase-postgresql-url JWT_SECRET=your-secure-jwt-secret NODE_ENV=production CORS_ORIGINS=https://your-frontend-url.onrender.com FRONTEND_URL_PROD=https://your-frontend-url.onrender.com BACKEND_URL_PROD=https://your-backend-url.onrender.com
id,email,name,password_hashphone,location,avatar_urlpoints,created_at,updated_at
id,user_id,location(lat/lng),addresswaste_type,severity,descriptionimages,contact_name,contact_phonestatus,reported_at
id,user_id,waste_report_idwaste_type,location,descriptionbefore_image,after_image,verification_imagepoints_earned,cleaned_at
activity_commentsfor user commentsuser_likesfor activity likes
POST /auth/register- User registrationPOST /auth/login- User loginGET /auth/profile- Get user profilePUT /auth/profile- Update user profile
GET /reports- Get all reportsGET /reports/my- Get user's reportsPOST /reports- Create new reportPUT /reports/:id/status- Update report status
GET /cleanup-activities- Get feed activitiesPOST /cleanup-activities- Create cleanup activityGET /cleanup-activities/my- Get user's activitiesPOST /cleanup-activities/:id/like- Like activityGET /feed/stats- Get feed statistics
GET /cleanup-activities/:id/comments- Get commentsPOST /cleanup-activities/:id/comments- Add commentDELETE /comments/:id- Delete comment
DATABASE_URL=postgresql://username:password@host:port/database
JWT_SECRET=your-super-secret-jwt-key
NODE_ENV=production
PORT=3000
CORS_ORIGINS=https://your-frontend-url.onrender.com
FRONTEND_URL_PROD=https://your-frontend-url.onrender.com
BACKEND_URL_PROD=https://your-backend-url.onrender.comVITE_API_BASE_URL=https://your-backend-url.onrender.com
VITE_GOOGLE_MAPS_API_KEY=your-google-maps-api-key
VITE_APP_NAME=EcoTrack
VITE_APP_VERSION=1.0.0# Run tests
npm test
# Type checking
npm run typecheck
# Linting
npm run lintThe application is fully responsive and works on:
- Desktop browsers
- Mobile browsers
- Tablet devices
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Maps API for location services
- Radix UI for accessible components
- Tailwind CSS for styling
- Render for hosting services
- Supabase for database services
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the development team
- v1.0.0 - Initial release with core features
- User authentication
- Waste reporting
- Interactive map
- Community feed
- Cleanup verification
- Points and rewards system
π± Together, let's make our planet cleaner, one cleanup at a time! π±