hono_svelte_template Svelte Themes

Hono_svelte_template

Kelner Akum Monorepo

A pnpm monorepo containing a SvelteKit frontend and Hono backend with OpenAPI-based type-safe API communication.

Structure

kelner_akum/
├── package.json          # Root workspace configuration
├── pnpm-workspace.yaml   # pnpm workspace configuration
├── packages/
│   ├── frontend/         # Svelte SPA application
│   └── backend/          # Hono backend application (multi-target)

Prerequisites

Getting Started

Install Dependencies

Install all workspace dependencies:

pnpm install

Development

Run both applications in development mode:

pnpm run dev

Run frontend only:

pnpm run dev:frontend

Run backend only:

pnpm run dev:backend

Building

Build all applications:

pnpm run build

Build frontend only:

pnpm run build:frontend

Build backend only:

pnpm run build:backend

Backend Deployment Targets

The backend is platform-agnostic and can be deployed to multiple environments:

  • Node.js (local dev, Fly.io): src/entry-node.ts
  • Cloudflare Workers: src/entry-cloudflare.ts
  • Vercel Edge: src/entry-vercel.ts

API Architecture

OpenAPI-First Design

This monorepo uses an OpenAPI-first approach for frontend-backend communication:

  • Backend: Hono server with OpenAPI documentation via hono-openapi
  • Frontend: Type-safe API client using openapi-typescript + openapi-fetch
  • Type Generation: Automatic type generation from OpenAPI spec on dev start/build
  • Documentation: Interactive API docs at http://localhost:3000/docs/openapi/ui

Benefits

Full type safety - End-to-end type safety without tight coupling ✅ Decoupled architecture - Frontend only depends on OpenAPI spec URL ✅ Auto-sync - Types regenerate automatically when backend changes ✅ Standard tooling - Compatible with Postman, Insomnia, and other OpenAPI tools

See MIGRATION_OPENAPI.md for detailed usage and patterns.

Workspace Packages

Frontend (packages/frontend)

SvelteKit SPA application with type-safe API client. See packages/frontend/README.md for more details.

Key features:

  • Auto-generated API types from OpenAPI spec
  • Type-safe fetch wrapper with Result pattern
  • Automatic type regeneration on dev start

Backend (packages/backend)

Hono backend application with OpenAPI documentation. See packages/backend/README.md for more details.

Key features:

  • OpenAPI specification at /docs/openapi
  • Interactive API docs at /docs/openapi/ui
  • Valibot-based validation with automatic OpenAPI schema generation
  • Multi-target deployment (Node.js, Cloudflare Workers, Vercel Edge)

Workspace Management

This monorepo uses pnpm workspaces. All packages are located in the packages/ directory.

To add a dependency to a specific workspace:

pnpm --filter frontend add <package-name>

Or navigate to the package directory:

cd packages/frontend
pnpm add <package-name>

To add a workspace dependency:

pnpm --filter frontend add backend@workspace:*

Top categories

Loading Svelte Themes