khalil-zero-cost-stacklisted
Install: claude install-skill elias-khalil-eng/khalil-zero-cost-stack
# Khalil Zero-Cost Stack
## Overview
One architecture: **React SPA + ONE serverless function + a spreadsheet as the database**, all on one origin, on a free host. Proven in production: records, payments, expenses, generated documents, role separation and public one-time client links.
**Core principle:** the spreadsheet is a real database with real rules. Break the four invariants below and it corrupts quietly.
## When to Use
- Internal tool, a handful of named users, a few thousand records/year.
- Owner wants to open the data in a tool they already know.
- $0/month hosting is a requirement.
**Do NOT use for:** public sign-up, regulated data (health, cards), real concurrency, sub-100ms responses, tens of users. Run the fit test in `references/playbook.md` §3 before agreeing.
## Stack
| Layer | Choice |
|---|---|
| Frontend | React 19 + Vite + TS strict, oxlint, plain CSS with design tokens |
| Routing | None. `main.tsx` picks a root from `window.location.pathname` |
| State | Context for auth + toast; `useState`/`useMemo` in `App.tsx`. No state library |
| Backend | ONE function, `export const config = { path: '/api/*' }`, hand-written regex router |
| Data | Google Sheets REST + hand-rolled RS256 service-account JWT (no SDK) |
| Auth | bcryptjs hashes in a `Users` tab, `jsonwebtoken` bearer tokens, 8h expiry |
| Host | Netlify — static `client/dist` + function on one origin, SPA fallback redirect last |
## Repository Skeleton
```
client/ React SPA (own