Skip to main content
ProductsDesktop toolsTASTECADDrawing reviewTASTEFILESFile managementTASTEFTPFile transferTASTESSHRemote workspaceTASTEZIPCompression and extractionTASTEWINMFile managementDeveloper toolsTASTECODERust integrated development environmentTASTESTUDIOIntegrated development and test environmentTASTEETLData integration (ETL)ServersTASTEREMOTERemote desktop serverTASTEGEOGeospatial serverTASTEMAILMail workspaceInvestingTASTESTOCKStock auto-trading desktop appGet startedDownloadsDocumentationBuyAll products
Marketplace
News
TechNewsToday's dev newsDeveloper docsProgramming languagesRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp & desktop frameworksTauriFlutterReact NativeElectronAlgorithmsAlgorithm basicsCore algorithmsAdvanced algorithmsPractical algorithms
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcaseCommunity guide
Work with usTech transferWebsite buildDesktop app buildRelease and payment pipelineSales partnerContact
ServicesRemote desktopCustom installer packages
TASTEDEV
Products

Desktop tools

TASTECADComplex drawings, opened with easeTASTEFILESJust the files you need, as fast as possibleTASTEFTPThe tidiest path for your filesTASTESSHA stronger link between you and your serversTASTEZIPPack faster, unpack saferTASTEWINMA keyboard-first file manager with two panes

Developer tools

TASTECODEEdit, build, debug and test Rust apps in one windowTASTESTUDIOFrom editing to remote tests and approved AI fixesTASTEETLMove data while you watch the values

Servers

TASTEREMOTEA remote desktop you run on your own serverTASTEGEORebuilding a GeoServer-compatible geospatial server in RustTASTEMAILTake back control of your email

Investing

TASTESTOCKStock auto-trading that follows the rules you set: when, and what

Get started

DownloadsLatest builds of every productDocsHow to use each productBuySubscriptions and perpetual licencesAll productsEvery product at a glance
All products
MarketplaceNews
Tech

News

Today's dev newsOfficial announcements on languages, frameworks, GitHub and AIDeveloper docsGuides to languages, frameworks and algorithms

Programming languages

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App & desktop frameworksTauriFlutterReact NativeElectron

Algorithms

Algorithm basicsComplexity analysis · Sorting · Searching · Basic data structures · Trees and heapsCore algorithmsGraph traversal · Shortest paths & minimum spanning trees · Dynamic programming · Greedy algorithms · Divide and conquer · BacktrackingAdvanced algorithmsString algorithms · Math and number theory · Bit manipulation · Segment trees · Union-findPractical algorithmsCoding interview strategy · LRU cache · Rate limiting · Consistent hashing
All development docs
Community
ProjectsDiscover builders and their workDevelopment logsDecisions and lessons learnedPromptsReusable instructionsAI tool issuesProblems and workarounds for Claude, Codex, GeminiShowcaseFinished resultsCommunity guideHow we build in the open
Work with us
Tech transferNative apps in Rust and eguiWebsite build10 languages, accounts, docs and downloadsDesktop app buildRust and egui, no WebViewRelease and payment pipelineSigning, MSI, deb, rpm, AppImage, hashesSales partnerRecommend us and earn 30%ContactBuilds, partnerships and investment
Services
Remote desktopReach your computer from a browserCustom installer packagesOnly the features you need, settings preloaded
Buy
EN
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Log in
Log in
TASTEDEV

From small tools to better development.

support@tastedev.netSupport TASTEDEV
ProductsProduct lineupBuyDocsDownloadsMarketplaceSupport
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcase
PoliciesAbout usPrivacy policyTerms of serviceSubscription termsRefund policyCommunity guidelines
AccountLog inSign up
Visitors
Today
Yesterday
Total views
Company
GXSOFT
Representative
CHOI YOUNG GU
Business registration number
853-44-00368
Address
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Phone
+82-10-4404-1523
Email
whitecalvin@tastedev.net
Privacy officer
CHOI YOUNG GU

© 2026 TASTEDEVProduct information is based on verified development sources.Released · improving

SvelteKit docs
SvelteKit
Getting Started with SvelteKitProject StructureCore ConceptsData and StateTestingBuilding and Deployment
Discussions

SvelteKit guide · 2/6

Project Structure

SvelteKit relies on conventions: folder and file names decide how your app behaves. This chapter walks through the layout of a new project, its configuration files and the naming rules for routes.

The default layout

A TypeScript project created with sv create looks roughly like this:

my-app/
  src/
    lib/                 # shared code and components
      server/            # server-only code
    routes/              # pages and endpoints (URL = folder structure)
      +layout.svelte
      +page.svelte
    app.html             # HTML template
    app.d.ts             # app-wide types (App.Locals and friends)
    hooks.server.ts      # server hooks (optional)
    hooks.client.ts      # client hooks (optional)
    params.ts            # route parameter matchers (optional)
  static/                # files served as-is (robots.txt, favicon)
  tests/                 # Playwright tests, if you added them
  package.json
  tsconfig.json
  vite.config.ts

Only src/routes and src/app.html are required; everything else is optional. The .svelte-kit/ folder is generated by the dev server and the build. You can delete it at any time, and it should not be committed.

Configuration lives in vite.config.ts

SvelteKit options are passed to the sveltekit() plugin in vite.config.ts. Older releases used a separate svelte.config.js, which the current release no longer supports, so keep that in mind when reading older tutorials. Adapters, paths, CSRF settings and other SvelteKit options all go here.

import adapter from '@sveltejs/adapter-auto';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [
    sveltekit({
      adapter: adapter()
    })
  ]
});

Regular Vite settings, such as the server port, proxies or extra plugins, go into the same defineConfig call.

The #lib alias and package.json

Code in src/lib is imported through the #lib alias. It is a Node.js subpath import, so it is declared in the imports field of package.json, and imports include the file extension.

{
  "type": "module",
  "imports": {
    "#lib": "./src/lib/index.js",
    "#lib/*": "./src/lib/*"
  }
}
import { formatDate } from '#lib/date.js';
import Button from '#lib/components/Button.svelte';

When you come across examples using the older $lib alias, read them as #lib plus an explicit extension. tsconfig.json extends the configuration SvelteKit generates, and your project decides which files to include.

Route file conventions

Each folder inside src/routes becomes a URL segment, and files starting with + define what that route does.

FilePurpose
+page.svelteThe page UI
+page.tsPage data loading (runs on the server and in the browser)
+page.server.tsServer-only data loading and form actions
+layout.svelteA shared shell around child pages
+layout.ts, +layout.server.tsLayout data
+server.tsAn API endpoint (GET, POST and so on)
+error.svelteThe error page

Folder names follow conventions too. [slug] is a dynamic parameter, [[lang]] is an optional parameter, [...rest] matches the rest of the path, and a folder in parentheses such as (group) does not appear in the URL; it only groups routes under a shared layout.

src/routes/
  (marketing)/
    +layout.svelte       # shared shell for marketing pages
    pricing/+page.svelte # /pricing
  blog/
    +page.svelte         # /blog
    [slug]/
      +page.svelte       # /blog/hello-world
      +page.server.ts
  api/
    search/+server.ts    # /api/search

Param matchers and hooks

To validate route parameters, define matchers in a single src/params.ts file. A matcher returns the value when it is acceptable and undefined otherwise.

import { defineParams } from '@sveltejs/kit/params';

export const params = defineParams({
  fruit: (param) => (param === 'apple' || param === 'orange' ? param : undefined)
});

With this in place, src/routes/fruits/[name=fruit]/+page.svelte matches only apple and orange. Code that should run around every request belongs in the handle function of src/hooks.server.ts; later chapters show how to put per-request values, such as the signed-in user, on event.locals.

Summary

  • Pages and endpoints live in src/routes, shared code in src/lib, and static files in static.
  • SvelteKit is configured through the sveltekit() plugin options in vite.config.ts.
  • Import from src/lib with the #lib alias and an explicit file extension.
  • The +page, +layout, +server and +error files, together with [param] and (group) folders, define your routing.
Questions about this chapter?
Previous chapterGetting Started with SvelteKitNext chapterCore Concepts

0 comments

Top commentsNewest first

Sign in · Sign in to leave a comment.