Skip to content

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SnapSolve (iOS) — AI-powered civic issue reporting

SnapSolve is a SwiftUI iOS app that helps users snap a photo of an infrastructure issue (e.g., potholes, graffiti, broken streetlights), automatically enrich it with location context, and generate a structured report + recommended authority contact using an AI-backed backend.

This repo includes:

  • iOS app (SnapSolve/): SwiftUI, Camera + Map, Firebase Auth (Email/Password + Google).
  • Backend (Backend/): Node.js/Express API with MongoDB persistence, Firebase Admin auth middleware, reverse geocoding, and email dispatch.

Demo (what it does)

  • Snap: capture an image in-app, optionally including GPS coordinates
  • Analyze: backend returns a JSON result:
    • issue description
    • recommended department/authority
    • contact email (when available)
  • Submit: confirm and submit a “ticket” (protected via Firebase ID token)
  • Track: view My Tickets (per-user)
  • Explore: view reports on a map

Tip: Add screenshots/GIFs for extra polish:

  • docs/screenshots/01-camera.png
  • docs/screenshots/02-analysis.png
  • docs/screenshots/03-my-tickets.png
  • docs/screenshots/04-map.png

Tech stack

iOS

  • SwiftUI (UI + navigation)
  • AVFoundation (camera capture)
  • MapKit (map + annotations)
  • Firebase Auth (email/password + Google Sign-In)

Backend

  • Node.js + Express
  • MongoDB + Mongoose (ticket/report storage)
  • Firebase Admin (verify Firebase ID tokens)
  • Google Maps Geocoding API (reverse geocode lat/lng → address metadata)
  • Gemini (image + prompt → structured JSON analysis)
  • Nodemailer (Gmail) (send report email)

Architecture (high-level)

  1. iOS captures image + (optional) location
  2. iOS calls POST /api/analyze with base64 image + coordinates
  3. Backend reverse-geocodes coordinates and sends image+metadata to Gemini
  4. Backend returns { description, recommendation, email }
  5. User confirms submission → iOS calls POST /api/tickets with Firebase ID token
  6. Backend stores report in MongoDB and sends an email

API overview

Base path is mounted under /api in Backend/app.js.

  • POST /api/analyze

    • body: { imageBase64, latitude?, longitude? }
    • returns: { description, recommendation, email? }
  • POST /api/tickets (protected)

    • header: Authorization: Bearer <Firebase ID Token>
    • body: { problem_description, recommendation, timestamp, email, latitude, longitude, imageBase64 }
    • returns: saved report document
  • GET /api/tickets/my (protected)

    • header: Authorization: Bearer <Firebase ID Token>
    • returns: list of reports created by the current user
  • GET /api/tickets/all (public)

    • returns: list of all reports
  • GET /api/tickets/locations (public)

    • returns: { id, latitude, longitude }[]

Getting started (local development)

Prerequisites

  • Xcode (iOS build/run)
  • Node.js (backend)
  • MongoDB (local or hosted)
  • API keys:
    • Google Maps Geocoding API key
    • Gemini API key
  • Email sending (optional for local): Gmail user + app password
  • Firebase:
    • iOS Firebase config (GoogleService-Info.plist)
    • Firebase Admin service account (for backend token verification)

Backend: run locally

From Backend/:

  1. Install dependencies
cd Backend
npm install
  1. Create .env from the template
cp env.example .env
  1. Provide Firebase Admin credentials (choose one)
  • Option A (recommended): env var

    • Set FIREBASE_SERVICE_ACCOUNT_JSON in .env to the full service account JSON (as a single line).
  • Option B: local file (not committed)

    • Place your Firebase service account at Backend/serviceAccountKey.json (this path is gitignored).
    • Use Backend/serviceAccountKey.example.json as a template.
  1. Start the API
npm run dev

By default, the backend listens on http://localhost:4000.


iOS: run locally

  1. Open SnapSolve.xcodeproj in Xcode
  2. Ensure Firebase is configured:
    • SnapSolve/GoogleService-Info.plist should match your Firebase project
    • enable Email/Password and Google Sign-In in Firebase Auth
  3. Point the app to your backend:
    • update baseURL in SnapSolve/BackendService.swift to http://localhost:4000 (or your deployed URL)
  4. Build & run on a simulator or device

Folder structure

  • SnapSolve/: iOS SwiftUI app
  • Backend/: Node/Express API + MongoDB models

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages