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@latestSetup
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.
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
/__nextgen/* requests to the backend, attaching the project secret only to the session handoff.event.locals.nextgenAuth; read it with getAuth(getRequestEvent()!) in a server function.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
/loginand register a user. - Confirm
/profileshows signed-in state. - Log out and confirm
/profileredirects to/login.
See also
- SDK proxy — why
/__nextgen/*must be same-origin and which call carries the project secret. @zitadel/sdk-solid-startsource and the CLI SolidStart patcher.
Was this helpful?