Svelte启动器

my-sveltekit-starter — Svelte 启动器模板

作者 moisesvalero

面向 AI 编程助手协作的 SvelteKit 启动器,内置 Svelte 5 Runes、TypeScript、Tailwind CSS v4,以及可选的认证、数据库与支付模块。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

2 个预览视图
桌面端首页1 / 2
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

全部页面与视图 2

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-09-30查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

基于 Svelte 5 Runes 与 SvelteKit 2,使用 TypeScript 编写

02

内置面向 AI 编程助手的分层规则文件(根 AGENTS.md 与模块级 AGENTS.md)

03

集成 Tailwind CSS v4 与 shadcn-svelte 风格组件层

04

提供 SEO/GEO/AEO 端点:sitemap、robots、llms.txt、Markdown 镜像与 JSON-LD

05

可选接入 Better Auth、Prisma、Polar/Stripe、Sanity、Supabase 与 Sentry

06

配置 oxlint、knip、svelte-check、Prettier、Vitest 与构建验证脚本

模板详细介绍

该模板基于 SvelteKit 2 与 Svelte 5 Runes,使用 TypeScript 编写,样式层采用 Tailwind CSS v4 与 shadcn-svelte 风格的组件。它面向与 AI 编程助手(如 Claude Code、Cursor、Codex、OpenCode、Antigravity、Gemini)协作的工作流,在仓库根目录提供 AGENTS.md,并在认证、支付、安全等子目录放置局部规则文件,同时通过 oxlint、knip、svelte-check、Prettier、Vitest 和构建步骤组成验证脚本。

功能层面包含 ES/EN 国际化、暗色模式、提示消息、Cookie 同意与响应式布局,集中式 SEO 配置支持 Open Graph、Twitter 卡片、规范链接与 JSON-LD,并生成 sitemap、robots、llms.txt 和 Markdown 镜像端点。安全方面配置了安全响应头、CSP、HSTS、框架保护和 Cookie 默认值。认证、数据库与支付(Better Auth、Prisma、Polar/Stripe)以及 Sanity、Supabase、Sentry 均为可选模块,默认演示不需要 .env 文件即可运行。

使用限制包括:需要 Node.js 22 或更新版本;默认演示不依赖本地数据库或 Docker;外部服务(域名、托管、数据库、支付、AI 等)可能产生额外费用;演示图片、字体、图标等第三方素材需按各自许可单独核对。

Svelte启动器

适合你的项目吗?

适用场景

  • 希望以 SvelteKit 与 Svelte 5 Runes 快速搭建网站或产品界面的项目
  • 需要与 AI 编程助手协作、并希望仓库内带有明确规则文件的开发流程
  • 需要国际化、暗色模式、Cookie 同意与集中式 SEO 配置的站点
  • 计划后续接入认证、数据库或支付能力,但希望先以无外部依赖方式启动的项目

适合人群

  • 使用 SvelteKit 与 TypeScript 的前端或全栈开发者
  • 习惯在编辑器或终端中使用 AI 编程助手的团队与个人
  • 需要 SEO、AEO 与多语言基础配置的网站项目
  • 希望以 MIT 许可代码为基础进行修改与分发的使用者

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    需要 Node.js 22 或更新版本。

  2. 2

    默认演示无需 .env 文件,安装依赖后可直接启动开发服务器。

  3. 3

    认证、数据库、支付、Sanity、Supabase、Sentry 等模块为可选,按需配置。

  4. 4

    本地 PostgreSQL 容器为可选,通过 docker:up 与 docker:down 脚本管理。

  5. 5

    分发代码副本或实质性部分时,需保留原作者版权声明和完整 MIT 许可声明。

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 使用该模板需要 Node.js 22 或更新版本,低于该版本的运行环境无法直接使用。
  • 启用 Sanity、Supabase、Sentry、Resend 等可选服务时需配置 .env 环境变量;默认演示无需 .env。
  • 接入 Sanity、Supabase、Resend 等服务需要自行申请并配置对应的 API 密钥或凭据。
  • 部署到 Vercel 或 Netlify 等托管平台时需自行注册账号并配置生产环境变量,可能产生托管费用。
  • 支付与账本模块依赖 Polar 或 Stripe 等第三方支付服务,启用时需自行开通账号并可能产生交易费用。
  • 启用第三方分析或在线客服等外部服务时,需要自行调整 CSP 允许列表,并可能产生额外费用。
  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

Requirements: Node.js 22 or newer.

README 原文

Copy `.env.example` to `.env` when enabling services:

README 原文

Treat `SANITY_READ_TOKEN`, `SUPABASE_ANON_KEY` and `RESEND_API_KEY` as environment-specific credentials.

README 原文

Connect the repository to Vercel and set `PUBLIC_SITE_URL` to the production URL.

README 原文

Payments & Ledger | Polar (Merchant of Record) and Stripe with atomic credit ledger

README 原文

If you enable third-party analytics or live chat, update CSP allowlists deliberately.

README 原文
https://github.com/moisesvalero/my-sveltekit-starter/blob/main/LICENSEhttps://github.com/moisesvalero/my-sveltekit-starter/blob/main/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-01。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 83 / 100
技术栈
Svelte
网站类型
启动器
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-09-26
截图检查日期
2026-10-01

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Svelte。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。

查看当时使用的来源资料

SHA-256: 8861524cd93c852931d72b58a1203e30ff96f4c221aafafc81aa752a74f4e412

2026-10-01T15:12:50.223Z

来源文件 / 仓库
<div align="center">

# My SvelteKit Starter ⚡️

### Production-ready SvelteKit 2 & Svelte 5 template engineered for collaboration with AI coding agents

A lightweight, high-performance foundation built from the ground up for developer-agent workflows (Claude Code, Cursor, Codex, OpenCode, Antigravity, Copilot, Gemini). Pre-configured with Svelte 5 Runes, strict boundaries, modular agent instructions, instant Rust tooling, and full-stack capabilities.

[![Svelte 5](https://img.shields.io/badge/Svelte-5-FF3E00?style=for-the-badge&logo=svelte&logoColor=white)](https://svelte.dev)
[![SvelteKit 2](https://img.shields.io/badge/SvelteKit-2-FF3E00?style=for-the-badge&logo=svelte&logoColor=white)](https://kit.svelte.dev)
[![TypeScript](https://img.shields.io/badge/TypeScript-5-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![Tailwind CSS v4](https://img.shields.io/badge/Tailwind_CSS-v4-38BDF8?style=for-the-badge&logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
[![Better Auth](https://img.shields.io/badge/Better_Auth-Enterprise-black?style=for-the-badge&logo=auth0&logoColor=white)](https://better-auth.com)
[![Prisma ORM](https://img.shields.io/badge/Prisma-7-2D3748?style=for-the-badge&logo=prisma&logoColor=white)](https://prisma.io)
[![Polar.sh](https://img.shields.io/badge/Polar.sh-Billing-0052FF?style=for-the-badge&logo=polar&logoColor=white)](https://polar.sh)
[![Oxlint](https://img.shields.io/badge/Oxlint-Rust_Fast-FF7A00?style=for-the-badge&logo=rust&logoColor=white)](https://oxc.rs)
[![Vitest](https://img.shields.io/badge/Vitest-ready-6E9F18?style=for-the-badge&logo=vitest&logoColor=white)](https://vitest.dev/)
[![License: MIT](https://img.shields.io/badge/License-MIT-success?style=for-the-badge)](./LICENSE)

<br />

[🌐 **Live Demo**](https://my-sveltekit-starter.vercel.app/) • [🇪🇸 **Inicio Rápido**](./INICIO_RAPIDO.md) • [⚡ **Deploy on Vercel**](https://vercel.com/new/clone?repository-url=https://github.com/moisesvalero/my-sveltekit-starter) • [⭐ **Star on GitHub**](https://github.com/moisesvalero/my-sveltekit-starter)

<br />

<img src="static/screenshots/home-desktop.png" alt="Home page preview of My SvelteKit Starter" width="100%">

<br />

<img src="static/screenshots/components-desktop.png" alt="Component gallery preview of My SvelteKit Starter" width="100%">

</div>

---

## 🤖 Why This Template for AI Coding Agents?

Most starter templates are built solely for human developers, ignoring how LLMs parse codebases. This template is architected specifically to maximize the reasoning power, accuracy, and execution speed of AI coding assistants:

- **Svelte 5 Runes Native**: Crystal-clear state management using modern `$state`, `$derived`, and `$effect`, making reactive logic predictable and trivial for AI models to reason about without reactivity bugs.
- **Context-Window Optimized**: No barrel files (`index.ts`) in internal modules, preventing token bloat and circular dependencies. All rule files are strictly under 32 KB.
- **Hierarchical Agent Rules**: Root `AGENTS.md` establishes overarching Svelte 5 patterns, while local domain rules (`src/lib/auth/AGENTS.md`, `src/lib/payments/AGENTS.md`, `src/lib/security/AGENTS.md`) guide agents with laser focus.
- **Sub-10ms Feedback Loop**: Powered by **Oxlint** in Rust alongside `svelte-check`. Agents get instant static analysis feedback in milliseconds instead of waiting for heavy legacy tooling.
- **Strict Quality Gates**: `pnpm run verify` and `pnpm run verify:release` provide agents with clear automated verification to self-audit their work before declaring a task complete.
- **Agent Skill Integrations**: Built-in scripts for `autoskills` and `impeccable` to install domain-specific workflows and design auditing directly in the agent workspace.
- **AEO Native (AI Engine Optimization)**: Ships with `llms.txt`, machine-readable Markdown twins, and search metadata so external AI models can discover and reason about your site.
- **Zero-Bloat Boot**: Clones and boots in seconds without forcing local databases or Docker containers. Full-stack modules (Better Auth, Prisma 7, Polar/Stripe) are completely decoupled and opt-in.

---

## Why This Starter

Most starters stop at routing and styling. This one is built for shipping a real website or product surface quickly:

- Svelte 5 runes and SvelteKit 2 with TypeScript.
- Tailwind CSS v4 with a shadcn-svelte inspired component layer.
- ES/EN i18n, dark mode, toasts, cookie consent and responsive layout.
- Central SEO store with Open Graph, Twitter cards, canonical URLs and JSON-LD.
- GEO/AEO endpoints for modern AI discovery: `llms.txt`, Markdown twins and content negotiation.
- Security headers, CSP, HSTS in production, frame protection and strict cookie defaults.
- Optional Sanity, Supabase and Sentry wiring without making them mandatory.
- CI, Husky, lint-staged, oxlint, knip, Vitest and `svelte-check` already configured.

## Stack

| Area              | Included                                                         |
| ----------------- | ---------------------------------------------------------------- |
| Framework         | SvelteKit 2, Svelte 5 runes                                      |
| Language          | TypeScript                                                       |
| Styling           | Tailwind CSS v4, design tokens, shadcn-svelte style components   |
| UI primitives     | bits-ui, mode-watcher, @lucide/svelte, svelte-sonner             |
| Quality           | oxlint, knip, Prettier, svelte-check, Vitest                     |
| SaaS Auth         | Better Auth (Admin roles, impersonation, B2B orgs, TOTP 2FA)     |
| Database & ORM    | Prisma ORM with PostgreSQL adapter & visual Prisma Studio        |
| Payments & Ledger | Polar (Merchant of Record) and Stripe with atomic credit ledger  |
| SEO/GEO/AEO       | sitemap, robots, Open Graph, JSON-LD, `llms.txt`, Markdown twins |
| Optional services | Sanity CMS, Supabase, Sentry                                     |
| Deploy            | Vercel adapter, Netlify config included                          |

## Quick Start

Requirements: Node.js 22 or newer.

```bash
pnpm install
pnpm run agent:skills
pnpm run dev
```

Open `http://localhost:5173`.

You do not need a `.env` file for the default demo. The app runs in zero-bloat mode immediately.

## Working with AI Agents

1. Clone this template for any new SvelteKit project.
2. Open the project directory in your preferred AI-powered editor or terminal agent (e.g. Claude Code, Cursor, Codex, OpenCode, Antigravity, Gemini).
3. Prompt your agent to read [AGENTS.md](file:///AGENTS.md) before making any code modifications.
4. Run `pnpm run agent:skills` to let `autoskills` detect your environment and install helpful agent skills.
5. Before completing any task, always ask the agent to run `pnpm run verify` or `pnpm run verify:release`.

## Scripts

| Command                     | Purpose                                                             |
| --------------------------- | ------------------------------------------------------------------- |
| `pnpm run dev`              | Start the Vite development server                                   |
| `pnpm run build`            | Create a production build                                           |
| `pnpm run preview`          | Preview the production build locally                                |
| `pnpm run format:check`     | Check formatting with Prettier                                      |
| `pnpm run format`           | Format project files                                                |
| `pnpm run lint`             | Run oxlint static analysis                                          |
| `pnpm run knip`             | Find unused dependencies, exports and files                         |
| `pnpm run check`            | Run `svelte-check` with the project tsconfig                        |
| `pnpm test`                 | Run Vitest                                                          |
| `pnpm run db:generate`      | Generate Prisma client types                                        |
| `pnpm run db:push`          | Push schema changes to database                                     |
| `pnpm run db:migrate`       | Run Prisma migrations in development                                |
| `pnpm run db:studio`        | Open Prisma Studio web visual database viewer                       |
| `pnpm run docker:up`        | Start optional local PostgreSQL container                           |
| `pnpm run docker:down`      | Stop local PostgreSQL container                                     |
| `pnpm run new:page`         | Scaffold a page from the local script                               |
| `pnpm run clean`            | Remove demo routes/components for a lean project                    |
| `pnpm run studio`           | Start Sanity Studio, if configured                                  |
| `pnpm run verify`           | Run lint, knip, typecheck, format check, tests, and build           |
| `pnpm run verify:release`   | Run full release audit (agent rules size, AEO accessibility, build) |
| `pnpm run agent:skills`     | Run `pnpm dlx autoskills` to configure agent skills                 |
| `pnpm run agent:impeccable` | Install the Impeccable skill in your workspace                      |

## AI Agent Tools

This template recommends two core tools to supercharge your AI agent's performance:

### AutoSkills

[AutoSkills](https://www.autoskills.sh/) is an audited command-line utility that automatically detects your project's technology stack (Svelte 5, TypeScript, Tailwind CSS, etc.) and installs the best contextual operational guidelines, custom rules, and workflow capabilities for your AI agents (such as Claude Code, Cursor, Codex, OpenCode, Antigravity, or Gemini).

To initialize or update the recommended agent skills for this workspace:

```bash
pnpm run agent:skills
```

This script executes `pnpm dlx autoskills` to automatically configure your project environment so that any AI assistant instantly understands the Svelte 5 directory structure, styling guidelines, and rules.

### Impeccable

Impeccable is a developer-centric quality and validation skill. When installed, it provides additional tools and checklists for agents to perform comprehensive checks on code style, localization consistency, and schema validation.

To install the Impeccable skill in your workspace:

```bash
pnpm run agent:impeccable
```

## Quality Gate

Before publishing changes (and as enforced by `pnpm run verify`), the full pipeline ensures everything is correct:

```bash
pnpm run verify
```

This runs:

1. `oxlint` (Static analysis)
2. `knip` (Unused dependencies/exports)
3. `svelte-check` (TypeScript & Svelte diagnostics)
4. `prettier` (Code formatting)
5. `vitest` (Unit tests)
6. `vite build` (Production compilation)

Current local verification has been hardened so pnpm audit reports zero vulnerabilities after the dependency overrides in `package.json`.

## Project Structure

```txt
src/
  routes/
    +page.svelte              Home page
    +layout.svelte            App shell, SEO tags, nav, theme, toasts
    components/               Component gallery and demos
    api/og/+server.ts         Dynamic Open Graph SVG endpoint
    *.md/+server.ts           Markdown twin endpoints for AEO
  lib/
    components/ui/            shadcn-svelte style base components
    components/               Project components and demos
    aeo/                      Markdown twins, content negotiation, token counting
    i18n/                     ES/EN dictionaries and locale helpers
    server/                   Server-only Sanity and Supabase helpers
    styles/stitch-m3.css      Design tokens and typography utilities
    seo.ts                    Central SEO store
    site-config.ts            Site identity, URLs and social defaults
    site-pages.ts             Registry for sitemap, llms.txt and twins
static/
  screenshots/                README screenshots
sanity/                       Optional CMS schema and seed scripts
```

## UI System

The starter keeps the UI code in your repository, not hidden behind an opaque package.

Base components live in `src/lib/components/ui/`:

- `Button`
- `Card`
- `Dialog`
- `Input`
- `Textarea`
- `Label`
- `Skeleton`
- `Spinner`
- `Sonner`
- Layout helpers: `Container`, `Section`, `Grid`, `Heading`, `Text`, `HeroSection`, `FeaturesSection`

Project components live in `src/lib/components/`:

- `Footer`
- `CookieConsent`
- `CopyButton`
- `Newsletter`
- `AiPrompt`
- `JsonLd`
- `ToastContainer`
- Demo blocks under `src/lib/components/demos/`

## SEO, GEO and AEO

The starter is designed for search engines and AI answer engines.

One `setSeo({...})` call per page feeds:

- `<title>`, description, keywords, author and canonical URL.
- Open Graph and Twitter cards.
- JSON-LD for `Organization`, `WebSite`, `BreadcrumbList`, page schema, FAQ, HowTo and SoftwareApplication.
- `hreflang` alternates for ES/EN.

Dynamic discovery endpoints:

| Endpoint                      | Purpose                                          |
| ----------------------------- | ------------------------------------------------ |
| `/sitemap.xml`                | HTML pages and Markdown twin URLs with hreflang  |
| `/robots.txt`                 | Search and AI crawler policy                     |
| `/llms.txt`                   | Compact Markdown index for LLMs                  |
| `/llms-full.txt`              | Full-site Markdown export                        |
| `/index.md`, `/components.md` | Clean Markdown twins                             |
| `Accept: text/markdown`       | Content negotiation for agent-friendly responses |
| `/api/og?title=...`           | Dynamic Open Graph image                         |

To add a page to the whole SEO/GEO/AEO pipeline:

1. Create the SvelteKit route.
2. Call `setSeo({...})` in the page.
3. Add the page to `src/lib/site-pages.ts`.
4. Add a Markdown builder in `src/lib/aeo/builders/`.
5. Register the builder and add a sibling `.md` route.

## Security Notes

Implemented by default:

- Content Security Policy in `src/hooks.server.ts`.
- `Strict-Transport-Security` in production.
- `X-Frame-Options: DENY`.
- `X-Content-Type-Options: nosniff`.
- `Referrer-Policy: strict-origin-when-cross-origin`.
- Restrictive `Permissions-Policy`.
- `frame-ancestors 'none'`.
- Locale cookie uses `httpOnly`, `sameSite: 'lax'` and `secure` in production.
- Private service keys stay in `$env/dynamic/private`.
- pnpm dependency audit is clean with the included overrides.

Review before production:

- Keep `PUBLIC_SITE_URL` accurate for canonical URLs, sitemap and Open Graph.
- Treat `SANITY_READ_TOKEN`, `SUPABASE_ANON_KEY` and `RESEND_API_KEY` as environment-specific credentials.
- If you enable third-party analytics or live chat, update CSP allowlists deliberately.

## Optional Integrations

Copy `.env.example` to `.env` when enabling services:

```bash
PUBLIC_SITE_URL=http://localhost:5173

SANITY_PROJECT_ID=
SANITY_DATASET=production
SANITY_API_VERSION=2024-01-01
SANITY_READ_TOKEN=

SUPABASE_URL=
SUPABASE_ANON_KEY=

PUBLIC_SENTRY_DSN=
RESEND_API_KEY=
```

### Sanity

The repo includes `sanity/`, `sanity.config.ts`, `sanity.cli.ts`, server helpers and sample GROQ mapping. Without env vars, the app still runs normally.

```bash
pnpm run studio
```

### Supabase

`src/lib/server/supabase/client.ts` returns `null` until `SUPABASE_URL` and `SUPABASE_ANON_KEY` are configured.

### Sentry

Client tracking is disabled in dev and only starts when `PUBLIC_SENTRY_DSN` exists.

## Deploy

### Vercel

This starter ships with `@sveltejs/adapter-vercel`.

```bash
pnpm run build
```

Connect the repository to Vercel and set `PUBLIC_SITE_URL` to the production URL.

### Netlify

`netlify.toml` is included. Set the same environment variables in the Netlify dashboard.

## For AI-Assisted Workflows

This repository includes agent-facing documentation:

- `AGENTS.md` for repository rules and Svelte 5 patterns.
- `PROMPTS.md` with copy-paste prompts.
- `DESIGN_TO_CURSOR.md` for mapping Stitch, Lovable or Figma exports into this component system.
- `GEO_PLAYBOOK.md` for AI discovery and Markdown twin workflows.

---

## 🌟 Support & Community

If you find this starter helpful for your projects or vibe coding workflow, please consider giving it a **Star on GitHub** ⭐ — it helps more developers discover the project!

- **Found a bug?** [Open an issue](https://github.com/moisesvalero/my-sveltekit-starter/issues)
- **Have an idea?** Pull requests and feature suggestions are warmly welcomed!
- **Author:** [Moisés Valero](https://github.com/moisesvalero)

## License

Released under the [MIT License](./LICENSE). Free for personal, client, and commercial projects without restrictions.
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。