Svelte & SvelteKit (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
SvelteKit Server-Only Security Boundaries: `$env/static/private` and `+server.ts`.
senior LevelSecurity & AuthSystem DesignSvelte 5
In Simple Words: SvelteKit strictly isolates sensitive secrets:
$env/static/private: Compiles environment variables into server bundles. If any client-side file imports from a private environment module, the SvelteKit build immediately throws a compile-time security error.$env/static/public: Only variables prefixed withPUBLIC_can be sent to client bundles.- Standalone API Endpoints (
+server.ts): Export HTTP verbs (GET,POST,PUT,DELETE) for REST APIs.