Encinitas Street Reach
A comprehensive by-name list and service tracking system for San Diego Rescue Mission's street outreach program in Encinitas, CA.
Features
Core Functionality
- By-Name List Management: Unduplicated client tracking with auto-generated IDs
- Real-time Duplicate Detection: Fuzzy matching prevents duplicate entries
- Service Interaction Tracking: Record all encounters with required GPS coordinates
- Client Profiles: Complete history with demographics, services, and timeline
- Admin Dashboard: Comprehensive metrics, heat maps, and data exports
Service Tracking
- Clinical services (MAT, detox, co-occurring conditions)
- Harm reduction (naloxone, fentanyl test strips, education)
- Case management notes
- Transportation and shower trailer access
- Custom date range reporting
Technical Features
- GPS Location Capture: Auto-detect or manual map selection
- Interactive Heat Map: Visualize service locations with Mapbox
- CSV Export: Three-file export (summary, clients, interactions)
- Authentication: Secure login with Supabase Auth
- Progressive Web App: Install to home screen, works offline
- Mobile-First Design: Optimized for field workers on phones/tablets
Tech Stack
- Frontend: Next.js 15, React, TypeScript, Tailwind CSS
- Backend: Supabase (PostgreSQL, Auth, RLS)
- Maps: Mapbox GL
- Forms: React Hook Form + Zod validation
- PWA: next-pwa with service worker
- Deployment: Vercel
Prerequisites
- Node.js 18+ and npm
- Supabase account
- Mapbox account (free tier is fine)
- Vercel account for deployment
Setup Instructions
1. Clone and Install
git clone https://github.com/DSchacht0825/encinitas-street-reach.git
cd encinitas-street-reach/encinitas-street-reach
npm install
2. Supabase Setup
- Create a new project at supabase.com
- Go to Project Settings > API to get your URL and anon key
- Run the migration from
supabase/migrations/001_initial_schema.sql in the SQL Editor
- Enable Row Level Security on all tables
3. Environment Variables
Create .env.local in the project root:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=your_mapbox_token
4. Mapbox Setup
- Sign up at mapbox.com
- Go to Account > Access Tokens
- Create a new token or use the default public token
- Add to
.env.local
5. Create User Accounts
In Supabase Dashboard:
- Go to Authentication > Users
- Click "Invite User" or "Add user"
- Add email/password for each field worker and admin
6. Run Locally
npm run dev
Visit http://localhost:3000 and log in with a Supabase user account.
Deployment to Vercel
Option 1: GitHub Integration (Recommended)
- Push your code to GitHub
- Go to vercel.com and sign in
- Click "Add New" > "Project"
- Import your GitHub repository
- Add environment variables:
NEXT_PUBLIC_SUPABASE_URL
NEXT_PUBLIC_SUPABASE_ANON_KEY
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN
- Click "Deploy"
Option 2: Vercel CLI
npm install -g vercel
vercel login
vercel --prod
Add environment variables when prompted.
PWA Icons
The app needs icons for mobile installation. See public/README_ICONS.md for instructions.
Quick setup with ImageMagick:
convert -size 512x512 xc:"#1e40af" \
-gravity center \
-pointsize 200 \
-fill white \
-annotate +0+0 "SR" \
public/icon-512x512.png
convert public/icon-512x512.png -resize 192x192 public/icon-192x192.png
User Guide
Field Workers
- Log in with your account
- Search for existing clients or add new ones
- Record service interactions:
- GPS auto-captures your location
- If GPS fails, manually select location on map
- Fill out all services provided
- Add case notes
- View client profiles to see full history
Administrators
- Access dashboard from home page
- View metrics:
- Total clients served
- Service interaction counts
- Naloxone distribution
- Referrals made
- Filter by date range for custom reports
- Export data to CSV for grant reports
- View heat map to identify high-need areas
Database Schema
Tables
- persons: Client by-name list with demographics
- encounters: Service interactions with GPS coordinates
- users: (Supabase Auth) Field workers and admins
Key Fields
Persons:
- Auto-generated
client_id (CL-000001)
- Demographics (age, gender, race, ethnicity)
- Living situation and homeless history
- Veteran and chronic homeless flags
Encounters:
- Required GPS coordinates
- Clinical services (MAT, detox, co-occurring)
- Harm reduction (naloxone, test strips)
- Case management notes
- All services timestamped
Features by Page
Home Page (/)
- Client search with fuzzy matching
- Add new client button
- Dashboard access
- Logout button
Client Profile (/client/[id])
- Demographics display
- Service summary (interaction count)
- Complete timeline of all encounters
- New service interaction button
New Client (/client/new)
- Full intake form
- Real-time duplicate detection
- Auto-generated client ID
New Interaction (/client/[id]/encounter/new)
- GPS auto-capture with manual fallback
- All service types
- Conditional fields
- Required location validation
Dashboard (/dashboard)
- 8 key metric cards
- Demographics breakdown
- Service type counts
- Interactive heat map
- Custom date filters
- CSV export (3 files)
Login (/login)
- Email/password authentication
- SDRM branding
- User role info
Security
- All routes require authentication
- Row Level Security on all tables
- Secure session management
- Logout clears all cookies
- Environment variables for secrets
Mobile Installation
- Open app in mobile browser
- iOS: Tap Share > Add to Home Screen
- Android: Tap Menu > Install App
- App opens full-screen like native app
- Works offline once cached
Troubleshooting
Can't log in:
- Check Supabase credentials in .env.local
- Verify user exists in Supabase Auth
GPS not working:
- Check browser permissions
- Use manual map picker fallback
Map not loading:
- Verify Mapbox token in .env.local
- Check browser console for errors
Deployment fails:
- Verify all environment variables are set
- Check build logs in Vercel dashboard
Support
For issues or questions:
- Check GitHub Issues: https://github.com/DSchacht0825/encinitas-street-reach/issues
- Contact repository owner
- Review Supabase and Next.js documentation
License
Copyright © 2025 San Diego Rescue Mission
Built with Claude Code