Skip to content

About

A simple template for creating websites with SvelteKit 3 + Tailwind CSS 4

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

SvelteKit 3 site template

A minimal starting point for static-friendly websites, with no backend.

Stack: SvelteKit 3 / Svelte 5 · Tailwind CSS 4 · Lucide icons · Paraglide i18n · TypeScript · Vercel

This template is built for Bun. Use bun for everything (install, scripts, adding packages). Do not use npm/yarn/pnpm: the lockfile is bun.lock, and mixing package managers creates conflicting lockfiles.

Getting started

bun install
bun run dev      # http://localhost:5173

Arch Linux: install Bun with curl -fsSL https://bun.sh/install | bash.

Scripts

command what it does
bun run dev dev server
bun run build / bun run preview production build / preview it
bun run check compile messages + svelte-check (types)
bun run format / bun run lint Prettier (with Tailwind class sorting)

Project structure

messages/                    translations: one JSON file per language (en.json, pt-br.json)
project.inlang/settings.json languages + i18n plugins
src/lib/config/site.ts       site name, URL, navigation items, language labels
src/lib/components/ui/       Button, Card, Container, PageHeader, Seo
src/lib/components/layout/   Navbar (with mobile menu), Footer, LanguageSwitcher
src/lib/paraglide/           generated by Paraglide (git-ignored, do not edit)
src/routes/                  pages (+page.svelte), layout, error page
src/routes/layout.css        Tailwind entry (@import 'tailwindcss')
vite.config.ts               Vite + SvelteKit (Vercel adapter) + Paraglide config

Adding a page

  1. Create src/routes/contact/+page.svelte:
    <script lang="ts">
    	import PageHeader from '#lib/components/ui/PageHeader.svelte';
    	import Seo from '#lib/components/ui/Seo.svelte';
    	import { m } from '#lib/paraglide/messages.js';
    </script>
    
    <Seo title={m.contact_title()} description={m.contact_description()} />
    <PageHeader title={m.contact_title()} />
  2. Add contact_title and contact_description to every file in messages/.
  3. Add { href: '/contact', label: () => m.nav_contact() } to navItems in src/lib/config/site.ts.

The page automatically works under every language prefix (/contact, /pt-br/contact).

Internationalization (Paraglide)

Messages are compiled to typed functions, so a missing or misspelled key is a type error, and only the messages you use end up in the bundle.

<script lang="ts">
	import { m } from '#lib/paraglide/messages.js';
</script>

<h1>{m.home_title()}</h1><p>{m.footer_rights({ year: 2026, name: 'My Site' })}</p>

URLs: the base language (en) has no prefix, other languages do (/pt-br/about). Always build internal links with localizeHref('/about') (the Button component does this for you).

Adding a language (example: Spanish):

  1. project.inlang/settings.json: add "es" to locales.
  2. Create messages/es.json (copy en.json and translate).
  3. src/lib/config/site.ts: add es: { short: 'ES', name: 'Español' } to localeLabels (TypeScript will remind you).

Docs: https://inlang.com/m/gerre34r/library-inlang-paraglideJs

The inlang plugins are installed from npm (not loaded from a CDN) so builds work offline and are reproducible.

Components

component usage
Button <Button href="/about" variant="primary|secondary|ghost" size="sm|md|lg">. Without href it renders a <button>.
Card <Card title description> with an optional icon snippet and extra children.
Container centered, padded wrapper: size="sm|md|lg".
PageHeader page title + subtitle block.
Seo sets <title>, description, Open Graph and hreflang alternates.
Navbar / Footer / LanguageSwitcher already used in src/routes/+layout.svelte.

Dark mode follows the system setting (dark: classes). Change the accent color by replacing orange-* classes.

Icons (Lucide)

Import icons one by one to keep the bundle small (browse all icons):

<script lang="ts">
	import Rocket from '@lucide/svelte/icons/rocket';
</script>

<Rocket class="size-5 text-orange-500" />

Deploying to Vercel

Push to GitHub (including bun.lock) and import the repo in Vercel. The SvelteKit preset is detected automatically and Vercel installs with Bun when it finds bun.lock. Before going live, set your real domain in src/lib/config/site.ts (site.url), used for hreflang links.

Notes

  • SvelteKit 3: Kit config lives in vite.config.ts (there is no svelte.config.js), and the import alias is #lib/... (defined in package.json > imports), with the file extension in the import ('#lib/foo.js').
  • Language switching uses a full page load (data-sveltekit-reload) so every message re-renders in the new language.

About

A simple template for creating websites with SvelteKit 3 + Tailwind CSS 4

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages