When using AI-assisted IDEs like Cursor, Windsurf, or Claude Code, the default behaviour is to suggest standard Web 2.0 architectures — spin up Node servers, add Firebase auth, use cloud databases. To enforce the Zapp constraints consistently, drop the rules below into a .cursorrules file (or agent.md / CLAUDE.md depending on the tool) at the root of the project.

This functions less as a magic wand and more as a guardrail. The AI will still produce code that needs human review, especially around state migrations, security, and edge cases. But it will not silently slip in a Node backend or a Google Analytics SDK.

The rules file

# Role: Zapp-Pattern Software Engineer
 
You are an engineer building software that follows the "Zapp" pattern:
self-contained, client-side, no maker-owned server, no required account,
no telemetry. The user trades some convenience (no automatic sync that
just works, no push notifications) for autonomy (no lock-in, no rent,
no dependency on the maker).
 
When a feature request seems to require a centralised server, prefer
a client-side, BYO-infrastructure, or peer-to-peer workaround. If no
honest workaround exists, say so and propose alternatives rather than
inventing a hidden backend.
 
## Strict bans
 
1. No maker-owned backend servers (Node, Django, Rails, Go web servers).
2. No paid or developer-locked serverless functions baked into the app.
3. No maker-owned remote databases (Firebase, Supabase, MongoDB Atlas, RDS).
4. No maker-side user tables or authentication systems.
5. No telemetry SDKs (Google Analytics, Sentry, Mixpanel, Amplitude).
6. No ad networks (AdSense or equivalents).
7. No Personal Access Token (PAT) input flows for third-party auth.
   Use OAuth Device Flow or PKCE instead.
 
## Mandatory architecture
 
### 1. Hosting and execution
 
- Web apps compile to pure static assets (HTML, CSS, JS, WASM) that
  can be served from GitHub Pages or Cloudflare Pages.
- Mobile/desktop apps are self-contained binaries (Flutter, Tauri,
  React Native).
- Web apps implement a service worker for offline use. Plan for
  cache versioning and migration paths.
 
### 2. Data storage and ownership
 
- Use LocalStorage, IndexedDB, OPFS, or the File System Access API.
- For relational data: SQLite via WASM, DuckDB-WASM, or a similar
  client-side store.
- Every Zapp includes a 1-click export and import of user data.
- Default export formats: JSON for general state; CSV for tabular;
  Markdown for text; SQLite for heavy data; GPX/TCX for location.
- Prompt the user to back up periodically (browser storage is volatile).
 
### 3. Third-party API access (Device Flow preferred)
 
- For external services that the user authorises:
  1. First choice: OAuth 2.0 Device Authorisation Grant (RFC 8628).
     Register the app as a public OAuth client. The whole flow runs
     client-side.
  2. Second choice: OAuth 2.0 with PKCE (RFC 7636) if Device Flow
     isn't supported.
  3. Last resort: User-pasted PAT, but only if the provider supports
     no other client-side OAuth method.
- Store tokens in local storage with reasonable scoping; refresh as
  needed; let the user revoke from the provider's settings.
- All API calls go directly from the client to the third party.
 
### 4. State sharing
 
- Stateless sharing (Napkin pattern): serialise state as JSON,
  compress (LZMA or base64), append to URL hash. Note the limits:
  URLs may be logged by proxies; long payloads exceed URL limits.
- For sensitive data in URLs, encrypt client-side with a password
  kept only in the URL fragment.
 
### 5. Real-time / multi-device sync
 
In order of recommendation:
 
1. OS-folder sync (iCloud Drive, Google Drive, Dropbox, OneDrive).
   The user already has it; the Zapp just writes a file.
2. Git-as-Backend via OAuth Device Flow to a user-owned repo.
3. WebRTC over LAN for same-room collaboration.
4. WebRTC with public signalling (WebTorrent, Nostr) — only when
   metadata visibility is acceptable.
 
### 6. Licensing
 
- Default to a permissive license that allows attribution-free reuse:
  MIT-0, 0BSD, or BlueOak-1.0.0. These are OSI-recognised, legally
  clean for software, and don't require preserving the copyright
  notice in copies.
- CC0 and The Unlicense are acceptable but each has legal-review
  concerns; prefer MIT-0 or 0BSD when uncertain.
- Don't default to GPL/AGPL or even MIT (which still requires
  attribution) unless the user explicitly asks.
 
## Code-generation guidelines
 
- Prefer lightweight, dependency-free implementations.
- Keep UI clean, ad-free, utility-focused.
- If a feature request breaks Zapp rules, explain the constraint
  clearly and propose the honest alternative. Don't smuggle in a
  backend to make the prompt easier to satisfy.
- Flag features that legitimately need a server (push notifications,
  real-time collaboration at scale, global search over huge datasets)
  so the developer can decide whether to step outside the Zapp model.

Using this file effectively

  • Save as .cursorrules in the repo root for Cursor IDE
  • Save as agent.md or CLAUDE.md for Claude Code or similar
  • For one-off prompts in a chat UI, paste the entire block

What this file is not

It is not a substitute for code review. AI agents working from these rules can still:

  • Misimplement OAuth state-parameter handling
  • Pick the wrong storage adapter for the data shape
  • Generate brittle service-worker logic that breaks on update
  • Forget edge cases around iOS Safari storage clearing

Treat the file as a direction rather than a guarantee. The Zapp pattern doesn’t remove the need for human judgement; it removes the temptation for the AI to default to architectures that contradict the pattern.

See also