docs(examples): StackBlitz starter templates (react-quickstart, react-tanstack-query)#439
docs(examples): StackBlitz starter templates (react-quickstart, react-tanstack-query)#439rejifald wants to merge 1 commit into
Conversation
…eact-tanstack-query) Two minimal, browser-runnable @stitchapi/react starters under examples/stackblitz/: - react-quickstart: stitch() + useStitch - react-tanstack-query: stitchQueryOptions as a TanStack Query queryFn (complement, not competitor) Both pin published 1.0.0-rc.4 packages (stitchapi's `latest` npm tag is a stale 0.7.0, so exact pins are required) and typecheck clean against them. Lowers try-cost for the launch campaign; openable via stackblitz.com/github/.../examples/stackblitz/<name>. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rejifald
left a comment
There was a problem hiding this comment.
review-sweep: 1 verified finding (docs, high, in-diff — would be blocking, but GitHub rejects REQUEST_CHANGES on one's own PR). Both templates otherwise compile and vite build cleanly against the published rc.4 npm packages — this is the only thing standing between them and working demos. See inline comments.
| // A stitch is an endpoint declared once and called like a local function — | ||
| // no client instance, no codegen, no config files. The explicit generic types | ||
| // the parsed JSON result; swap it for an `output:` schema to also validate it. | ||
| export const getUsers = stitch<User[]>('https://demo.stitchapi.dev/users'); |
There was a problem hiding this comment.
[docs / high] https://demo.stitchapi.dev has no live deployment — the host only exists as a fetch-intercepted fake inside the playground's sandbox-sim (packages/sandbox-sim/src/dispatch.ts KNOWN_DEMO_HOSTS), so the template fails at runtime for every visitor.
Failure: verified live 2026-07-03 — curl https://demo.stitchapi.dev/users fails the TLS handshake (SSL_ERROR_SYSCALL) and plain HTTP returns Vercel DEPLOYMENT_NOT_FOUND. StackBlitz WebContainers run a real browser fetch with no sandbox interception, so a user clicking "Open in StackBlitz" gets TypeError: Failed to fetch, useStitch lands in the error state, and the UI shows "Request failed. Retry" forever — the template's sole promise (run with no local setup) is broken on arrival.
Fix: before merging, either (a) actually deploy a demo API at demo.stitchapi.dev serving GET /users with Access-Control-Allow-Origin: * (required — StackBlitz fetches from a browser origin), e.g. reuse the sandbox-sim handlers behind a tiny Vercel function; or (b) point at a live CORS-open endpoint whose payload already matches User { id, name, email }, e.g. https://jsonplaceholder.typicode.com/users.
Note: the pre-existing top-level README.md:160 ("the live demo API at demo.stitchapi.dev") makes the same false claim and should be fixed alongside whichever option is chosen.
|
|
||
| // The same endpoint declaration as the plain quick start. Here it feeds TanStack | ||
| // Query as the queryFn — StitchAPI does not replace TanStack Query, it fills it. | ||
| export const getUsers = stitch<User[]>('https://demo.stitchapi.dev/users'); |
There was a problem hiding this comment.
[docs / high] Same defect as react-quickstart/src/api.ts:12 — demo.stitchapi.dev is not deployed, so useQuery lands in the error state on first load. Fix together with the quickstart template (deploy the demo API with CORS, or point at a live endpoint matching User { id, name, email }).
| # StitchAPI — StackBlitz templates | ||
|
|
||
| Minimal, self-contained apps you can open and run in the browser — no local setup. Each | ||
| installs the published `@stitchapi/*` packages from npm and points at the public demo API |
There was a problem hiding this comment.
[docs / high] "the public demo API (https://demo.stitchapi.dev)" — there is no such deployment (DNS points at Vercel but returns DEPLOYMENT_NOT_FOUND; the host is only simulated inside the playground sandbox). Reword once the endpoint decision in src/api.ts is made.
What
Two minimal, browser-runnable
@stitchapi/reactstarters underexamples/stackblitz/:react-quickstartstitch()+useStitch— declare an endpoint once, call it as a hookreact-tanstack-querystitchQueryOptions— a stitch as a TanStack QueryqueryFn(complement, not a competitor)Openable in one click via
stackblitz.com/github/rejifald/StitchAPI/tree/main/examples/stackblitz/<name>(links go live once this lands onmain).Why
Part of the launch/growth push — lower the try-cost so people can run StitchAPI in the browser without local setup. The TanStack template also backs the positioning we're using in the TanStack Query community-resources listing (a
queryFncomplement, not a rival fetching lib).Notes
1.0.0-rc.4—stitchapi's npmlatesttag is a stale0.7.0, so exact pins are required or StackBlitz would install the old prototype.tsc --noEmitclean against the published rc packages; the repo's format/lint/typecheck/tether pre-commit + pre-push hooks pass.examples/is outside the pnpm workspace globs, so this doesn't touch the frozen lockfile.🤖 Generated with Claude Code