How aftabahmedfahim/driveaudit works
DriveAudit is a React dashboard for connecting multiple Google Drive accounts, scanning owned files for duplicates and cleanup candidates, visualizing storage and estimated carbon impact, and trashing selected files. The principal workflow is authentication, Google OAuth connection, metadata scanning, cross-drive analysis, then review and cleanup. The graph includes the documented search and storage-visualization capabilities. Source excerpts establish key calls; some feature wiring is documented only in the README, so those edges cite it.
Main entry points: App.jsx App routes · drive.js Drive metadata and analysis · Dashboard.jsx Dashboard · DriveCard.jsx Drive scan card
Components 23
Identity and routing
- App routes
src/App.jsx - Sign in / sign up
src/pages/AuthPage.jsx - Auth state
src/context/AuthContext.jsx - Landing page
src/pages/Landing.jsx - Privacy page
src/pages/Privacy.jsx - Protected routes
src/components/ProtectedRoute.jsx
Drive connections
- Supabase client
src/lib/supabase.js - OAuth callback
src/pages/OAuthCallback.jsx - Drive connections
src/context/DrivesContext.jsx - Connected-drive records
supabase/schema.sql - Token exchange
supabase/functions/exchange-drive-token/index.ts - Token refresh
supabase/functions/refresh-drive-token/index.ts
Scanning and cleanup
- Dashboard
src/pages/Dashboard.jsx - Drive scan card
src/components/DriveCard.jsx - Drive metadata and analysis
src/lib/drive.js - Scan results and cleanup
src/components/ScanResults.jsx - Cross-drive search
src/components/DriveSearch.jsx
Dashboard insights
- Carbon calculations
src/lib/carbon.js - Carbon summary
src/components/CarbonSummary.jsx
Other components
- Drive user
- Supabase Auth
- Google OAuth
- Google Drive API
Connections 38
- Drive user → App routes: opens
src/App.jsx - App routes → Sign in / sign up: routes to
src/App.jsx - App routes → Dashboard: routes to
src/App.jsx - App routes → OAuth callback: routes to
src/App.jsx - App routes → Landing page: routes to
src/App.jsx - App routes → Privacy page: routes to
src/App.jsx - App routes → Protected routes: guards routes
src/App.jsx - Sign in / sign up → Auth state: uses auth
src/pages/AuthPage.jsx - Auth state → Supabase client: calls
src/context/AuthContext.jsx - Supabase client → Supabase Auth: configures
src/lib/supabase.js - Protected routes → Auth state: checks session
src/components/ProtectedRoute.jsx - Dashboard → Drive connections: uses connections
src/pages/Dashboard.jsx - Dashboard → Drive scan card: renders
src/pages/Dashboard.jsx - Dashboard → Scan results and cleanup: renders
src/pages/Dashboard.jsx - Dashboard → Cross-drive search: renders
src/pages/Dashboard.jsx - Dashboard → Carbon summary: renders
src/pages/Dashboard.jsx - Drive connections → Supabase client: reads records
src/context/DrivesContext.jsx - Drive connections → Connected-drive records: reads and deletes
src/context/DrivesContext.jsx - OAuth callback → Supabase client: gets session
src/pages/OAuthCallback.jsx - OAuth callback → Token exchange: invokes
src/pages/OAuthCallback.jsx - Token exchange → Google OAuth: exchanges code
- OAuth callback → Connected-drive records: upserts connection
src/pages/OAuthCallback.jsx - OAuth callback → Drive connections: refreshes list
src/pages/OAuthCallback.jsx - Drive connections → Token refresh: posts refresh request
src/context/DrivesContext.jsx - Token refresh → Google OAuth: refreshes token
- Drive scan card → Drive metadata and analysis: fetches metadata
src/components/DriveCard.jsx - Drive scan card → Drive metadata and analysis: fetches quota
src/components/DriveCard.jsx - Drive scan card → Drive metadata and analysis: analyzes files
src/components/DriveCard.jsx - Drive metadata and analysis → Google Drive API: requests files and info
src/lib/drive.js - Scan results and cleanup → Drive metadata and analysis: finds cross-drive copies
src/components/ScanResults.jsx - Scan results and cleanup → Google Drive API: trashes selected files
src/components/ScanResults.jsx - Cross-drive search → Google Drive API: trashes selected files
src/components/DriveSearch.jsx - Drive scan card → Carbon calculations: calculates footprint
src/components/DriveCard.jsx - Scan results and cleanup → Carbon calculations: formats impact
src/components/ScanResults.jsx - Carbon summary → Carbon calculations: uses calculations
src/components/CarbonSummary.jsx - Cross-drive search → Drive metadata and analysis: searches all drives
README.md - Drive scan card → Google Drive API: visualizes storage
README.md - Scan results and cleanup → Drive metadata and analysis: flags stale and large files
README.md