Project Structure in Svelte

From the SvelteKit cheat sheet · Setup & Project Structure · verified Nov 2026

Project Structure

SvelteKit file and folder organization

javascript
my-app/
├── src/
│   ├── routes/          # File-based routing
│   ├── lib/             # Shared code (#lib alias)
│   ├── app.html         # HTML template
│   ├── app.d.ts         # TypeScript definitions
│   ├── env.js           # Environment variable declarations
│   └── params.js        # Route param matchers
├── static/              # Static assets
├── tests/               # Playwright tests (if added)
├── package.json         # "imports" defines #lib
└── vite.config.js       # Vite + SvelteKit config
📁 File-based routing in src/routes
🔗 #lib alias for src/lib, declared in package.json imports
🎯 Special +page/+layout naming convention
⚙️ SvelteKit config lives in vite.config.js, not svelte.config.js

Continue with SvelteKit

Save the full cheat sheet or work through every related task.

More Svelte tasks

Back to the full SvelteKit cheat sheet