Skip to content
nathant27Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Food Maps

Food Maps Social Banner Status Development

Professional food recovery and distribution platform that connects donors, recipients, and volunteers through an interactive map, role-based workflows, and automation-friendly APIs.

Screenshot

Food Maps Screenshot

Table of Contents

  • Overview
  • Key Capabilities
  • Architecture
  • Tech Stack
  • Project Structure
  • Getting Started
  • Environment Variables
  • API Highlights
  • Development Notes
  • Troubleshooting
  • Roadmap

Overview

Food Maps helps communities reduce food waste by making food donation discovery and pickup coordination simple. The platform supports multiple user roles and includes map-based discovery, listing workflows, claim flows, and operational features for partner organizations.

Key Capabilities

  • Interactive map-based food listing discovery
  • Role-aware experiences for donors, recipients, volunteers, and admins
  • Listing lifecycle support (available, claimed, pending confirmation, completed, expired)
  • Contact exchange for eligible claimed listings
  • Favorite locations and listing workflows
  • Distribution center and inventory views
  • Voice Search experience (In Progress)
  • AI-powered assistant and optimization modules (In Progress)

Architecture

Food Maps is split into two main layers:

  • Frontend: Static HTML + React components loaded in-browser
  • Backend: FastAPI service with SQLAlchemy models and JWT-based auth

High-level flow:

  1. User opens the web app.
  2. Frontend requests listings and related data from API endpoints.
  3. Backend reads/writes listing, claim, and user state in the database.
  4. Map and detail views render dynamically from API responses.

Tech Stack

Frontend

  • React 18 (UMD + Babel setup)
  • Tailwind CSS
  • Mapbox GL JS

Backend

  • FastAPI
  • Uvicorn
  • SQLAlchemy
  • Pydantic
  • JWT / python-jose

Data and Services

  • SQLite (default local dev path) or Postgres/MySQL via DATABASE_URL
  • Optional Twilio integration for SMS features

Project Structure

frontend/ is the document root: it is the only directory the server exposes over HTTP, which is what keeps .env, backend/ and the guides unreachable.

food-maps/
  frontend/                 # Everything served to the browser
    index.html              # Main web app shell
    landing.html            # Public marketing page
    dispatch.html           # Logistics and driver coordination
    assets/
      css/                  # style.css, i18n_platform.css
      logos/                # Brand and partner images
    js/
      app.js                # Main app composition and view state
      landing-app.js        # Landing page entry
      dispatch-app.js       # Dispatch entry
      lib/                  # API clients, i18n, Mapbox, helpers
      components/           # React components, grouped by feature:
                            #   common, auth, onboarding, map, listings,
                            #   dispatch, admin, ai, nutrition, safety,
                            #   profile, partners
  backend/
    app.py                  # FastAPI entry module
    models.py               # SQLAlchemy models
    schemas.py              # Pydantic schemas
  dev-pages/                # Manual component harnesses, never served
  uploads/                  # User-uploaded photos (gitignored, runtime only)
  requirements.txt          # Python dependencies

Entry pages sit at the top of frontend/ rather than in a subfolder so that public URLs stay /index.html, /landing.html and so on.

Getting Started

Prerequisites

  • Python 3.10+
  • pip
  • Modern browser (Chrome, Edge, Firefox, Safari)

1) Install backend dependencies

From the repository root:

pip install -r requirements.txt

2) Configure environment

Create a .env file in backend/ or export env vars in your shell.

Minimum recommended for local development:

JWT_SECRET=change-me
DATABASE_URL=sqlite:///../food_maps.db
MAPBOX_ACCESS_TOKEN=your_mapbox_public_token
EMAIL_USERNAME=your_email
EMAIL_PASSWORD=your_app_password
PUBLIC_BASE_URL=http://localhost:8000

3) Run the API

From repository root:

python -m uvicorn backend.app:app --host 0.0.0.0 --port 8000 --reload

Or from backend/:

uvicorn app:app --host 0.0.0.0 --port 8000 --reload

4) Open the frontend

Visit http://localhost:8000 — the API server also serves the frontend from frontend/, so no separate static server is needed.

Opening the HTML files directly from disk will not work: pages reference assets by absolute URL and the app needs the API on the same origin.

Environment Variables

Core

  • JWT_SECRET: JWT signing secret (required)
  • DATABASE_URL: DB connection string (optional; defaults to SQLite path)
  • MAPBOX_ACCESS_TOKEN: enables map/geocoding behaviors

Optional / feature-specific

  • Twilio-related variables for SMS features (if enabled)
  • EMAIL_USERNAME: optional sender/login email for SMTP account (defaults to noreply.foodmaps@gmail.com)
  • EMAIL_PASSWORD: SMTP app password used for password reset and verification emails
  • PUBLIC_BASE_URL: public app/api URL used to build email verification links (for production use your deployed domain)

Runtime secrets from AWS Secrets Manager:

  • AWS_SECRET_NAME: secret to load at startup, for example prod/env
  • AWS_REGION: AWS region that hosts the secret, for example us-west-1

The backend loads that secret on startup, accepts either JSON or dotenv-formatted text, and copies the keys into process environment variables before config is read.

API Highlights

Authentication and user

  • GET /api/user/me
  • PUT /api/user/phone

Listings and claim flow

  • GET /api/listings/get
  • PATCH /api/listings/get/{id} (claim path)
  • GET /api/listings/user-details/{id}

Centers

  • GET /api/centers
  • GET /api/centers/{id}/inventory

Development Notes

  • Frontend currently uses script-based React component loading. There is no build step, so components are globals loaded by ordered <script> tags: when adding one, place its tag after anything it depends on.
  • Map rendering depends on Mapbox JS and token availability.
  • App behavior is role-sensitive; test with multiple user roles.
  • Keep user-facing status transitions consistent between backend and UI labels.

Troubleshooting

Map not loading

  • Verify MAPBOX_ACCESS_TOKEN is set and valid.
  • Confirm Mapbox script and CSS load in the browser.
  • Check browser devtools for network/CORS/script errors.

Backend import errors

  • Ensure dependencies are installed from requirements.txt in the repo root.
  • Confirm you run uvicorn from the expected working directory.

Database issues

  • Validate DATABASE_URL format.
  • If using SQLite, confirm write permissions for the project directory.

Roadmap

  • Complete Voice Search feature rollout (In Progress)
  • Complete AI assistant and optimization enhancements (In Progress)
  • Improve typed frontend build pipeline
  • Expand observability and health dashboards
  • Harden role-based e2e test coverage
  • Improve deployment automation and secret management

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages