Skip to content

Conversation

@KevinBonnoron
Copy link

🎯 Changes

Add PocketBase integration for TanStack DB with the new @tanstack/pocketbase-db-collection package.

Features:

  • Real-time synchronization with PocketBase via subscriptions
  • Mutation support (insert, update, delete) with built-in handlers
  • Schema support (Zod, Valibot, etc.) with type inference and runtime validation
  • Automatic subscription cleanup management
  • Complete unit test coverage

Implementation:

  • Follows the same pattern as rxdb-db-collection for consistency
  • TypeScript overloads to distinguish schema vs non-schema cases
  • Error handling with automatic cleanup on failure

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).
Add @tanstack/pocketbase-db-collection package with support for real-time synchronization, mutations, and schema validation. Includes overloads for schema-based type inference following the same pattern as rxdb-db-collection.
Add comprehensive documentation for @tanstack/pocketbase-db-collection including usage examples, configuration options, real-time subscriptions, and mutation handling.
@changeset-bot
Copy link

changeset-bot bot commented Nov 22, 2025

⚠️ No Changeset found

Latest commit: cf089a9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@samwillis
Copy link
Collaborator

Hi @KevinBonnoron

Thanks for this!

As a general rule we will only add a new collection implementation to the db monorepo if it will be supported by the developers of the underlying backend. We need a commitment from them to ensure that the collection will be maintained and bugs fixed going forward. Could I ask if you are a core developer of PocketBase? If not you are welcome to reach out to them and see if they would be interested.

@KevinBonnoron
Copy link
Author

Hello @samwillis,

No I am not maintainer of pocketbase. Just a regular user.
I will ask them if they are interested.

Thanks.

Regards

@kevin-dp
Copy link
Contributor

@KevinBonnoron you can always open a PR to add a link to your collection repo the list of community packages in our docs.

@nathanstitt
Copy link

Hey @KevinBonnoron! great minds think alike, I literally just created https://github.com/nathanstitt/pbtsdb about the same time you opened this.

I took a slightly different approach and built on top of a schema that's generated by a tool like https://github.com/satohshi/pocketbase-schema-generator for the types and did not use any client-side validation with zod like you have. My implementation is completely typed though and supports most of the DB query operators.

I'd love to collaborate on a library if you'd be game for that?

@KevinBonnoron
Copy link
Author

@samwillis
Unfortunatly they said no. So I will close this PR.

@kevin-dp
Great idea, will probably do it.

@nathanstitt
Hey! Great lib you've made. I think I will probably take this code to a public repo. You're very welcome if you want to help 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants