🛡️ TenantGuard NYC — Leveling the Playing Field in Housing Court
Inspiration
In New York City, the housing crisis is compounded by a catastrophic "representation gap": over 90% of landlords in Housing Court have legal representation, while fewer than 10% of tenants do.
Even though New York passed the landmark Housing Stability and Tenant Protection Act of 2019 (HSTPA)—establishing some of the strongest statutory tenant rights in the nation—landlords routinely violate these laws with impunity. They issue defective 3-day or 5-day notices instead of the mandatory 14-day written demand, tack on unlawful late fees of $150 or more, and pocket $3,000+ security deposits knowing self-represented tenants rarely know how to enforce statutory penalties.
I was inspired by a simple question: What if every tenant under the stress of an eviction threat or stolen deposit had an instant, AI-powered legal defender in their pocket that spots procedural defects, calculates statutory damages, and generates court-ready pleadings in under 60 seconds? That vision became TenantGuard NYC.
What It Does
TenantGuard NYC is a civic technology platform that transforms complex housing laws into immediate, actionable legal defense tools:
- Eviction Notice Defect Scanner: Scans landlord rent demands against New York statutes (NY RPAPL § 711(2) and RPL § 238-a) to identify procedural defects that legally require summary proceedings to be dismissed.
- Security Deposit 2x Forfeiture Engine: Tracks the strict statutory 14-day clock under NY GOL § 7-108, detects complete statutory forfeiture, and calculates up to $2\times$ punitive damages for Small Claims Court.
- TenantGuard AI Legal Assistant: An interactive conversational legal intelligence tool powered by Meta Llama 3.3 70B Instruct (via Hugging Face Router) that answers urgent tenant queries with precise statutory citations.
- Firebase Realtime Activity Vault: A persistent case command center logging all AI consultations, notice audits, deposit claims, and Stripe payments in Firebase Firestore.
- NYC Open Data (HPD) Inspector: Live queries to the NYC Department of Housing Preservation & Development database to check for hazardous open code violations (Class A, B, and C emergencies) before landlords retaliate.
- Certified Digital Dispatch: Delivers formal legal demand letters via Resend with cryptographic transmission timestamps and audit hashes for court admissibility.
Statutory Math & Equations Enforced by TenantGuard
To avoid hallucinations, TenantGuard pairs conversational AI with a deterministic statutory engine running exact legal formulas:
1. Security Deposit Statutory Forfeiture & Punitive Damages (NY GOL § 7-108)
If $T_{\text{surrender}}$ is the date keys and forwarding address were surrendered, the elapsed days $D_{\text{elapsed}}$ is governed by:
(D_{\text{elapsed}} = \text{Date}{\text{today}} - T{\text{surrender}})
If $D_{\text{elapsed}} > 14$ and no itemized deduction was provided, the landlord forfeits 100% of retention rights, and willful retention triggers up to $2\times$ statutory punitive damages:
(\text{Punitive Damages} = 2 \times D_{\text{base}})
(\text{Total Potential Recovery} = D_{\text{base}} + 2 \times D_{\text{base}} = 3 \times D_{\text{base}})
(For a standard $3,200/month NYC apartment, an unreturned deposit yields a total statutory claim of *$9,600.00*, perfectly eligible for NYC Small Claims Court's $10,000 jurisdictional ceiling).
2. Statutory Late Fee Cap (NY Real Property Law § 238-a)
Late fees charged by any landlord cannot exceed:
(\text{Max Allowable Late Fee} = \min\left(\$50.00, \; 0.05 \times \text{Rent}_{\text{monthly}}\right))
(\text{Grace Period} \ge 5 \text{ calendar days})
3. Mandatory Predicate Rent Demand Window (NY RPAPL § 711(2))
Before any non-payment petition may be filed in court:
(\Delta t_{\text{cure}} \ge 14 \text{ calendar days})
Any demand offering $\Delta t_{\text{cure}} < 14$ is procedurally fatal (EOM 106-15 217th Corp. v. Severine).
How I Built It
TenantGuard is built on a modern, high-reliability stack designed for legal precision:
- Frontend & UX: I built the frontend with Next.js 16.3.5 (App Router, Turbopack), React 19, and TypeScript, styled using a bespoke vanilla CSS design token system featuring dark/light modes, accessible typography, and dynamic carousels.
- Legal AI Intelligence: I integrated Hugging Face's OpenAI-compatible Router (
https://router.huggingface.co/v1) runningmeta-llama/Llama-3.3-70B-Instructas the primary reasoning model, with automated failovers toQwen/Qwen2.5-72B-Instructandmeta-llama/Llama-3.1-8B-Instruct. - Authentication: Clerk (
@clerk/nextjs) provides seamless passwordless authentication, Google OAuth, and secure user sessions. - Database & Persistence: Firebase Firestore (
firebase/firestore) provides realtime persistence for tenant history, AI consultation logs, and case tracking, complemented by client-side IndexedDB/localStorage fallback. - Civic Data Integration: I implemented direct REST integration with the NYC Open Data Socrata API to query live Housing Maintenance Code violations by borough, house number, and street name.
- Legal Dispatch & Payments: Resend API generates cryptographic delivery receipts, and Stripe API powers the revenue tier for physical USPS Certified Mail barcoding ($14.99) and Small Claims Court Pro Kits ($29.00).
Challenges I Faced
- Avoiding the "Legal Hallucination Trap": In generative AI, hallucinations are inconvenient; in legal technology, they are dangerous. I solved this by strictly separating responsibilities: the LLM handles conversational empathy and legal translation, while a deterministic TypeScript statutory engine handles deadline calculations, penalty multipliers, and citation matching.
- Transitioning to Modern Hugging Face Inference Routing: During development, legacy endpoints (
api-inference.huggingface.co) failed due to infrastructure deprecation. I re-engineered the backend to utilize Hugging Face's latest unified router (router.huggingface.co/v1) with fine-grained token permissions, enabling sub-2-second latency for a massive 70-billion parameter model. - Dual-Layer Persistence: Tenants in crisis cannot risk losing their notice scans or legal letters if their connection drops. I engineered a dual-layer sync where every action writes simultaneously to a local vault and asynchronously syncs to Firebase Firestore.
- Navigating UPL (Unauthorized Practice of Law) Boundaries: To ensure compliance with ethical legal standards, I designed TenantGuard around factual procedural verification (e.g., verifying calendar days, math caps, and generating pro se templates) with clear informational disclaimers rather than subjective case merits evaluation.
What I Learned
- The Power of Granular Statutes: NYC's housing laws are surprisingly mathematical. Landlord non-compliance often hinges not on complex arguments, but on simple procedural defects (e.g., a 5-day notice instead of 14, or a $100 late fee instead of $50). Automating these procedural checks gives tenants extraordinary leverage.
- Open-Weights AI for Civic Tech: Running state-of-the-art open models like Llama 3.3 70B on Hugging Face provides enterprise-grade legal synthesis without proprietary vendor lock-in or recurring per-seat licensing costs.
- User Psychology Under Stress: When facing eviction, users don't want walls of text. Clean UI indicators, progress timelines, and single-click preset simulations significantly reduce cognitive load.
What's Next for TenantGuard
- LexHack Builders Fellowship: Expand the pilot into a production partnership with NYC tenant advocacy groups (e.g., Crown Heights Tenant Union, Housing Court Answers).
- Automated Small Claims e-Filing (NYSCEF): Direct electronic submission of security deposit petitions to NYC Civil Court.
- Multi-Jurisdiction Expansion: Bring the deterministic statutory engine to other tenant protection hubs, including California (AB 1482 Tenant Protection Act) and New Jersey.
Built With
- access-to-justice
- ai
- civic-tech
- clerk
- css3
- firebase
- firestore
- html5
- huggingface
- javascript
- legal-tech
- llama-3.3
- llm
- lucide-react
- next.js
- node.js
- nyc-open-data
- react
- resend
- rest-api
- small-claims
- socrata
- stripe
- turbopack
- typescript
Log in or sign up for Devpost to join the conversation.