Svelte

Svelte is a free and open-source front-end component framework and language created by Rich Harris and maintained by the Svelte core team members. Svelte is not a monolithic JavaScript library imported by applications: instead, Svelte compiles HTML templates to specialized code that manipulates the DOM directly, which may reduce the size of transferred files and give better client performance. Application code is also processed by the compiler, inserting calls to automatically recompute data and re-render UI elements when the data they depend on is modified. This also avoids the overhead associated with runtime intermediate representations, such as virtual DOM, unlike traditional frameworks (such as React and Vue) which carry out the bulk of their work at runtime, i.e. in the browser.
The compiler itself is written in TypeScript. Its source code is licensed under MIT License and hosted on GitHub. Among comparable frontend libraries, Svelte has one of the smallest bundle footprint at merely 2KB.
History
The predecessor of Svelte is Ractive.js, which Rich Harris had developed earlier.
Version 1 of Svelte was written in JavaScript and was released on 29 November 2016. It was basically Ractive with a compiler. The name Svelte was chosen by Rich Harris and his coworkers at The Guardian.
Version 2 of Svelte was released on 19 April 2018. It set out to correct what the maintainers viewed as mistakes in the earlier version such as replacing double curly braces with single curly braces.
Version 3 of Svelte is written in TypeScript and was released on 21 April 2019. It rethought reactivity by using the compiler to instrument assignments behind the scenes.
The SvelteKit web framework was announced in October 2020 and entered beta in March 2021.
Version 4 of Svelte was released on 22 June 2023. It's a maintenance release, smaller and faster than version 3.
Key early contributors became involved with Conduitry joining with the release of Svelte 1, Tan Li Hau joining in 2019, and Ben McCann joining in 2020. Rich Harris and Simon Holthausen joined Vercel to work on Svelte fulltime in 2022. Dominic Gannaway joined Vercel from the React core team to work on Svelte fulltime in 2023.
SvelteKit 1.0 was released in December 2022 after two years in development.
Syntax
Svelte applications and components are defined in files, which are HTML files extended with templating syntax that is based on JavaScript and is similar to JSX.
Svelte repurposes JavaScript's native labeled statement syntax to mark reactive statements. Top-level variables become the component's state and exported variables become the properties that the component receives. Additionally, the { } syntax can be used for templating in HTML elements and components, which is shown below:
<script>
let count = 1;
$: doubled = count * 2;
</script>
<p>{count} * 2 = {doubled}</p>
<button on:click={() => count = count + 1}>Count</button>
Associated projects
The Svelte maintainers created SvelteKit as the official way to build projects with Svelte. It is a Next.js-style framework that dramatically reduces the amount of code that gets sent to the browser. The maintainers had previously created Sapper, which was the predecessor of SvelteKit.
The Svelte maintainers also maintain a number of integrations for popular software projects under the Svelte organization including integrations for Vite, Rollup, Webpack, TypeScript, VS Code, Chrome Developer Tools, ESLint, and prettier. A number of external projects such as Storybook have also created integrations with Svelte and SvelteKit.
Influence
Vue.js modeled its API and single-file components after Ractive.js, the predecessor of Svelte.
Adoption
Svelte is widely praised by developers. Taking the top ranking in multiple large scale developer surveys, it was chosen as the Stack Overflow 2021 most loved web framework and 2020 State of JS frontend framework with the most satisfied developers.
Svelte has been adopted by a number of high-profile web companies including The New York Times, Apple, Spotify, Square, Yahoo, ByteDance, Rakuten, Bloomberg, Reuters, Ikea, Facebook, and Brave.
A community group of non-maintainers run the Svelte Summit conference, write a Svelte newsletter, host a Svelte podcast, and host a directory of Svelte tooling, components, and templates.
See also
JavaScript library
Comparison of JavaScript frameworks
References
Computer-related introductions in 2016
JavaScript web frameworks
Web development
Software using the MIT license