Haven Landlord Directory — AGENTS.md

Searchable rental property directory for The Haven (Charlottesville, VA nonprofit). Replaces a manually-maintained Excel spreadsheet. Staff can browse, search, and edit listings via a password-protected web UI.

File Map

index.ts                          # HTTP entrypoint — Hono router, serves frontend + API
backend/
  db.ts                           # SQLite schema, CRUD functions, seed-on-first-run
  seed.ts                         # Initial 93 listings imported from FY25 spreadsheet
  discover.ts                     # AI discovery logic — OpenAI web_search + structured outputs
  cron.ts                         # Weekly interval — discovers new listings, inserts into DB
frontend/
  index.html                      # Static HTML shell (loads React bundle)
  index.tsx                       # React entrypoint
  types.ts                        # Listing / ListingInput TypeScript interfaces
  favicon.svg
  components/
    App.tsx                       # Root component — search, filter, auth state
    ListingsTable.tsx             # Table view with search, area filter & sortable columns
    ListingForm.tsx               # Add/edit form (staff only)

Architecture

  • Backend: Hono router in index.ts — serves static frontend files and a REST API (/api/listings CRUD). Staff auth via x-admin-password header checked against ADMIN_PASSWORD env var.
  • Database: Project-scoped SQLite (listings_v1 table) accessed via std/sqlite/main.ts. Seeded from backend/seed.ts on first run.
  • Frontend: React SPA bundled in-browser, components in frontend/components/.
  • Automated discovery: Weekly cron (backend/cron.ts) uses std/openai Responses API with web_search tool and structured outputs to find new rental properties. New entries are tagged "AI-discovered — verify contact info".

Env Vars

  • ADMIN_PASSWORD — shared password for staff edit access