{"id":30691245,"url":"https://github.com/devgauravjatt/svelte-remote-functions-example","last_synced_at":"2026-02-27T14:04:23.102Z","repository":{"id":299937107,"uuid":"1004670738","full_name":"devgauravjatt/svelte-remote-functions-example","owner":"devgauravjatt","description":"This is a showcase of SvelteKit Remote Functions with links to examples and discussions.","archived":false,"fork":false,"pushed_at":"2025-06-19T02:25:25.000Z","size":312,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-02T03:56:16.276Z","etag":null,"topics":["remote-function-call","svelte","sveltekit"],"latest_commit_sha":null,"homepage":"","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devgauravjatt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-06-19T02:11:50.000Z","updated_at":"2025-07-22T19:31:21.000Z","dependencies_parsed_at":"2025-06-19T03:29:31.875Z","dependency_job_id":"222bc2fb-a305-4cde-aef4-8b4072e4b323","html_url":"https://github.com/devgauravjatt/svelte-remote-functions-example","commit_stats":null,"previous_names":["devgauravjatt/svelte-remote-functions-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devgauravjatt/svelte-remote-functions-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fsvelte-remote-functions-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fsvelte-remote-functions-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fsvelte-remote-functions-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fsvelte-remote-functions-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devgauravjatt","download_url":"https://codeload.github.com/devgauravjatt/svelte-remote-functions-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgauravjatt%2Fsvelte-remote-functions-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29898872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T12:09:13.686Z","status":"ssl_error","status_checked_at":"2026-02-27T12:09:13.282Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["remote-function-call","svelte","sveltekit"],"created_at":"2025-09-02T03:46:27.826Z","updated_at":"2026-02-27T14:04:23.097Z","avatar_url":"https://github.com/devgauravjatt.png","language":"Svelte","readme":"# ⚡ SvelteKit Remote Functions Example\n\nWelcome to a demo of the new **Remote Functions** in [SvelteKit](https://github.com/sveltejs/kit/discussions/13897)! This feature is currently experimental 🧪 and provides a powerful way to colocate server logic directly with components using `.remote.ts` files.\n\n\u003e [!WARNING]\n\u003e Remote Functions are currently in experimental and not yet officially released in a stable version.\n\n---\n\n## 🤣 Fast use\n\n```bash\n\npnpm dlx gitpick https://github.com/devgauravjatt/svelte-remote-functions-example\n\ncd svelte-remote-functions-example\n\npnpm i \u0026\u0026 pnpm dev\n\n```\n\n## 🧪 What Are Remote Functions?\n\nRemote Functions let you write server-only logic in `.remote.ts` files and call them from your Svelte components as if they were regular functions. Depending on whether you're on the client or server, they either execute directly or automatically wrap a `fetch()` request behind the scenes.\n\n✨ **Highlights:**\n\n- 🔐 Safe \u0026 secure server-only code (e.g., DB access, secrets)\n- 📦 Fully type-safe and colocated logic\n- 💨 Automatically serialized via `devalue`\n- 🔄 Reactive and cached query results\n- 🧩 Supports `query`, `form`, `command`, and `prerender`\n\n---\n\n## 📂 Examples\n\nExplore the source code examples:\n\n- ✅ [Todos Example (Full CRUD)](https://github.com/devgauravjatt/svelte-remote-functions-example/tree/main/src/routes/todos)\n- 🧱 [Simple Todos (Inspired by Joy of Code)](https://github.com/devgauravjatt/svelte-remote-functions-example/tree/main/src/routes/todos-simple)\n\n---\n\n## 🔗 Official Resources\n\n- 📚 [Remote Functions Official Discussion #13897](https://github.com/sveltejs/kit/discussions/13897)\n- 🎥 [Joy of Code's Remote Function Example Repo](https://github.com/mattcroat/svelte-rpc-example)\n\n---\n\n## 🧑‍💻 Try It Yourself\n\nTo enable Remote Functions in your project:\n\n```ts\n// svelte.config.js\nconst config = {\n\tkit: {\n\t\texperimental: {\n\t\t\tremoteFunctions: true\n\t\t}\n\t},\n\tcompilerOptions: {\n\t\texperimental: {\n\t\t\tasync: true\n\t\t}\n\t}\n};\n```\n\nThen create a `.remote.ts` file and use `query`, `form`, or `command` from `$app/server`.\n\nExample:\n\n```ts\n// data.remote.ts\nimport { query, form } from '$app/server';\nimport * as db from '$lib/server/db';\n\nexport const getLikes = query(async (id: string) =\u003e {\n\tconst [row] = await db.sql`SELECT likes FROM item WHERE id = ${id}`;\n\treturn row.likes;\n});\n\nexport const addLike = form(async (data: FormData) =\u003e {\n\tconst id = data.get('id');\n\tawait db.sql`UPDATE item SET likes = likes + 1 WHERE id = ${id}`;\n\treturn { success: true };\n});\n```\n\n---\n\n## 📣 Contributions Welcome!\n\nGot ideas, examples, or improvements? Open a PR or issue — let’s build this together! 🚀\n\n---\n\n## 📜 License\n\nMIT © [devgauravjatt](https://github.com/devgauravjatt) and [Joy of Code](https://github.com/mattcroat)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgauravjatt%2Fsvelte-remote-functions-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevgauravjatt%2Fsvelte-remote-functions-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgauravjatt%2Fsvelte-remote-functions-example/lists"}