Fireship · @fireship
SvelteKit in 100 seconds
Uploaded July 19, 2023 · Length 2:46
Summary
SvelteKit framework for server-rendered web apps with UI Library, universal rendering, and built-in router.
- sveltekit
- server-rendered
- universal rendering
- ui library
- javascript framework
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
spelled kit a framework for building
- 0:02
server-rendered web applications with
- 0:03
the world's most loved UI Library it was
- 0:06
created by the creator of spelled
- 0:07
himself Rich Harris and hit version 1.0
- 0:09
in 2022 most importantly it provides a
- 0:12
universal way to render svelte on
- 0:13
node.js and other JavaScript Edge
- 0:15
runtimes this allows the server to fetch
- 0:18
data up front so the browser can receive
- 0:19
fully rendered HTML which can be
- 0:21
critical for performance and SEO then
- 0:23
JavaScript takes over to render all
- 0:25
future Pages like a fast and smooth
- 0:27
single page application it provides a
- 0:29
built-in router where every page
- 0:31
component represents the UI for a unique
- 0:33
URL each component though can have a
- 0:35
corresponding Javascript file to handle
- 0:37
data fetching this file exports a load
- 0:39
function and the return value is made
- 0:40
available on the component while
- 0:42
providing automatic end-to-end type
- 0:43
safety in addition the data is made
- 0:45
available on a svelt store which can be
- 0:47
accessed from any component and
- 0:48
eliminates the need for complex State
- 0:50
Management architectures Pages can also
- 0:52
handle server-side actions like form
- 0:54
submissions to update the current page
- 0:56
with zero client-side JavaScript forms
- 0:58
can then be progressively enhanced to
- 0:59
improve of the front end user experience
- 1:01
with JavaScript in addition to Pages
- 1:03
layouts can be used to share UI across
- 1:05
multiple child routes and they can even
- 1:07
fetch their own data and finally we have
- 1:09
server files that export functions like
- 1:11
git post patch and delete to build
- 1:13
restful apis to get started create a new
- 1:16
project with a CLI you'll notice it uses
- 1:18
Veet as the build tool then we can
- 1:19
create our first page by going to the
- 1:21
routes directory right click and the
- 1:23
tooling will help you easily create the
- 1:24
required file I'm wrapping this URL in
- 1:26
Brackets to make it a dynamic route that
- 1:28
will give us a username parameter we can
- 1:30
access throughout the application notice
- 1:32
how the component has a prop of data
- 1:34
using the page data interface this
- 1:36
interface is automatically generated
- 1:37
based on how we load data from the
- 1:39
server in the application that data can
- 1:41
be loaded from a page.ts file inside the
- 1:43
load function we can access the URL
- 1:45
parameters like we might take the
- 1:47
username and make a fetch call to an API
- 1:49
once we have our data we just return it
- 1:51
from this function then we can access it
- 1:52
with full intellisense back in the UI
- 1:54
component the initial page load will be
- 1:56
rendered on the server and we can use
- 1:57
felt head to set a title in meta tags
- 1:59
for search Bots we might also want to


