Svelte and Sapper in Action
Svelte and Sapper in Action
Summary:
Introduction
The book "Svelte and Sapper in Action" (original title Svelte and Sapper in Action) by Mark Volkmann was published in 2020 and immediately attracted the attention of the web development community. It is one of the first comprehensive printed guides to two interrelated technologies: the Svelte framework and its meta-framework for server-side rendering, Sapper (now known as SvelteKit). The book has 568 pages and is aimed at developers already familiar with JavaScript (Node.js).
Mark Volkmann is an experienced software engineer and technical writer working at Object Computing, Inc. He is known for his in-depth articles on web technologies and is an active member of the Svelte community. In this book, he sets an ambitious goal: not just to teach syntax, but to convey the philosophy of reactive programming without a virtual DOM that Svelte espouses.
What the book is about
The book is divided into four logical parts, each dedicated to a specific aspect of development.
Part I: Getting Started with Svelte
The first chapters cover the basics: installation, creating the first component, working with reactive declarations, conditional rendering, loops, events, and bindings. The author explains in detail how Svelte differs from React, Vue, or Angular — it does not use a virtual DOM, but compiles components into efficient imperative code at build time. This makes applications faster and smaller in size.
Part II: Advanced Svelte Concepts
This section covers stores, context, slots, event modifiers, animations, and transitions. Special attention is paid to reactivity: how Svelte tracks dependencies and updates the DOM only when truly necessary. Testing and debugging are also discussed.
Part III: Sapper — Server-Side Rendering and Routing
Sapper (the predecessor of SvelteKit) adds server-side rendering (SSR), static site generation (SSG), and file-based routing to Svelte. The author shows how to create multi-page applications with data preloading, how to work with API endpoints, and how to organize code for maximum performance.
Part IV: Deployment and Real-World Projects
The final part covers practical aspects: build configuration, deployment on various platforms (Vercel, Netlify, Now), database integration, and creating a complete sample application (e.g., a blog or an online store).
Who this book is for
The book is intended for intermediate and advanced developers who already have experience with JavaScript and at least one modern framework (React, Vue, Angular). Beginners in web development will find it challenging: the author assumes knowledge of ES6+, module systems, promises, and asynchronicity. However, if you are confident in JavaScript, this book will be an excellent springboard into the world of Svelte.
What the reader will learn
- Basics of Svelte syntax: reactive declarations, conditionals, loops, events.
- Working with stores for global state management.
- Creating animations and transitions using Svelte's built-in tools.
- Principles of server-side rendering and static generation with Sapper.
- File-based routing, data preloading, and API endpoints.
- Performance optimization: how Svelte compiles code and why it provides a speed boost.
- Deploying a finished application on popular hosting platforms.
- Integration with external libraries and APIs.
- Testing components with Jest and Cypress.
- Design patterns for scalable Svelte applications.
Strengths of the book
1. Depth and structure. The book does not just list APIs, but explains why Svelte is designed the way it is. The author often compares approaches with other frameworks, which helps