# Tech-Realm/starter-saas as a LogicPacks pack

A minimal Vite\u2011React + Express SaaS starter with optional Stripe, Supabase, and OpenAI integrations, all mockable for zero\u2011key development.

Source: https://github.com/Tech-Realm/starter-saas at commit `3bc9e4351342`. No account needed. Everything below runs on this machine with your own agent.
A digest tells an agent what the code is; a pack also gives it the keys, the rules and the purpose to work on it safely.

## Keys this app needs

| Key | Needed | Service | Without a key |
|---|---|---|---|
| `OPENAI_API_KEY` | optional | openai | local mock |
| `STRIPE_SECRET_KEY` | optional | stripe | local mock |
| `STRIPE_WEBHOOK_SECRET` | optional | stripe | local mock |
| `SUPABASE_ANON_KEY` | optional | supabase | local mock |
| `SUPABASE_SERVICE_ROLE_KEY` | optional | supabase | local mock |

Ask the person for these keys first. With real keys the app runs against the real services (keys stay in the local LogicPacks vault,
the app sees placeholders). Without them it runs against a local, stateful mock with demo data.

## Run it locally

```sh
uvx logicpacks@latest add github.com/Tech-Realm/starter-saas --clone   # or: pipx run logicpacks add ...  (Python 3.9+)
cd starter-saas
# real keys (optional, hidden prompt, stored only in the local vault):  uvx logicpacks@latest key add <KEY_NAME>
./lp-mock.sh &                                    # local stateful mock for keys you don't have
./lp-run.sh <the repo's dev command>              # see LOGICPACKS.md in the clone for the exact commands
```

`logicpacks add --clone` clones the repo, writes `.env.lp` (mock keys and placeholders, never real values), points the SDKs at the
local mock (base-URL env vars, and hardcoded API URLs in the local copy only), and writes `LOGICPACKS.md` (purpose, commands,
playbooks, rules). Re-run it after adding real keys.

## More

- Purpose and how it works: https://logicpacks.io/Tech-Realm/starter-saas (tab "Purpose & rebuild")
- Full digest (tree + files, token-counted): https://convert.logicpacks.io/api/snapshots/s50922527843/digest.txt
- Pack files as JSON: https://convert.logicpacks.io/api/repo/Tech-Realm/starter-saas/bundle
- The owner can add private files, env and logs, and share access: open https://logicpacks.io/Tech-Realm/starter-saas in a browser.

## Add a contributor (owner, one step)

`uvx logicpacks@latest invite <github-user> --repo Tech-Realm/starter-saas` on the owner's machine: GitHub collaborator invite with the owner's
own gh login (LogicPacks never holds a GitHub token), this pack, optional scoped keys (expiry, endpoints, limits; values stay
on the owner's machine) and an access link the contributor's agent verifies. `uvx logicpacks@latest offboard <github-user>`
removes all of it (logicpacks 1.0.22 or newer). Details: https://logicpacks.io/Tech-Realm/starter-saas/invite.md

## Edit this app (make your own flavour)

`uvx logicpacks@latest remix github.com/Tech-Realm/starter-saas` forks it to the user's GitHub (their own gh login), clones it, builds this pack
on local mocks and adds a "Remixed from Tech-Realm/starter-saas" credit line. The owner's keys are never shared: live services use the user's own
keys. Licence and remix count: https://logicpacks.io/Tech-Realm/starter-saas/edit.md

## Core logic and purpose

- A minimal SaaS starter built with Vite+React front‑end and Express back‑end.
- Provides user auth (Supabase or local mock), Stripe checkout/subscriptions (live or mock), and an OpenAI tagline generator (live or mock).
- Users sign up, generate up to 3 free taglines, then upgrade via mock checkout to a Pro plan.
- Main flow: (1) Auth page → (2) Dashboard with Hero UI → (3) Call `/api/ai` for tagline → (4) If over free limit, redirect to Pricing → (5) Stripe checkout → (6) Webhook updates plan.
- Key modules/files:
  * `server/index.js` – Express server, mounts API routes, serves built React app.
  * `server/auth.js` – Supabase auth wrapper or local mock, JWT signing.
  * `server/billing.js` – Stripe checkout & webhook handling, falls back to mock.
  * `server/ai.js` – Calls OpenAI (or deterministic mock) for tagline generation.
  * `server/store.js` – Simple JSON file store for mock state.
  * `web/src/*.jsx` – React components: Auth, Dashboard, Hero, Pricing, ModeBadges.
  * `web/src/nova.css` – Design tokens, fonts, colour palette.
  * `supabase/schema.sql` – Table definition for live Supabase.
  * `.logicpacks/` – Demo data, pack definition, and a “make‑it‑look‑great” design skill.
