Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Tip 🎯 Customize your risk assessments
✅ Automatic approvals, with your rules
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
🦋 Changeset detectedLatest commit: 56fbd08 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
281a0e6 to
56fbd08
Compare
|
Thanks, the version details and owner-scoped rules make this much easier to review. Two follow-ups from the draft before the local server checks:
|
Closes #527
Summary
Adds a built-in React add-on for PocketBase at
packages/create/src/frameworks/react/add-ons/pocketbase.tanstack create my-app --add-ons pocketbase(ortanstack add pocketbase) scaffolds:pocketbasedependency andsrc/lib/pocketbase.ts, which exports a browser client (pb) and acreatePocketBase()factory for per-request clients in server functions, so auth state is never shared between users on the server.VITE_POCKETBASE_URLin.env.local(defaults tohttp://127.0.0.1:8090).pb_migrations/1761955200_created_todos.jscreates an owner-scopedtodoscollection. It's applied automatically by./pocketbase serve.pocketbasebinary andpb_data/(local database and uploaded files)./demo/pocketbase, with email and password sign-in and a private realtime todo list (create / toggle / delete, live updates across tabs). It uses the standarddemo-*classes and theme variables. When the server isn't reachable, it shows setup steps instead of an empty page.tests-e2e/pocketbase-smoke.spec.ts, a@matrixsmoke test with a local server fixture, following the Strapi one.Metadata: category
database, exclusive withdatabase/orm(same as Convex),file-routermode. React + Vite only (Rsbuild currently accepts toolchain add-ons only).Versions
pocketbase@^0.28.2Permissions
Each todo has a required
ownerrelation to PocketBase's built-inuserscollection. Ownership is enforced by the collection's API rules on the server, not by the client:@request.auth.id != "" && owner = @request.auth.id@request.auth.id != "" && @request.body.owner = @request.auth.id@request.auth.id != "" && owner = @request.auth.id && (@request.body.owner:isset = false || @request.body.owner = @request.auth.id)owner, so a user can't create a todo for someone else or hand one over.listRule, so events only reach the owner.cascadeDeleteremoves a user's todos when the user is deleted.PocketBase's default
userscollection allows public sign-ups, which the demo relies on. The README calls this out, with a pointer to review it before deploying.Screenshot
Local setup and verification
No hosted backend is involved. From a directory next to the repo, after
pnpm install && pnpm build:pb-smoke.mjsWhat I ran
pnpm buildpnpm test:unit:@tanstack/cli135 of 135.@tanstack/create434 of 435:edge-import.test.tshits its 5s timeout in the full suite on my machine and passes alone. It also failed in 1 of 2 runs on a cleanmain, so it isn't caused by this change.@blockingsuite: 14 of 14pocketbase-smokespec: passestanstack create:npx tsc --noEmit,npm run lint(Biome) andnpm run buildtanstack add pocketbase:npm run build, thennpx tsc --noEmit(the route tree is generated by the build)./pocketbase migrate down 1andmigrate uppb-smoke.mjsagainst a real PocketBase v0.40.6 server, covering:owner+and+ownermodifiers@jsonPayloadbodies, array values, filters, a forged token and the batch API. No todo changed owner and no other user's data was reachable.Not covered
pb-smoke.mjs, which needs a real server.Notes
logo.svg(MIT).