-
Notifications
You must be signed in to change notification settings - Fork 679
Quickstart nextjs #4097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Quickstart nextjs #4097
Conversation
|
|
||
| <Step title="Understand the provider pattern"> | ||
| <StepText> | ||
| SpacetimeDB is client-side only — it cannot run during server-side rendering. The `app/providers.tsx` file uses the `"use client"` directive and wraps your app with `SpacetimeDBProvider`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as on the Remix PR.
| @@ -0,0 +1,71 @@ | |||
| 'use client'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this should be necessary.
cloutiertyler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same situation as with Remix
|
|
||
| <Step title="Open your app"> | ||
| <StepText> | ||
| Navigate to [http://localhost:3001](http://localhost:3001) to see your app running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should run on 3000. The quickstart should be connecting to Maincloud, not the local server.
Yours might be if you have your default set to local in the spacetime CLI.
Description of Changes
Adds a new Next.js quickstart template and documentation.
New Template (
templates/nextjs-ts/):SpacetimeDBProviderwith client-side connection handlingNEXT_PUBLIC_SPACETIMEDB_HOST,NEXT_PUBLIC_SPACETIMEDB_DB_NAME)"use client"directivesuseTableanduseReducerhooksNew Documentation (
docs/.../00200-nextjs.md):Updated
templates-list.json:nextjs-tsto highlights and templates listAPI and ABI breaking changes
None.
Expected complexity level and risk
1 - Adds a new template and docs without modifying existing functionality.
Testing
spacetime dev --template nextjs-ts my-test-appand verify the app startsNEXT_PUBLIC_SPACETIMEDB_URIandNEXT_PUBLIC_SPACETIMEDB_MODULE