{"id":31698735,"url":"https://github.com/wiesson/svelte-async-remote-fn","last_synced_at":"2026-05-14T23:13:37.102Z","repository":{"id":318000555,"uuid":"1068376369","full_name":"wiesson/svelte-async-remote-fn","owner":"wiesson","description":"Interactive showcase of SvelteKit Remote Functions patterns - query, command, and form patterns with live examples","archived":false,"fork":false,"pushed_at":"2025-10-04T11:15:01.000Z","size":109,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T13:13:05.808Z","etag":null,"topics":["async","command","demo","form","query","remote-functions","shadcn-svelte","svelte","sveltekit","tailwindcss"],"latest_commit_sha":null,"homepage":"https://svelte-async-remote-fn.vercel.app","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wiesson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-02T09:40:37.000Z","updated_at":"2025-10-04T11:15:05.000Z","dependencies_parsed_at":"2025-10-04T13:13:16.485Z","dependency_job_id":"aa73130d-8959-455b-a61d-1e31b478f62b","html_url":"https://github.com/wiesson/svelte-async-remote-fn","commit_stats":null,"previous_names":["wiesson/svelte-async-remote-fn"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wiesson/svelte-async-remote-fn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiesson%2Fsvelte-async-remote-fn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiesson%2Fsvelte-async-remote-fn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiesson%2Fsvelte-async-remote-fn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiesson%2Fsvelte-async-remote-fn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wiesson","download_url":"https://codeload.github.com/wiesson/svelte-async-remote-fn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiesson%2Fsvelte-async-remote-fn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000701,"owners_count":26082805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","command","demo","form","query","remote-functions","shadcn-svelte","svelte","sveltekit","tailwindcss"],"created_at":"2025-10-08T19:10:32.390Z","updated_at":"2025-10-08T19:10:35.047Z","avatar_url":"https://github.com/wiesson.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 SvelteKit Remote Functions - Interactive Showcase\n\n[![Live Demo](https://img.shields.io/badge/demo-live-brightgreen?style=for-the-badge)](https://svelte-async-remote-fn.vercel.app)\n[![SvelteKit](https://img.shields.io/badge/SvelteKit-5.0-FF3E00?style=for-the-badge\u0026logo=svelte\u0026logoColor=white)](https://kit.svelte.dev)\n[![Tailwind CSS](https://img.shields.io/badge/Tailwind-4.0-38B2AC?style=for-the-badge\u0026logo=tailwind-css\u0026logoColor=white)](https://tailwindcss.com)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n\n\u003e **🔬 Explore Upcoming Features!** Remote Functions are an experimental feature in SvelteKit, offering a type-safe alternative to tRPC for full-stack development.\n\nAn interactive demonstration of **SvelteKit Remote Functions** patterns, showcasing type-safe client-server communication with live examples. Experience the future of SvelteKit with end-to-end type safety, automatic serialization, and built-in query batching—no separate API layer required.\n\n## 🎯 What are Remote Functions?\n\nRemote Functions are SvelteKit's approach to **type-safe client-server communication**. They can be called anywhere in your app but always run on the server, making them perfect for:\n\n- 🔒 Safely accessing server-only resources (environment variables, databases)\n- 🎨 Writing full-stack features in a single file\n- 🔄 Automatic data fetching and caching\n- 📝 Progressive form enhancement\n- ⚡ Built-in optimizations (batching, lazy discovery)\n\n## 🎨 Live Patterns\n\nThis demo showcases **9 different patterns** for working with Remote Functions:\n\n### 📊 Query Patterns\n\n- **Top-level await** - Using `{#await query()}` directly in templates\n- **Direct .current access** - Accessing `query().current` for manual control\n- **Derived reactive queries** - Using `$derived()` for reactive data\n- **Manual refresh** - Calling `.refresh()` on demand\n\n### 🎬 Command Patterns\n\n- **Command pattern** - Using `command()` for mutations and updates\n\n### 📝 Form Patterns\n\n- **Form pattern** - Progressive enhancement with `form()`\n\n### 🛡️ Advanced Patterns\n\n- **Error boundary** - Using `\u003csvelte:boundary\u003e` to catch errors\n- **Dynamic import with await** - Lazy-loading components that use async data\n- **Dynamic import (no # syntax)** - Testing `{await}` without hash symbol\n\n## 🚀 Quick Start\n\n```bash\n# Clone the repository\ngit clone https://github.com/wiesson/svelte-async-remote-fn.git\ncd svelte-async-remote-fn\n\n# Install dependencies\npnpm install\n\n# Start development server\npnpm dev\n```\n\nVisit [http://localhost:5173](http://localhost:5173) to explore the patterns.\n\n## 📖 Pattern Examples\n\n### Query Pattern\n\n```typescript\n// src/routes/example.remote.ts\nimport { query } from '$app/server';\nimport { z } from 'zod';\n\nexport const getUser = query(z.object({ id: z.string() }), async ({ id }) =\u003e {\n\treturn await db.user.findById(id);\n});\n```\n\n```svelte\n\u003c!-- src/routes/example/+page.svelte --\u003e\n\u003cscript\u003e\n\timport { getUser } from '../example.remote';\n\n\tlet userQuery = getUser({ id: '123' });\n\u003c/script\u003e\n\n{#if userQuery.loading}\n\t\u003cp\u003eLoading...\u003c/p\u003e\n{:else if userQuery.error}\n\t\u003cp\u003eError: {userQuery.error.message}\u003c/p\u003e\n{:else if userQuery.current}\n\t\u003cp\u003eUser: {userQuery.current.name}\u003c/p\u003e\n{/if}\n```\n\n### Command Pattern\n\n```typescript\n// For mutations and updates\nexport const updateUser = command(\n\tz.object({ id: z.string(), name: z.string() }),\n\tasync ({ id, name }) =\u003e {\n\t\treturn await db.user.update(id, { name });\n\t}\n);\n```\n\n### Form Pattern\n\n```typescript\n// Progressive enhancement\nexport const contactForm = form(\n\tz.object({\n\t\temail: z.string().email(),\n\t\tmessage: z.string().min(10)\n\t}),\n\tasync (data) =\u003e {\n\t\tawait sendEmail(data);\n\t\treturn { success: true };\n\t}\n);\n```\n\n## 🛠️ Tech Stack\n\n- **[SvelteKit 5](https://kit.svelte.dev)** - The fastest way to build Svelte apps\n- **[Tailwind CSS 4](https://tailwindcss.com)** - Utility-first CSS framework\n- **[shadcn-svelte](https://shadcn-svelte.com)** - Beautiful UI components\n- **[Lucide Icons](https://lucide.dev)** - Beautiful \u0026 consistent icons\n- **[Zod](https://zod.dev)** - TypeScript-first schema validation\n\n## 📚 Learn More\n\n- 📖 [Official Remote Functions Documentation](https://svelte.dev/docs/kit/remote-functions)\n- 💬 [SvelteKit Discussion #13897](https://github.com/sveltejs/kit/discussions/13897)\n- 📰 [What's New in Svelte: August 2025](https://svelte.dev/blog/whats-new-in-svelte-august-2025)\n\n## 🎨 Features\n\n- ✅ **All major patterns** covered with live examples\n- ✅ **Type-safe** end-to-end with TypeScript\n- ✅ **Responsive design** with Tailwind CSS\n- ✅ **Beautiful UI** using shadcn-svelte components\n- ✅ **Toast notifications** for user feedback\n- ✅ **Error handling** demonstrations\n- ✅ **Progressive enhancement** examples\n\n## 🤝 Contributing\n\nContributions are welcome! If you have ideas for additional patterns or improvements:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-pattern`)\n3. Commit your changes (`git commit -m 'Add amazing pattern'`)\n4. Push to the branch (`git push origin feature/amazing-pattern`)\n5. Open a Pull Request\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- SvelteKit team for creating Remote Functions\n- shadcn for the amazing component library\n- The Svelte community for continuous inspiration\n\n---\n\n**[View Live Demo →](https://svelte-async-remote-fn.vercel.app)**\n\nMade with ❤️ using SvelteKit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiesson%2Fsvelte-async-remote-fn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiesson%2Fsvelte-async-remote-fn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiesson%2Fsvelte-async-remote-fn/lists"}