https://github.com/microwebstacks/svelte-examples
examples with svelte
https://github.com/microwebstacks/svelte-examples
netlify-deployment svelte sveltekit
Last synced: 4 months ago
JSON representation
examples with svelte
- Host: GitHub
- URL: https://github.com/microwebstacks/svelte-examples
- Owner: MicroWebStacks
- License: mit
- Created: 2023-02-26T09:01:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-17T17:44:31.000Z (almost 2 years ago)
- Last Synced: 2024-10-29T14:22:12.523Z (8 months ago)
- Topics: netlify-deployment, svelte, sveltekit
- Language: Svelte
- Homepage:
- Size: 148 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# svelte-examples
Simple examples with Svelte Kit showing common web design patterns, with focus on server and client states management and synchronization.
# 01_basics
basic example with home server rendered page and a prerendered page
live demo : https://svelte-basics.netlify.app/
[](https://svelte-basics.netlify.app/)
[](https://stackblitz.com/github/MicroWebStacks/svelte-examples/tree/main/01_basics)
[](https://gitpod.io/?on=gitpod#https://github.com/MicroWebStacks/svelte-examples/tree/main/01_basics)# 02_ssr-counter
global server counter, keep state on page reload as long as the same instance is running. All clients will increment the same counter.
* Sequence
* Project files
live demo : https://svelte-ssr-counter.netlify.app/
[](https://svelte-ssr-counter.netlify.app/)
[](https://stackblitz.com/github/MicroWebStacks/svelte-examples/tree/main/02_ssr-counter)
[](https://gitpod.io/?on=gitpod#https://github.com/MicroWebStacks/svelte-examples/tree/main/02_ssr-counter)# 03_server-cookie-counter
couter saved as a cookie, fetched, incremented and updated by the server
live demo : https://svelte-cookie-counter.netlify.app/
[](https://svelte-cookie-counter.netlify.app/)
[](https://stackblitz.com/github/MicroWebStacks/svelte-examples/tree/main/03_server-cookie-counter)
[](https://gitpod.io/?on=gitpod#https://github.com/MicroWebStacks/svelte-examples/tree/main/03_server-cookie-counter)# 04_client-counters
classical front end Cards counters. Each Card has a counter variable, all client side, resets on page reload, reactive DOM assignment.
live demo : https://svelte-client-counters.netlify.app/
[](https://svelte-client-counters.netlify.app/)
[](https://stackblitz.com/github/MicroWebStacks/svelte-examples/tree/main/04_client-counters)
[](https://gitpod.io/?on=gitpod#https://github.com/MicroWebStacks/svelte-examples/tree/main/04_client-counters)# 05_sse-counter
SSE: Server Sent Events. global var using a timer and Emitter.
Server keeps couter state. Reloading the page has no effect on the counter states which just keeps counting independently.
This example is using both load functions on server and on client.
* Notes
requires Node18 Node18 for ReadableStream()
not serverless compatible
* Sequence
* Project files
[](https://gitpod.io/?on=gitpod#https://github.com/MicroWebStacks/svelte-examples/tree/main/05_sse-counter)
# 06_markdown
simple example with markdown rendering