SvelteKit 3.1

Last reviewed Oct 25, 2026

Export as PDF

Prompt Details

Prompt Composition

5prompts
  1. JavaScript ES2026102 lines · 3.1K tokens
  2. TypeScript 6.044 lines · 1.3K tokens
  3. Svelte 5.5762 lines · 2.2K tokens
  4. Node.js 24101 lines · 5.3K tokens
  5. SvelteKit 3.167 lines · 3.2K tokens
Total376 lines · 15.1K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 73
  • 78
  • 79
  • 88
  • 89
  • 95
  • 113
  • 117
  • 200
  • 201
  • 203
  • 208
  • 209
  • 214
  • 250
  • 295
  • 297
  • 307
  • 319
  • 323
  • 330
  • 338
  • 346
  • 347
  • 352
  • 354
  • 362
  • 367
  • 377
  • 384
  • 426
  • 444
  • 459
  • 471
  • 488
  • 494
  • 502
  • 524
  • 532
  • 552
  • 601
  • 602
  • 613
  • 614
  • 639
  • 653
  • 732
  • 770
  • 772
  • 807
  • 829
  • 838
  • 862
  • 863
  • 908
  • 915
  • 916
  • 918
  • 922
  • 942
  • 943
  • 1004
  • 1021
  • 1275
  • 1321
  • 1333

Prompt Preview

Apply the Svelte 5.57, Node.js 24, TypeScript 6.0, and JavaScript ES2026 prompts first. These rules cover SvelteKit's server and browser boundaries. Apply Node adapter settings only to Node deployments; verify equivalent controls in other adapters.

Configuration and private code

  • Put SvelteKit configuration, including csrf, csp, paths.origin, and experimental, in the sveltekit(...) Vite plugin in vite.config.js. Review the effective production configuration; svelte.config.js is no longer read. Match Svelte, Vite, the Svelte Vite plugin, TypeScript, and adapter peer requirements to the deployed toolchain.
  • Keep secrets and privileged helpers in server-only modules: src/lib/server (importable as #lib/server when the package imports alias is configured), another server directory outside src/routes and static, or a filename with a server segment. Keep them out of universal loads and components, including indirect imports. Build with TEST unset because that setting disables illegal server-import detection.
  • Read private values from $app/env/private when using explicit environment variables, or from the private $env modules. Reserve env.publicPrefix for values safe to ship to the browser; static values are embedded at build time, while dynamic values cannot be used while prerendering. For explicit variables, declare and validate security-sensitive values in src/env.ts with defineEnvVars from @sveltejs/kit/env; leave secrets public: false.

Authentication, authorization, and routing

  • Verify session cookies or bearer tokens