What does this book cover?
Chapter 1, Initial Setup and Project Structure, explains how to install a new SvelteKit project and set up a development environment. It also covers how SvelteKit projects are logically structured and the best practices to organize source code.
Chapter 2, Configurations and Options, covers how to customize an application via the options available within SvelteKit and Vite configurations.
Chapter 3, Compatibility with Existing Standards, goes into detail about how SvelteKit works with modern web standards such as the Fetch, FormData, and URL Application Programming Interfaces (APIs).
Chapter 4, Effective Routing Techniques, discusses basic routing techniques. These techniques are essential to creating everything, from the simplest of pages and API endpoints to dynamic URLs that change with the content. It also covers how to create a cohesive user interface for applications using layouts.
Chapter 5, Deep Dive into Data Loading, explains in detail how to get data onto our pages and into components through the use of SvelteKit’s load()
function. It also breaks down the data available to developers within that same function.
Chapter 6, Forms and Data Submission, covers how developers can receive data from users through the use of HTML form elements. From there, it explains how actions can be used to break up logic pertaining to forms and how those forms may be enhanced to reduce the friction often experienced by users.
Chapter 7, Advanced Routing Techniques, discusses the details behind some of the lesser-used yet more powerful features of SvelteKit’s routing mechanism. It covers how developers can work with optional parameters in routes, handle routes with an unknown number of parameters, as well as the precedence of routes when conflicts are encountered.
Chapter 8, Builds and Adapters, explains how developers can prepare an application for different environments. It provides examples to prepare a SvelteKit application for deployment to Cloudflare Pages, a Node.js environment, and even static hosting solutions.
Chapter 9, Hooks and Error Handling, covers the differences between server hooks and shared hooks, as well as how they can be used to manipulate data flowing into and out of an application. Along with this, it explains how developers can manage errors that are expected and what to do about those that were never anticipated.
Chapter 10, Managing Static Assets, goes into detail as to how to best manage assets such as images or global CSS files. It explains how Vite is central to this process and the best practices.
Chapter 11, Modules and Secrets, discusses a few of the modules not covered throughout the rest of the book. It gives you a general overview of some of the other tools and functionality that come bundled with SvelteKit. It also covers the modules responsible for managing secrets such as API keys or database passwords.
Chapter 12, Enhancing Accessibility and Optimizing SEO, will showcase how simple it is to make applications available to a wider audience. Not only does incorporating these practices make applications more compatible with technologies such as screen readers, but it also provides the added benefit of enhancing rankings within search engine providers.
Appendix: Examples and Support, gives you access to both official and unofficial community-maintained resources. The examples given of how to integrate other front-end technologies with SvelteKit show just how easy it is to do, especially when community projects are leveraged to speed up the development process. The resources provided in this section are invaluable for troubleshooting issues and making friends within the SvelteKit community.