⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@bradleyshep
Copy link
Contributor

@bradleyshep bradleyshep commented Jan 22, 2026

Description of Changes

Adds a new Next.js quickstart template and documentation.

New Template (templates/nextjs-ts/):

  • Next.js 15 App Router with TypeScript SpacetimeDB module
  • Pre-configured SpacetimeDBProvider with client-side connection handling
  • Environment variable support (NEXT_PUBLIC_SPACETIMEDB_HOST, NEXT_PUBLIC_SPACETIMEDB_DB_NAME)
  • SSR-safe implementation with "use client" directives
  • Example page demonstrating useTable and useReducer hooks
  • Dev server runs on port 3001 to avoid conflict with SpacetimeDB on port 3000
  • Pre-generated module bindings included

New Documentation (docs/.../00200-nextjs.md):

  • 8-step quickstart consistent with other quickstarts (React, TypeScript, Rust, C#)
  • Covers: project creation, structure, tables/reducers, CLI testing
  • Next.js-specific: provider pattern, SSR considerations, env var configuration, React hooks usage

Updated templates-list.json:

  • Added nextjs-ts to highlights and templates list

API and ABI breaking changes

None.

Expected complexity level and risk

1 - Adds a new template and docs without modifying existing functionality.

Testing

  • Run spacetime dev --template nextjs-ts my-test-app and verify the app starts
  • Navigate to http://localhost:3001 and confirm the UI loads and connects
  • Add a person via the UI and verify it appears in the list
  • Verify env vars work: set NEXT_PUBLIC_SPACETIMEDB_URI and NEXT_PUBLIC_SPACETIMEDB_MODULE
  • Verify the quickstart doc renders correctly in the docs site
  • Confirm Next.js appears in the sidebar after React

@bradleyshep bradleyshep mentioned this pull request Jan 23, 2026
8 tasks

<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`.
Copy link
Contributor

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';
Copy link
Contributor

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.

Copy link
Contributor

@cloutiertyler cloutiertyler left a 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.
Copy link
Contributor

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.

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.

3 participants