├── .gitignore
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | package.json
3 | unused
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SvelteKit vs NextJS
2 |
3 | Comparison of major features in SvelteKit vs NextJS.
4 |
5 | Goals: fast, easy, convention over configuration, & batteries included.
6 | Overwhelming choices are bad versus providing a clear path forward.
7 |
8 | | | SvelteKit | NextJS | Winner | Notes |
9 | | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
10 | | UI lib | [Svelte](https://svelte.dev/) | [React](https://reactjs.org/)
(or [Preact](https://preactjs.com)) | SvelteKit | Svelte offers faster DOM updates, smaller KB client size, _much_ easier cross-component state management, ability to abstract responsive state into external files, etc. Svelte5 has Runes (signals) 🎉, React does not have an equivalent yet. |
11 | | Dev: Hot reload | [🟢](https://kit.svelte.dev/docs/faq#how-do-i-use-hmr-with-sveltekit) | [🟢](https://nextjs.org/docs/architecture/fast-refresh) | -- | I.e. Auto reload on file save. |
12 | | Dev: O(1) hot reload | [🟢 Vite](https://vitejs.dev/) | [🟢 🚧 Turbopack (\*not enabled by default)](https://nextjs.org/docs/architecture/turbopack) | SvelteKit | I.e. Processes only the changed files. Fast even in big projects. \*Update `package.json` to enable Turbopack: `"dev": "next dev --turbo"`. |
13 | | Dev: "Fast refresh" | [🟢 🚧 (not enabled by default)](https://kit.svelte.dev/docs/faq#how-do-i-use-hmr-with-sveltekit) | [🟢](https://nextjs.org/docs/basic-features/fast-refresh) | NextJS | I.e. UI state preserved across reloads. |
14 | | Dev: Write modern JS | [🟢](https://svelte.dev/docs#compile-time) | [🟢](https://nextjs.org/docs/advanced-features/compiler) | -- | |
15 | | Dev: A11y console hints | [🟢](https://svelte.dev/docs#accessibility-warnings) | ❌ | SvelteKit | |
16 | | Dev: Prettier | [🟢](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) | [🟢](https://nextjs.org/docs/basic-features/eslint#prettier) | -- | For `.svelte` or `.jsx` files, respectively. For SvelteKit, install [`Svelte for VSCode`](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) extension. |
17 | | Prod: Bundler | [🟢](https://svelte.dev/docs#compile-time) | [🟢](https://nextjs.org/docs/advanced-features/compiler) | -- | E.g. Minify assets, etc. Both are enabled by default. When [RollDown](https://rolldown.rs/) (Rust) is ready in 2024, Svelte will be able to switch from Rollup+ESbuild to RollDown for even faster production builds. |
18 | | Prod: Auto code splitting, per route | [🟢](https://kit.svelte.dev/docs/performance) | [🟢](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#1-code-splitting) | -- | I.e. Auto code split JS & CSS per route & bundle appropriately. |
19 | | Prod: Build adapters for different hosts | [🟢](https://kit.svelte.dev/docs/adapters) | ❌ | SvelteKit | SvelteKit provides easy portability to many hosts. NextJS works best with Vercel. |
20 | | KB size: Hello World | 🟢 46.3 (25.6 gzip) with CSR\*
🟢 2.9 (3.3 gzip) without CSR (1.8kb of this is the favicon; shows as bigger with gzip in Chrome) | ❌ 336.3 (131.3 gzip) (includes a 9.7kb favicon 👀)\* | SvelteKit | - \*CSR is "client side router".
- SvelteKit updated Aug 25, 2023 using SvelteKit 1.23 & Svelte 4.
- NextJS updated Aug 25, 2023 using App Router, NextJS 13.4.19, & React 18.2.0.
- Both tests return HTML of `
hello world
` and exclude CSS. | 21 | | KB size: "Real World" app | too out of date | too out of date | -- | Out of date; PR welcome. \*Mar 13, 2021