A web application for collecting and categorizing waste images to build a recycling dataset. This app allows users to capture photos through their device camera and upload them to a GitHub repository, organized by waste category.
- 6 Waste Categories: Cardboard, Glass, Metal, Paper, Plastic, and Trash
- Camera Integration: Capture images directly from device camera
- Auto-Upload Mode: Automatic upload after capturing photos
- Upload History: Track your recent uploads with timestamps
- Responsive Design: Works on mobile and desktop devices
- GitHub Integration: Automatically uploads images to your GitHub repository
This version uses environment variables to store the GitHub token securely, preventing token exposure in public repositories.
- A GitHub account
- A GitHub Personal Access Token with
repopermissions - A GitHub repository for storing the dataset
- A Vercel account (free tier works fine)
- Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
- Click "Generate new token (classic)"
- Give it a descriptive name (e.g., "Recycle Dataset App")
- Select the following scopes:
- ✅
repo(Full control of private repositories)
- ✅
- Click "Generate token"
- Copy the token immediately (you won't be able to see it again!)
- Create or use an existing repository (e.g.,
sumiyajid/RecycleBinDataCollection) - Ensure the repository has the following folder structure:
Dataset/ ├── cardboard/ ├── glass/ ├── metal/ ├── paper/ ├── plastic/ └── trash/ - You can create these folders manually or let the app create them automatically on first upload
-
Push to GitHub First:
# Initialize git repository git init # Add all files git add . # Commit git commit -m "Initial commit: Recycle waste dataset collection app" # Create a new repository on GitHub, then: git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git git branch -M main git push -u origin main
-
Deploy on Vercel:
- Go to vercel.com and sign in
- Click "Add New..." → "Project"
- Import your GitHub repository
- Vercel will auto-detect the configuration
-
Add Environment Variables (Critical Step!):
-
In the Vercel project settings, go to "Settings" → "Environment Variables"
-
Add the following variables:
Name Value Example GITHUB_TOKENYour GitHub Personal Access Token ghp_xxxxxxxxxxxxGITHUB_REPOYour repository in format username/reposumiyajid/RecycleBinDataCollectionFOLDER_PATHFolder path in repo for uploads Dataset
-
-
Deploy:
- Click "Deploy"
- Wait for deployment to complete
- Your app will be live at
https://your-project.vercel.app
-
Install Vercel CLI:
npm install -g vercel
-
Login to Vercel:
vercel login
-
Deploy:
# Navigate to project directory cd recycle-waste-app # Deploy vercel
-
Add Environment Variables:
vercel env add GITHUB_TOKEN vercel env add GITHUB_REPO vercel env add FOLDER_PATH
-
Redeploy with environment variables:
vercel --prod
recycle-waste-app/
├── index.html # Main HTML file with app interface
├── api/
│ └── config.js # API endpoint to serve environment variables
├── vercel.json # Vercel configuration
├── .gitignore # Git ignore file
├── .env.example # Example environment variables
└── README.md # This file
- Never commit tokens: The
.gitignorefile prevents.envfiles from being committed - Use environment variables: Tokens are stored in Vercel's environment variables
- Token rotation: Regularly rotate your GitHub token
- Minimal permissions: Only grant necessary repository access
- Monitor usage: Check GitHub token usage regularly
- Open the deployed app in your browser
- Select a waste category (Cardboard, Glass, Metal, Paper, Plastic, or Trash)
- Click "Start Camera" to access your device camera
- Position the waste item in the camera frame
- Click "Capture Photo" to take a picture
- Review the captured image
- Click "Send to Dataset" to upload to GitHub
Enable the "Auto-Upload" toggle to automatically upload photos immediately after capturing them, streamlining the collection process.
- Cause: Environment variables not set in Vercel
- Solution: Go to Vercel project settings → Environment Variables and add all required variables
- Cause: Invalid token or insufficient permissions
- Solution:
- Verify your GitHub token has
reposcope - Check that the repository name is correct (
username/repository) - Ensure the repository exists and is accessible
- Verify your GitHub token has
- Cause: Browser permissions or HTTPS required
- Solution:
- Grant camera permissions in browser
- Ensure you're accessing via HTTPS (Vercel provides this automatically)
- Cause: Incorrect folder path or repository name
- Solution: Verify
GITHUB_REPOandFOLDER_PATHenvironment variables are correct
| Variable | Required | Description | Example |
|---|---|---|---|
GITHUB_TOKEN |
Yes | GitHub Personal Access Token with repo scope | ghp_1234567890abcdef |
GITHUB_REPO |
Yes | Repository in format username/repo |
sumiyajid/RecycleBinDataCollection |
FOLDER_PATH |
No | Base folder for uploads (default: "Dataset") | Dataset |
Feel free to submit issues and enhancement requests!
This project is open source and available under the MIT License.
- Built for environmental data collection
- Supports recycling research and AI model training
- Helps in waste classification projects
Note: Always keep your GitHub tokens secure and never share them publicly. If you suspect your token has been compromised, revoke it immediately and generate a new one.