Skip to content

Conversation

@jessa0
Copy link

@jessa0 jessa0 commented Jan 5, 2026

PartyKit was moved to cloudflare/partykit on github (from partykit/partykit), and the new packages had a 0.1.0 release two weeks ago. This PR migrates to the new partyserver package replacing partykit, and y-partyserver replacing y-partykit.

This probably needs a major version bump, as I didn't see any guarantee of compatibility with the old PartyKit, though it was pretty close to compatible, at least. Old clients will definitely not be compatible, as I decided to use YServer's new CustomMessage API instead of overriding onMessage, since the old way of sending playhtml-layer messages relied on PartyKit just incidentally not using text websocket messages. Please let me know if I should create a changeset.

Motivation: I am experimenting with playhtml, but wanted to deploy in the "cloud-prem" configuration (PartyKit on own cloudflare account). I got stuck with PartyKit not being able to deploy to a free Cloudflare account, and noticed advice from the PartyKit authors (but can't find the link to that conversation, sorry..) to migrate to cloudflare/partykit instead. So I went down that rabbit hole..

jessa0 added 3 commits January 4, 2026 20:57
PartyKit was moved to `cloudflare/partykit` on github (from
`partykit/partykit`), and the new packages had a 1.0.0 release two weeks
ago. This commit migrates to the new `partyserver` package replacing
`partykit`, and `y-partyserver` replacing `y-partykit`.

This probably needs a major version bump, as I didn't see any guarantee
of compatibility with the old PartyKit, though it was pretty close to
compatible, at least. Old clients will definitely not be compatible, as
I decided to use YServer's new CustomMessage API instead of overriding
onMessage, since the old way of sending playhtml-layer messages relied
on PartyKit just incidentally not using text websocket messages.
We check in only the generated types without the runtime. This means
there are still some type errors related to the Cloudflare Workers API,
because we are still using `@cloudflare/worker-types`, which has been
deprecated.
Fix onLoad discarding the newly loaded document
@jessa0
Copy link
Author

jessa0 commented Jan 6, 2026

Fixed a bug with loading from DB. I haven't tested this PR with supabase yet (I probably will this week).

@spencerc99
Copy link
Owner

thanks for making this! my main worry with that we don't run into any data loss. im gonna check in with the partytkit authors to get a second pair of eyes

"changeset": "changeset",
"version-packages": "changeset version",
"release": "bun run build-packages && changeset publish",
"generate-types": "bunx wrangler types --include-runtime=false",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice good catch

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd probably be even better to do --include-runtime=true as well, since @cloudflare/worker-types is mostly deprecated, and there seemed to be a couple type errors I couldn't seem to fix with @cloudflare/worker-types as well.. I just wanted to run that by you first. That flag generates more accurate types for the entire runtime, based on the compatibility_date you set in the wrangler config.

If you wanna do that, I'd also ask if you rather have the worker-configuration.d.ts checked in to the repo or generated at compile-time.

@jessa0
Copy link
Author

jessa0 commented Jan 12, 2026

thanks for making this! my main worry with that we don't run into any data loss. im gonna check in with the partytkit authors to get a second pair of eyes

That makes sense. I can also give it a second pass with data migration in mind if you want, as I didn't really do that for this draft.

@spencerc99
Copy link
Owner

hi @jessa0 sorry for the delay here! couldn't get a hold of the partykit folks but i think it should be fine since im persisting the data separately anyways.

going to actually take a look this week. thanks for putting this up again!

@spencerc99
Copy link
Owner

@jessa0 im actually curious - could you try deploying this as you originally desired and swapping in your provider URL for use with the playhtml library and seeing if everything works?

If there is danger of compatibility for me switching the main partykit server while the partyserver package is still in development to parity, we can hold off on merging this in, but that doesn't stop you from using this version to do your own on-prem since you'd just be swapping in the provider URL

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants