https://github.com/zeropsio/recipe-svelte-nodejs
https://github.com/zeropsio/recipe-svelte-nodejs
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zeropsio/recipe-svelte-nodejs
- Owner: zeropsio
- Created: 2024-07-04T10:47:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T14:16:49.000Z (almost 2 years ago)
- Last Synced: 2025-03-25T09:53:10.713Z (about 1 year ago)
- Language: Svelte
- Size: 480 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Zerops x SvelteKit - Node.js
Sveltekit is a framework for building robust, fast web applications using Svelte. [Zerops](https://zerops.io) makes deploying and running Sveltekit apps, both server side rendered and static, a breeze. This recipe showcases the Static version, see [zeropsio/recipe-svelte-static](https://github.com/zeropsio/recipe-svelte-static) for the Static version.

## Deploy on Zerops
You can either click the deploy button to deploy directly on Zerops, or manually copy the [import yaml](https://github.com/zeropsio/recipe-svelte-nodejs/blob/main/zerops-project-import.yml) to the import dialog in the Zerops app.
[](https://app.zerops.io/recipe/sveltekit-nodejs)
## Recipe features
- Latest version of **SvelteKit** with SSR running on a **Zerops Node.js** service.
## Production vs. development
This recipe is ready for production as is, and will scale horizontally by adding more containers in case of high traffic surges. If you want to achieve the highest baseline reliability and resiliace, start with at least two containers (add `minContainers: 2` in recipe YAML in the `app` service section, or change the minimum containers in "Automatic Scaling configuration" section of service detail).
## Changes made over the default installation
If you want to modify your existing SvelteKit app to efficiently run on Zerops, follow these steps:
1. Install the necessary adapter with:
```sh
pnpm i -D @sveltejs/adapter-node
```
2. Add the adapter to your `svelte.config.js` to enable SSG. Also, ensure you have `@sveltejs/vite-plugin-svelte` to avoid errors.
```js
import adapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter(),
},
preprocess: vitePreprocess(),
};
export default config;
```
Now, just add the [zerops.yml](https://github.com/zeropsio/recipe-svelte-nodejs/blob/main/zerops.yml) file to the root of your project.
Need help setting your project up? Join [Zerops Discord community](https://discord.com/invite/WDvCZ54).