A modern starter kit that combines SvelteKit with Hono, featuring a robust RPC client API interface that wraps RPC responses as state.
src/
āāā app.d.ts # TypeScript declarations
āāā lib/
ā āāā components/ # Reusable Svelte components
ā ā āāā suspense.svelte # Suspense component for RPC state management
ā āāā global/ # Global utilities and configurations
ā ā āāā rpc/ # RPC client implementation
ā ā āāā call-rpc.svelte # RPC client implementation that wraps RPC responses as state
ā ā āāā create-rpc-client.ts # RPC client factory
ā āāā server/ # Server-side implementation
ā āāā middleware/ # Hono middleware
ā āāā procedure/ # RPC procedures
āāā routes/ # SvelteKit routes
āāā static/ # Static assets
The project includes a powerful RPC client implementation that:
The project includes a custom Suspense
component that seamlessly integrates with the RPC client to handle loading, error, and data states. The component:
Example usage:
<script lang="ts">
import { callRpc } from '$lib/global/rpc/call-rpc.svelte';
import Suspense from '$lib/components/suspense.svelte';
const result = callRpc({
keys: () => ['users'],
fn: async () => {
// Your RPC call implementation
}
});
</script>
<Suspense data={result}>
{#snippet error()}
<div>Error occurred: {error.message}</div>
{/snippet}
{#snippet loading()}
<div>Loading...</div>
{/snippet}
{#snippet children(data)}
<div>Success: {data}</div>
{/snippet}
</Suspense>
bun install
# or
npm install
bun run dev
# or
npm run dev
The project is set up with modern development tools:
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details