Everything you need to build a Svelte project, powered by sv.
Get started with Svelte and SvelteKit:
Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
To create a production version of your app:
npm run build
You can preview the production build with npm run preview.
To deploy your app, you may need to install an adapter for your target environment.
At its core, SvelteKit’s job boils down to three things:
For more information, checkout tutorial: https://svelte.dev/tutorial/kit/page-data
Data flow:
+layout.server.ts, +layout.ts+page.server.ts, +page.tsReference:
https://svelte.dev/docs/kit/load
https://svelte.dev/docs/kit/load#Universal-vs-server
https://svelte.dev/docs/kit/routing
For this project:
Genenral:
src/hooks.server.ts: Hooks running for every requestLibrary/utility:
lib/server: Code for authentication, server-side actionlib/component: Reusable componentRouting:
routes/(auth)/*: Protected route here, need logged inroutes/login/*: Login pageGlobal state management:
store/writable.ts: For traditional stores, using writable()store/runes/*.svelte.ts: For global state reactivity with $state() of Svelte5Extension: Svelte for VS Code
Recommend config for VS Code:
{
"explorer.sortOrder": "filesFirst",
"workbench.tree.indent": 12,
"workbench.tree.renderIndentGuides": "always"
}