pickstack

SvelteKit + Turborepo

Monorepo: the app in apps/web, tasks cached by turbo. This page shows exactly what pickstack adds to a SvelteKit project for Turborepo: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.

$ npm create pickstack@latest my-app -- --framework sveltekit --modules turborepo --yes
Customize in the configurator

Packages it adds

PackageVersionType
turbo^2.11.13dev

New files

apps/web/.gitignore
node_modules
dist
.svelte-kit
build
.env
.env.local
.DS_Store
apps/web/package.json
{
  "name": "web",
  "private": true,
  "version": "0.1.0",
  "type": "module",
  "imports": {
    "#lib": "./src/lib/index.js",
    "#lib/*": "./src/lib/*"
  },
  "scripts": {
    "dev": "vite dev",
    "build": "vite build",
    "preview": "vite preview",
    "prepare": "svelte-kit sync || echo ''",
    "typecheck": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
  },
  "devDependencies": {
    "@sveltejs/adapter-static": "^4.0.1",
    "@sveltejs/kit": "^3.4.0",
    "@sveltejs/vite-plugin-svelte": "^7.3.2",
    "svelte": "^5.59.1",
    "svelte-check": "^4.7.8",
    "typescript": "~6.0.3",
    "vite": "^8.3.8"
  }
}
apps/web/src/app.d.ts
// See https://svelte.dev/docs/kit/types#app.d.ts
declare global {
  namespace App {
    // interface Error {}
    // interface Locals {}
    // interface PageData {}
    // interface PageState {}
    // interface Platform {}
  }
}

export {};
apps/web/src/app.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    %sveltekit.head%
  </head>
  <body data-sveltekit-preload-data="hover">
    <div style="display: contents">%sveltekit.body%</div>
  </body>
</html>
apps/web/src/lib/Counter.svelte
<script lang="ts">
  let count = $state(0);
</script>

<div class="card">
  <p class="count">{count}</p>
  <div class="row">
    <button type="button" class="btn" onclick={() => count--}>-1</button>
    <button type="button" class="btn" onclick={() => count++}>+1</button>
  </div>
</div>
apps/web/src/lib/index.ts
// Place files you want to import through the `#lib` alias in this folder.
apps/web/src/routes/+layout.svelte
<script lang="ts">
  import { resolve } from "$app/paths";
  import type { LayoutProps } from "./$types";
  import "./layout.css";

  let { children }: LayoutProps = $props();
</script>

<main class="app">
  <nav class="nav">
    <a class="link" href={resolve("/")}>Home</a>
    <a class="link" href={resolve("/about")}>About</a>
  </nav>
  {@render children()}
</main>
apps/web/src/routes/+layout.ts
export const prerender = true;
apps/web/src/routes/+page.svelte
<script lang="ts">
  import Counter from "#lib/Counter.svelte";
</script>

<section class="page">
  <h1 class="title">my-app</h1>
  <Counter />
</section>
apps/web/src/routes/about/+page.svelte
<section class="page">
  <h1 class="title">About</h1>
  <p class="text">Built with SvelteKit, Svelte 5, TypeScript, Turborepo.</p>
</section>
apps/web/src/routes/layout.css
:root {
  font-family: system-ui, sans-serif;
  color: #0f172a;
  background: #f8fafc;
}

body {
  margin: 0;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
  box-sizing: border-box;
}

.title {
  font-size: 1.875rem;
  margin: 0;
}

.nav {
  display: flex;
  gap: 1rem;
}

.link {
  color: #475569;
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  color: #0f172a;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.text {
  max-width: 28rem;
  text-align: center;
  color: #475569;
}

.card {
  background: #fff;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.count {
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.row {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.btn {
  background: #0f172a;
  color: #fff;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font: inherit;
  cursor: pointer;
}

.btn:hover {
  background: #334155;
}
apps/web/static/robots.txt
# allow crawling everything by default
User-agent: *
Disallow:
apps/web/tsconfig.json
{
  "extends": "$app/tsconfig",
  "compilerOptions": {
    "strict": true
  },
  "include": ["src", "vite.config.ts"]
}
apps/web/vite.config.ts
import adapter from "@sveltejs/adapter-static";
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    sveltekit({
      compilerOptions: {
        // Force runes mode for the project, except for libraries. Can be removed in svelte 6.
        runes: ({ filename }) =>
          filename.split(/[/\\]/).includes("node_modules") ? undefined : true,
      },
      adapter: adapter(),
    }),
  ],
});
turbo.json
{
  "$schema": "https://turborepo.dev/schema.json",
  "ui": "tui",
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "inputs": ["$TURBO_DEFAULT$", ".env*"],
      "outputs": ["build/**", ".svelte-kit/**"]
    },
    "dev": {
      "cache": false,
      "persistent": true
    },
    "typecheck": {
      "dependsOn": ["^typecheck", "build"]
    }
  }
}

Changes to existing files

.gitignore (changed)
 node_modules+.turbo−dist−.svelte-kit−build .env .env.local .DS_Store⋯ 1 unchanged lines

Project files

Related templates