Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nsarrazin/sveltekit-universal
A sveltekit template that builds for web, mobile & desktop from a single codebase
https://github.com/nsarrazin/sveltekit-universal
capacitor svelte svelte-kit sveltekit tauri
Last synced: 30 days ago
JSON representation
A sveltekit template that builds for web, mobile & desktop from a single codebase
- Host: GitHub
- URL: https://github.com/nsarrazin/sveltekit-universal
- Owner: nsarrazin
- Created: 2024-07-11T16:33:45.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-18T22:14:46.000Z (4 months ago)
- Last Synced: 2024-09-26T19:09:09.628Z (about 1 month ago)
- Topics: capacitor, svelte, svelte-kit, sveltekit, tauri
- Language: TypeScript
- Homepage:
- Size: 1020 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sveltekit Universal
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
```bash
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.
```bash
npm run dev:node
```### Static adapter
This will not work unless you're also running the node adapter.
```bash
npm run dev:static
```## Build & preview
Pretty much same as dev mode, preview will build & preview by default.
```bash
npm run preview:node
npm run preview:static
```## Mobile & desktop dev
### Tauri dev
(requires rust toolchain locally)```bash
npx tauri dev
```### Capacitor
(will require you to have either an iOS or an android emulator locally)```bash
npx cap sync
npx cap run android # or ios
```## Tauri build
```bash
npx tauri build
```## Run production node server
```bash
npm run build:node
node build-node/index.js
```