MuseMVP

MuseMVP Base:Node と Cloudflare 向けの Next.js。MuseMVP Flare:すべて Cloudflare 上で動く AI SaaS テンプレート。認証、決済、管理画面を同梱。

製品
  • ホーム
  • 料金
  • テンプレート
リソース
  • ドキュメント
  • ブログ
  • 変更履歴
法務
  • プライバシー
  • 利用規約
  • コミュニティ
Open-Launch Top 1 Daily WinnerOpen-Launch Top 1 Daily WinnerVerified DR - Verified Domain Rating for musemvp.comVerified DR - Verified Domain Rating for musemvp.comMuseMVP - Featured on Startup FameMuseMVP - Featured on Startup FameFazier badgeFazier badgeLiftOff award badgeLiftOff award badge

© 2026 MuseMVP. All rights reserved.

MuseMVP
  • 料金
  • ドキュメント
  • ブログ
  • 変更履歴
MuseMVP Base を購入
MuseMVP ドキュメント
MuseMVP ドキュメント
OverviewTech StackQuick Start
Project Structure
API ArchitectureBackend GuideDefining New RoutesAPI Keys
EmailObject Storage
Internationalization
SEOAnalytics
API

このページは選択した言語にまだ翻訳されていないため、English の原文を表示しています。

原文を表示(English)

API Architecture

An overview of MuseMVP's API: why Hono, how it integrates with Next.js, and availability/observability entry points.

MuseMVP uses a Hono + Next.js Route Handler setup: all APIs go through /api/*, with Hono managing routes and middleware.

Overview

src/app/api/[[...rest]]/route.ts
src/backend/api/app.ts
src/backend/api/routes/

The request path keeps a single entrypoint: /api/* -> route.ts -> Hono app.ts -> feature router -> service/query.


Why Hono

The reasons are straightforward:

  • Lightweight, with clear route and middleware organization
  • TypeScript-friendly, making type-safe API clients easier to build
  • Easy OpenAPI integration for interface collaboration

Compared to spreading logic across many Route Handlers, a centralized API layer is easier to maintain.


Availability

By default, API and Web are served together, so you do not need to maintain separate entrypoints. If you later add mobile, plugins, or third-party clients, you can still reuse the same Hono routes.

Common route groups (examples):

  • /api (auth)
  • /api/admin, /api/assets, /api/upload
  • /api/muse-billing, /api/upgrade, /api/newsletter
  • /api/health
  • /api/openapi, /api/docs

Layering convention:

  • Route: input validation, auth, HTTP responses
  • Service (src/modules/<feature>/lib/*): business orchestration
  • Query (packages/db/src/queries/*): database read/write

Error Handling and Request Limits

src/backend/api/app.ts also registers two app-level guards:

  • app.onError catches uncaught errors and returns a consistent JSON error structure; thrown HTTPExceptions keep their own responses
  • hono/body-limit caps API request bodies at 1MB; avatar uploads use a separate same-origin /files/avatars/* route with PNG/5 MiB checks

Observability

  • Health check: /api/health
  • OpenAPI: /api/openapi
  • API docs (Scalar UI): /api/docs

Practical Guideline

Keep middleware focused on entry responsibilities (logging, CORS, auth gate). Put complex business logic in the service layer to avoid API entry bloat.

Database Migrations

Review and apply D1 migrations with backups and release checks.

Backend Guide

A practical guide to src/backend responsibilities, api-client usage in client/server contexts, and the full request chain.

このページの内容

OverviewWhy HonoAvailabilityError Handling and Request LimitsObservability

1 回の支払い。税込。

MuseMVP Base

Node 向けと Cloudflare 向けの Next.js。認証・決済・管理画面付き。

$69

MuseMVP Base を購入