nsarrazin / sveltekit-universal

A sveltekit template that builds for web, mobile & desktop from a single codebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sveltekit Universal

Screenshot 2024-07-11 at 18 42 19

Run API endpoints, SSR, mobile & desktop from a single codebase.

We leverage two builds for this, one node and one static. The node build serves the API and SSR and the static build calls the node build for API and is used for mobile (capacitor) and desktop (tauri).

Install dependencies

npm i

Run dev mode

Node adapter (serving API & SSR)

This is the default mode, you need to run this for the static adapters to work since they will call this server for API.

npm run dev:node

Static adapter

This will not work unless you're also running the node adapter.

npm run dev:static

Build & preview

Pretty much same as dev mode, preview will build & preview by default.

npm run preview:node
npm run preview:static

Mobile & desktop dev

Tauri dev

(requires rust toolchain locally)

npx tauri dev

Capacitor

(will require you to have either an iOS or an android emulator locally)

npx cap sync
npx cap run android # or ios

Tauri build

npx tauri build

Run production node server

npm run build:node
node build-node/index.js

About

A sveltekit template that builds for web, mobile & desktop from a single codebase


Languages

Language:TypeScript 25.3%Language:Swift 24.0%Language:JavaScript 16.3%Language:Svelte 13.4%Language:Java 10.4%Language:Ruby 4.9%Language:HTML 2.7%Language:Rust 2.5%Language:CSS 0.5%