# SvelteKit — Streamlined Full-Stack Framework for Svelte
> SvelteKit is the official full-stack framework for Svelte. File-based routing, SSR/SSG/CSR, server actions, and type-safe data loading — built on top of Vite for blazing-fast development.
## Install
Save in your project root:
## Quick Use
```bash
# Create a new SvelteKit app
npm create svelte@latest my-app
cd my-app
npm install
npm run dev
```
## Intro
**SvelteKit** is the official full-stack framework for Svelte, the compiler-based UI framework that rivals React and Vue. It provides file-based routing, server-side rendering, static site generation, server actions, and adapters for every major hosting platform — all built on top of Vite for blazing-fast development experience.
With 20.4K+ GitHub stars and MIT license, SvelteKit has become the go-to choice for developers who want the elegance of Svelte with a complete application framework. It consistently ranks among the most loved frameworks in developer surveys.
## What SvelteKit Does
- **File-Based Routing**: Routes defined by file structure in `src/routes`
- **SSR/SSG/CSR**: Server-side rendering, static generation, or client-only rendering
- **Server Actions**: Form submissions handled on the server with progressive enhancement
- **Load Functions**: Type-safe server data loading for pages
- **Layouts**: Nested layouts with shared data
- **API Routes**: RESTful endpoints as file-based routes
- **Adapters**: Deploy to Vercel, Netlify, Cloudflare, Node, static hosting
- **Hot Module Replacement**: Instant updates via Vite
- **TypeScript**: First-class TypeScript support
- **Link Prefetching**: Automatic prefetching on hover
## Project Structure
```
my-app/
├── src/
│ ├── routes/ ← File-based routing
│ │ ├── +page.svelte ← Home page
│ │ ├── +layout.svelte ← Root layout
│ │ ├── about/
│ │ │ └── +page.svelte
│ │ └── blog/
│ │ ├── +page.svelte ← Blog list
│ │ ├── +page.server.ts ← Server data loader
│ │ └── [slug]/
│ │ ├── +page.svelte
│ │ └── +page.server.ts
│ ├── lib/ ← Shared utilities
│ │ ├── components/
│ │ └── db.ts
│ ├── app.html
│ └── hooks.server.ts ← Server hooks (auth, etc.)
├── svelte.config.js
└── vite.config.js
```
## Basic Components
### Simple Page
```svelte
Welcome to SvelteKit!
```
### Reactive Statements
```svelte
Hello, {fullName}!
```
## Data Loading
### Server Load Function
```typescript
// src/routes/blog/+page.server.ts
import type { PageServerLoad } from './$types';
import { db } from '$lib/db';
export const load: PageServerLoad = async () => {
const posts = await db.post.findMany({
orderBy: { createdAt: 'desc' },
take: 10,
});
return { posts };
};
```
```svelte