Svelte and SvelteKit course Β· Module 14: Hooks, API and Deployment
Final Project: Viking Chronicles
In this lesson4
Congratulations! You have completed all 14 locations. Now it's time for the final project!
Project requirements
Build a "Viking Chronicles" application with the following features:
1. Authentication
- Registration and login
- Sessions with cookies
- Protected routes
2. CRUD Warriors
- List of warriors
- Adding new ones
- Editing profiles
- Deleting
3. Expedition system
- Creating expeditions
- Adding warriors to expeditions
- Expedition history
4. Dashboard
- Statistics
- Charts (using Tween and Spring from svelte/motion)
- Real-time updates
5. Responsiveness
- Mobile-first design
- Dark/light mode
Technology stack
- SvelteKit 3 (start:
npx sv create viking-chronicles) - Svelte 5 Runes
- TypeScript
- Prisma + SQLite/PostgreSQL
- TailwindCSS
Project structure
src/
βββ lib/
β βββ components/
β βββ server/
β β βββ db.ts
β βββ state/ # shared state (runes in .svelte.js)
βββ routes/
β βββ (auth)/
β β βββ login/
β β βββ register/
β βββ (app)/
β β βββ dashboard/
β β βββ warriors/
β β βββ expeditions/
β βββ api/
βββ env.ts # environment variable declarations
βββ hooks.server.ts
vite.config.ts # SvelteKit and the adapterKeep shared state (for example the logged-in warrior) in .svelte.js files in src/lib/state, and import components and modules through #lib.
SKAL!
Jarl Sven the Runic is proud of you! You have mastered the art of Svelte like a true Viking masters the seas. Your skills are now ready for building powerful applications.
May your code be as swift as a drakkar, and your components as sturdy as the walls of Asgard!
SKAL, warrior!
Code for this lesson: App.svelte
<script>
// Final project - Summary
const modules = [
{ num: 1, name: 'Midgard', topic: 'Introduction to Svelte' },
{ num: 2, name: 'Yggdrasil', topic: 'Components' },
{ num: 3, name: 'Rune Chamber', topic: 'Reactivity and Runes' },
{ num: 4, name: 'Asgard', topic: 'Props and Events' },
{ num: 5, name: 'BifrΓΆst', topic: 'Bindings' },
{ num: 6, name: 'The Norns', topic: 'Template logic' },
{ num: 7, name: 'Valhalla', topic: 'Lifecycle' },
{ num: 8, name: 'Well of Mimir', topic: 'Stores' },
{ num: 9, name: 'RagnarΓΆk', topic: 'Animations' },
{ num: 10, name: 'MjΓΆlnir', topic: 'Actions' },
{ num: 11, name: 'Drakkar', topic: 'Routing' },
{ num: 12, name: 'Volva', topic: 'SSR & Loading' },
{ num: 13, name: 'Birka', topic: 'Form Actions' },
{ num: 14, name: 'Heimdall', topic: 'Hooks & Deploy' }
];
let completed = $state(modules.map(() => false));
let allComplete = $derived(completed.every(c => c));
</script>
<main class="finale">
<h1>Viking Chronicles</h1>
<p class="subtitle">SKΓ
L! You have completed the great journey!</p>
<section class="journey">
<h2>Your journey through 14 locations</h2>
<div class="modules">
{#each modules as mod, i}
<label class="module" class:done={completed[i]}>
<input type="checkbox" bind:checked={completed[i]} />
<span class="num">{mod.num}</span>
<span class="name">{mod.name}</span>
<span class="topic">{mod.topic}</span>
</label>
{/each}
</div>
</section>
{#if allComplete}
<section class="celebration">
<h2>CONGRATULATIONS!</h2>
<p>You have mastered Svelte and SvelteKit like a true viking masters the seas!</p>
<div class="badge">
<span class="icon">α</span>
<span class="title">Svelte Viking</span>
<span class="subtitle">Master of Runes</span>
</div>
</section>
{:else}
<section class="progress">
<h2>Progress</h2>
<div class="bar">
<div
class="fill"
style="width: {(completed.filter(Boolean).length / modules.length) * 100}%"
></div>
</div>
<p>{completed.filter(Boolean).length} / {modules.length} locations</p>
</section>
{/if}
<section class="quote">
<blockquote>
"May your code be fast as a drakkar, and your components strong as the walls of Asgard!"
</blockquote>
<p class="author">- Jarl Sven Runiczny</p>
</section>
</main>
<style>
.finale {
font-family: 'Georgia', serif;
max-width: 600px;
margin: 0 auto;
padding: 2rem;
background: linear-gradient(135deg, #1a0f0a 0%, #2d1b0a 100%);
color: #e8d5b7;
min-height: 100vh;
}
h1 {
color: #ffd700;
text-align: center;
font-size: 2rem;
}
.subtitle {
text-align: center;
color: #d4af37;
font-size: 1.2rem;
}
section {
background: rgba(212, 175, 55, 0.1);
border: 1px solid #d4af37;
border-radius: 8px;
padding: 1rem;
margin: 1rem 0;
}
h2 {
color: #d4af37;
font-size: 1rem;
margin-top: 0;
}
.modules {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.module {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.5rem;
background: rgba(0,0,0,0.3);
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
}
.module:hover {
background: rgba(0,0,0,0.5);
}
.module.done {
background: rgba(144, 238, 144, 0.1);
}
.module input {
width: 20px;
height: 20px;
}
.num {
width: 25px;
height: 25px;
background: #d4af37;
color: #1a0f0a;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.8rem;
font-weight: bold;
}
.name {
color: #ffd700;
flex: 1;
}
.topic {
color: #8b7355;
font-size: 0.85rem;
}
.celebration {
text-align: center;
background: rgba(255, 215, 0, 0.2);
border-color: #ffd700;
}
.celebration h2 {
color: #ffd700;
font-size: 1.5rem;
}
.badge {
display: inline-flex;
flex-direction: column;
align-items: center;
padding: 1.5rem 2rem;
background: linear-gradient(135deg, #d4af37 0%, #ffd700 100%);
border-radius: 8px;
margin-top: 1rem;
}
.badge .icon {
font-size: 3rem;
}
.badge .title {
color: #1a0f0a;
font-size: 1.2rem;
font-weight: bold;
}
.badge .subtitle {
color: #3d2914;
font-size: 0.9rem;
}
.progress .bar {
height: 20px;
background: rgba(0,0,0,0.5);
border-radius: 10px;
overflow: hidden;
}
.progress .fill {
height: 100%;
background: linear-gradient(90deg, #d4af37, #ffd700);
transition: width 0.3s;
}
.progress p {
text-align: center;
margin-top: 0.5rem;
}
.quote {
text-align: center;
border-style: dashed;
}
blockquote {
font-style: italic;
color: #d4af37;
font-size: 1.1rem;
margin: 0;
}
.author {
color: #8b7355;
margin-top: 0.5rem;
}
</style>Spotted a mistake in this lesson?