Skip to content

Conversation

@drew-harris
Copy link
Contributor

@drew-harris drew-harris commented Jan 26, 2026

Adds 3 new starter templates of increasing complexity:

  • tanstack start: on par with the nextjs starter, includes todo list and presence
  • tanstack-start-full: includes protected routes, login page, cookie sync, instant user middleware for server functions
  • tanstack-start-with-tanstack-query: everything included with tanstack-start-full with full ssr setup using tanstack query to fetch on server and subscribe on client. includes isomorphic function to protect routes on the server and client

Also changed:
also removes the package-lock from the nextjs example project. Reason is that if you use pnpm overrides to use local packages, that will also add the override to the package.lock. The package-lock gets removed by create-instant-app anyway.

tanstack-start and tanstack-start-full added to create-instant-app

Operations with the instant-cli will work with these templates because they both use VITE_PUBLIC environment variables.

Review guide:

In the instant repo: cd examples/EXAMPLE-TO-TEST pnpm i instant-cli init pnpm run dev

and to test CIA: set the INSTANT_REPO_FOLDER env variable to the location of your instant repo and run CIA in dev mode with INSTANT_CLI_DEV

Testing examples with dev dependencies (not necessary for this pr)

create a pnpm-workspace.yaml file in the root of the example

overrides:
  "@instantdb/react": "file:../../client/packages/react"
  "@instantdb/react-common": "file:../../client/packages/react-common"
  "@instantdb/core": "file:../../client/packages/core"
  "@instantdb/admin": "file:../../client/packages/admin"
  "@instantdb/version": "file:../../client/packages/version"

When you change an @instantdb/package you must pnpm i in the example to copy the new code into node modules. The override copies from the monorepo folder instead of fetching the files from the web. There are no symlinks.

@github-actions
Copy link
Contributor

View Vercel preview at instant-www-js-drewh-tanstack-start-jsv.vercel.app.

@drew-harris drew-harris force-pushed the drewh/tanstack-start branch 6 times, most recently from 3b47f2d to d3c3474 Compare January 27, 2026 23:23
@drew-harris
Copy link
Contributor Author

drew-harris commented Jan 27, 2026

This PR depends on: #2229

@drew-harris drew-harris force-pushed the drewh/tanstack-start branch 8 times, most recently from f5e6404 to 7a41cc3 Compare January 29, 2026 18:58
@drew-harris drew-harris marked this pull request as ready for review January 29, 2026 19:11
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
Copy link
Contributor

Choose a reason for hiding this comment

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

Def something weird going on at least when testing:

If I have www running, somehow this still overwrites the port

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also now having this issue, can't find a way to fix.
not even this picked up on it https://vite.dev/config/server-options#server-strictport

<div className="text-xs text-center">
Open another tab to see todos update in realtime!
</div>
Secret data from server function:
Copy link
Contributor

Choose a reason for hiding this comment

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

May be nice to:
(a) make this look a little nicer
(b) add some small explanation. This demonstrate how to call the server

export const appId = process.env.NEXT_PUBLIC_INSTANT_APP_ID;

export const db = init({
appId: appId!,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if this fails, there's no indication in the UI.

console shows "Uncaught (in promise) Error: Instant must be initialized with an appId."

Would be nice if we showed this error somehow, so folks could tell Claude etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Working on a general solution in #2243

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.

4 participants