SvelteKit with TailwindCss and Skeleton

byย @pitchinnate ยท ๐Ÿ–ฅ๏ธ Coding ยท 8d ago ยท 57 views

Works great with a static sveltekit frontend with a separate backend api. Utilizes TailwindCss and Skeleton components.

Claude SvelteKittypescriptcoding
coding ยท 111 lines
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

---

## Commands

### Development

```bash
# Start development server
pnpm dev

# Build for production
pnpm build

# Preview production build
pnpm preview

# Type check (svelte-check)
pnpm check

# Format code (prettier)
pnpm format
```

### Linting

```bash
# Check linting (prettier + eslint)
pnpm lint
```

---

## Project Structure

```
frontend/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ lib/              # Shared library code
โ”‚   โ”‚   โ”œโ”€โ”€ api/          # API client (auth endpoints, fetch wrapper)
โ”‚   โ”‚   โ””โ”€โ”€ assets/       # Static assets (favicon)
โ”‚   โ”œโ”€โ”€ routes/           # SvelteKit pages (file-based routing)
โ”‚   โ”‚   โ”œโ”€โ”€ +layout.svelte  # Root layout with Tailwind + Skeleton CSS
โ”‚   โ”‚   โ””โ”€โ”€ +page.svelte    # Home page
โ”‚   โ”œโ”€โ”€ +app.html         # App HTML template (base HTML)
โ”‚   โ”œโ”€โ”€ app.d.ts          # App TypeScript declarations
โ”‚   โ””โ”€โ”€ layout.css        # Global styles (Tailwind + @skeletonlabs)
โ”œโ”€โ”€ .svelte-kit/          # Build artifacts (generated)
โ”œโ”€โ”€ package.json          # Dependencies + scripts
โ”œโ”€โ”€ svelte.config.js      # SvelteKit + static adapter config
โ”œโ”€โ”€ tsconfig.json         # TypeScript config (extends .svelte-kit/tsconfig.json)
โ”œโ”€โ”€ vite.config.ts        # Vite config (Tailwind + SvelteKit plugins)
โ””โ”€โ”€ README.md             # Project documentation
```

---

## Architecture

### SvelteKit + Svelte 5

- **Framework**: SvelteKit 2.50.2 with Svelte 5.51.0 (runes, `$state`, etc.)
- **Routing**: File-based routing in `src/routes/`
- **Adapter**: Static adapter (deployed as static files)

### Styling

- **Tailwind CSS 4**: Loaded via Vite plugin and `@import` in `layout.css`
- **Skeleton UI**: `@skeletonlabs/skeleton` + `@skeletonlabs/skeleton-svelte` theme: `cerberus`

Skeleton docs can be found at ./docs/llms-svelte.txt

### API Layer

`src/lib/api/api.ts` provides:

- `register()`, `login()` - Auth endpoints
- `getAuthHeader()` - Bearer token headers
- `getAccessToken()`, `setAccessToken()`, `clearAccessToken()` - Token management via localStorage
- Default API URL: `http://localhost:8080/api` (from `VITE_API_URL` env var)

---

## Configuration Files

- `svelte.config.js`: Static adapter, disables runes in node_modules
- `tsconfig.json`: Strict TS mode, `rewriteRelativeImportExtensions: true`
- `vite.config.ts`: Tailwind + SvelteKit plugins

---

## MCP Server

Svelte MCP server provides:

- `list-sections`: Discover Svelte 5/SvelteKit documentation
- `get-documentation`: Fetch Svelte docs by title or path
- `svelte-autofixer`: Analyze and fix Svelte code issues
- `playground-link`: Generate Svelte Playground links

---

## Development Tools

- **Prettier**: Formatter (with Svelte + Tailwind plugins)
- **ESLint**: Linter with Svelte plugin
- **TypeScript**: Strict mode, bundler resolution
- **Vite**: Build tool + dev server
submitted March 25, 2026