Skip to content

Deploy your poll app

PartyKit hosts the real-time server but you can host your website at any deployment platform of your choosing.

While you don’t need separate repositories for the client and the PartyKit server, you will need to deploy them separately.

Deploy PartyKit server

To deploy your PartyKit server run the following command in your project directory:

Terminal window
npx partykit deploy

When the deployment completes, you will get your app’s PartyKit URL. You will need this URL when deploying your Next.js app. The URL will follow the pattern of [your project's name].[your GitHub username]

To read more about deploying PartyKit apps, check our guide.

Deploy the Next.js app

You will most probably deploy this specific Next.js app to Vercel, in which case you can follow the Vercel deployment guide.

Please remember to also set the environment variables mentioned (such as NEXT_PUBLIC_PARTYKIT_HOST with the URL generated when deploying the PartyKit server in the previous step). To do so, you can follow the Vercel guide on secrets management.

In the example repository, we’ve included an .env.example file that contains the environment variables you need to set.

Next steps

Congratulations! You’ve finished the tutorial and built your first PartyKit app 🥳

You may have noticed that your users can vote multiple times. To keep this tutorial short, we have omitted integrating authentication. However, we have prepared a reference for you in this GitHub pull request.

⭐️ You can also explore PartyKit by:

Thank you for coming along on this journey with us 🥰