A full-stack web application for anonymous public reporting of water infrastructure issues with admin management capabilities.
- Anonymous Public Reporting: Community members can report water issues without creating an account
- Image Upload: Upload photos of water infrastructure problems
- Admin Dashboard: Secure admin login with ability to mark issues as solved
- Real-time Updates: Live updates when reports are created or modified
- Responsive Design: Works seamlessly on desktop and mobile devices
- Secure Architecture: Service role keys never exposed to frontend
- Frontend: Next.js 14 (App Router), React 18, TypeScript, Tailwind CSS
- Backend: Next.js API Routes (Node.js 24.11.1)
- Database: Supabase (PostgreSQL)
- Authentication: Supabase Auth
- Storage: Supabase Storage
- Testing: Vitest
- Node.js 24.11.1 or later
- npm or yarn
- Supabase account
- Go to supabase.com and create a new project
- Wait for the project to be fully provisioned
- Note your project URL and keys from Project Settings > API
- In Supabase Dashboard, go to Storage
- Click New bucket
- Name it
reports-images - Make it Public
- Click Save
In Supabase Dashboard under Storage > reports-images > Policies:
- Create a policy for public read access:
- Name: "Public read access"
- Policy:
SELECToperation - Definition:
(bucket_id = 'reports-images')
- In Supabase Dashboard, go to SQL Editor
- Click New query
- Copy the contents of
supabase/migrations/001_initial_schema.sql - Paste and click Run
- In Supabase Dashboard, go to Authentication > Users
- Click Add user > Create new user
- Enter email and password for your admin account
- Click Create user
- Clone this repository
- Install dependencies:
npm install- Create
.env.localfile in the root directory:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key-here- Replace the values with your Supabase project credentials:
- Find these in Supabase Dashboard > Project Settings > API
- IMPORTANT: Never commit the service role key to version control
npm run devOpen http://localhost:3000 in your browser.
npm testgit init
git add .
git commit -m "Initial commit"
git remote add origin your-repo-url
git push -u origin main- Go to vercel.com and sign in
- Click New Project
- Import your GitHub repository
- Configure environment variables:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEY
- Click Deploy
In Supabase Dashboard > Authentication > URL Configuration:
- Add your Vercel deployment URL to the allowed URLs
community-water-report/
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── api/ # API routes
│ │ ├── admin/ # Admin pages
│ │ └── report/ # Report detail pages
│ ├── components/ # React components
│ ├── lib/ # Utility functions and clients
│ └── types/ # TypeScript type definitions
├── supabase/
│ └── migrations/ # Database migrations
├── tests/ # Test files
└── public/ # Static assets