Svemix is in early development, and some things may change before we hit version 1.0. This document is a work-in-progress. If you get stuck, reach out for help in the discussions tab or open an issue.
Svemix is a somewhat different framework than you're probably used to. It can be seen as an full-stack addition to Svelte(SvelteKit). Svemix provides you with server scripts inside your Svelte components/routes, which will be transformed into endpoints. Loader functions and actions similar to remix, improved developer experience, SEO handling, cookies, easy to use forms, sessions and much more to come in the future.
Svemix Vite-Plugin replaces all code inside <script context="module" ssr>
and simulates the corresponding SvelteKit-Endpoint. SvelteKit will then make sure to run your loader on the server and for client side navigations it fetches the data required by the page.
The easiest way to start building a Svemix app is to run npm init svelte@next <dir>
:
npm init svelte@next my-app
cd my-app
npm install
npm install svemix
npm run dev
If you already have an existing SvelteKit project setup, that's fine you can just use npm install svemix
.
Once you have the required dependency installed, you should add svemix/plugin
inside your vite.config.js
file under plugins
, before sveltekit
ts
importsvemix from 'svemix/plugin';import {Cannot find module '@sveltejs/kit/vite' or its corresponding type declarations.2307Cannot find module '@sveltejs/kit/vite' or its corresponding type declarations.sveltekit } from'@sveltejs/kit/vite' ;/** @type {import('vite').UserConfig} */constconfig = {plugins : [svemix (),sveltekit ()]};export defaultconfig ;