Docs

SolidStart SDK

Request middleware and helpers for SolidStart applications.

The SolidStart SDK is request middleware that proxies and verifies sessions on the server. The login and logout widgets come from the Solid SDK.

Generated setup

The CLI targets SolidStart 2. It writes src/middleware.ts, registers it in vite.config.ts, and writes the backend URL, the project secret, and the project id to .env.local.

Install

pnpm add @zitadel/sdk-solid-start@latest @zitadel/sdk-solid@latest

Setup

The CLI adds the middleware, the routes, environment files, and both SDK packages, and points the solidStart() plugin in vite.config.ts at the middleware.

src/middleware.ts
src/routes/index.tsx
src/routes/login.tsx
src/routes/register.tsx
src/routes/profile.tsx
vite.config.ts
.env.local
.env.example
package.json

Every setup also writes zitadel.json and the .zitadel/ folder, adds its entries to .gitignore, and adds managed sections to AGENTS.md and README.md.

Runtime model

The middleware proxies same-origin /__nextgen/* requests to the backend, attaching the project secret only to the session handoff.
It verifies the session token and puts the result on event.locals.nextgenAuth; read it with getAuth(getRequestEvent()!) in a server function.
It redirects unauthenticated requests for protectedRoutes to loginPath, with the requested path and query string in ?next=, where the login widget returns after sign-in.

Nitro loads .env and .env.local into process.env in development, so the middleware finds ZITADEL_URL, ZITADEL_PROJECT_SECRET, and ZITADEL_PROJECT_ID there. Only VITE_-prefixed variables reach the browser.

Verify

  • Start the app with npm run dev. Setup already wrote the URL, the secret, and the project id to .env.local.
  • Visit /login and register a user.
  • Confirm /profile shows signed-in state.
  • Log out and confirm /profile redirects to /login.

See also

Was this helpful?