# shumatsumonobu/hostme architecture

> Architecture diagram of the GitHub repository shumatsumonobu/hostme, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shumatsumonobu/hostme
- Repository: https://github.com/shumatsumonobu/hostme

## Overview

1. **What this repo is**
   - `hostme` is a Next.js App Router application that guides a user through 7 questions and returns a ranked top 3 hosting recommendations.
   - The architecture is intentionally split between a small set of pure domain functions and a mostly presentational UI layer.

2. **Top-level application routes**
   - The user-facing surfaces live under `src/app`:
     - `/` main entry
     - `/lp` marketing/landing page
     - `/diagnose` diagnostic flow entry
     - `/result` results view
     - `/about` scoring explanation
   - Supporting routes include `sitemap.ts`, `not-found.tsx`, and generated asset routes for icons and OGP images.

3. **Core user flow**
   - The main flow is: enter diagnosis → answer 7 questions → compute scores → show ranked services and rationale → optionally share.
   - The quiz/progression UI is driven by reusable components like `QuestionBlock`, `ProgressBar`, `Terminal`, `TypingText`, and `ActionButtons`, which create the terminal-style interaction described in the README.

4. **Domain data is centralized in `src/data`**
   - `questions.ts` defines the 7-question interview.
   - `services.ts` defines the 10 hosting platforms being compared.
   - `scoring.ts` holds the scoring matrix / weights used to rank services.
   - `i18n.ts` and `lp-i18n.ts` contain English/Japanese copy, keeping content separate from rendering.
   - This makes `src/data` the primary source of truth for both the quiz content and the recommendation model.

5. **Pure logic lives in `src/lib`**
   - `calc.ts` is the core recommendation engine: it turns answers into service scores and ranks the results.
   - `validate.ts` likely guards input/state before scoring or rendering results.
   - `share.ts` centralizes share-link / result-link formatting.
   - `calc.test.ts` shows the scoring logic is unit-tested independently of the UI, which is important because ranking correctness is the product.

6. **Results and explanation are separate from scoring**
   - The result page is not just a score dump; it combines computed ranking with explanatory content so the user understands *why* each service fits.
   - This boundary matters: scoring happens in `src/lib`, while the explanation and presentation are in `src/app/result` and its components.

7. **Localization boundary**
   - The app supports English and Japanese, with language-aware content in the data layer and pages that likely switch copy via query param or route state.
   - The README indicates `?l=en` / `?l=ja`; the architecture therefore treats language as a first-class presentation concern rather than duplicating routes.

8. **Share and social preview generation**
   - `src/app/ogp/route.tsx` and `src/app/lp/ogp/route.tsx` generate Open Graph images dynamically.
   - This is a separate edge-rendered content path from the normal app pages, used for social cards and link previews.
   - `src/lib/share.ts` likely prepares the URL/data needed to connect the result state to these previews.

9. **Static assets and branding**
   - `public/` contains demo videos, fonts, robots.txt, verification files, and other static assets.
   - The demo media and icons are part of the product’s marketing layer, not the quiz logic.
   - `globals.css` and Tailwind v4 are used for the app-wide visual system.

10. **Runtime and deployment boundary**
   - The app is built with Next.js + TypeScript and deployed to **Cloudflare Workers** via `@opennextjs/cloudflare`.
   - `open-next.config.ts` and `wrangler.jsonc` define the Cloudflare deployment/runtime shape.
   - `next.config.js` plus `postcss.config.mjs` and `eslint.config.mjs` support the build toolchain and app packaging.

11. **Operational scripts**
   - `scripts/dev.sh`, `scripts/preview.sh`, and `scripts/deploy.sh` provide local development, preview, and release workflows.
   - `scripts/record-demo.js` supports generating the demo media shown in the README, which ties into the product’s documentation/marketing pipeline.

12. **Docs and maintenance model**
   - `docs/spec`, `docs/scoring.md`, `docs/deploy.md`, and `docs/security.md` indicate the project treats scoring rules, deployment, and safety as documented system boundaries.
   - This is a content-driven product with long-lived rules, so the docs are part of architecture: they govern how questions, service pricing, and scoring are maintained over time.

13. **What to draw in an architecture diagram**
   - A clear split would be:
     - **UI layer**: App Router pages + reusable terminal-style components
     - **Domain layer**: questions/services/scoring/calc/validation/share
     - **Content/localization layer**: i18n and landing-page copy
     - **Edge output layer**: OGP image routes and static assets
     - **Runtime/deployment layer**: Next.js on Cloudflare Workers via OpenNext
   - The main data flow is from user answers into scoring, then into result rendering and shareable metadata.

Main entry points: [`src/components/Terminal.tsx`](https://github.com/shumatsumonobu/hostme/blob/main/src/components/Terminal.tsx) (Terminal UI), [`src/lib/calc.ts`](https://github.com/shumatsumonobu/hostme/blob/main/src/lib/calc.ts) (Ranker), [`src/app/diagnose/page.tsx`](https://github.com/shumatsumonobu/hostme/blob/main/src/app/diagnose/page.tsx) (Diagnose), [`src/app/result/page.tsx`](https://github.com/shumatsumonobu/hostme/blob/main/src/app/result/page.tsx) (Result)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["UI layer"]
  node_app_root["Home<br/>route<br/>[page.tsx]"]
  node_app_lp["Landing<br/>route<br/>[page.tsx]"]
  node_app_diagnose["Diagnose<br/>route<br/>[page.tsx]"]
  node_app_result["Result<br/>route<br/>[page.tsx]"]
  node_app_about["About<br/>route<br/>[page.tsx]"]
  node_ui_layout["Shell<br/>[layout.tsx]"]
  node_ui_terminal["Terminal UI<br/>interaction components<br/>[Terminal.tsx]"]
  node_ui_question["Question block<br/>question component<br/>[QuestionBlock.tsx]"]
  node_ui_progress["Progress bar<br/>progress component<br/>[ProgressBar.tsx]"]
  node_ui_actions["Action buttons<br/>controls<br/>[ActionButtons.tsx]"]
  node_ui_typing["Typing text<br/>animation component<br/>[TypingText.tsx]"]
end

subgraph group_domain["Domain layer"]
  node_domain_calc{{"Ranker<br/>scoring engine<br/>[calc.ts]"}}
  node_domain_validate["Validate<br/>input guard<br/>[validate.ts]"]
  node_domain_share["Share link<br/>share formatter<br/>[share.ts]"]
end

subgraph group_content["Content layer"]
  node_content_questions["Questions<br/>quiz data<br/>[questions.ts]"]
  node_content_services["Services<br/>catalog data<br/>[services.ts]"]
  node_content_scoring["Scoring<br/>weights data<br/>[scoring.ts]"]
  node_content_i18n["Copy<br/>localized content<br/>[i18n.ts]"]
  node_content_lp_i18n["LP copy<br/>localized content<br/>[lp-i18n.ts]"]
end

subgraph group_edge["Edge output"]
  node_edge_ogp["OGP route<br/>edge image route<br/>[route.tsx]"]
  node_edge_lp_ogp["LP OGP<br/>edge image route<br/>[route.tsx]"]
end

subgraph group_runtime["Runtime"]
  node_runtime_next["Next config<br/>build config<br/>[next.config.js]"]
  node_runtime_opennext["OpenNext<br/>deployment config"]
end

subgraph group_ops["Operations"]
  node_ops_scripts["Scripts<br/>[deploy.sh]"]
  node_docs_spec["Specs<br/>docs<br/>[spec.md]"]
end

node_app_root -->|"starts"| node_app_diagnose
node_app_root -.->|"also routes"| node_app_lp
node_app_diagnose -->|"renders with"| node_ui_terminal
node_ui_terminal -->|"contains"| node_ui_question
node_ui_terminal -->|"shows"| node_ui_progress
node_ui_terminal -->|"offers"| node_ui_actions
node_ui_terminal -->|"animates"| node_ui_typing
node_ui_question -->|"reads"| node_content_questions
node_ui_question -->|"localizes"| node_content_i18n
node_app_diagnose -->|"checks input"| node_domain_validate
node_app_diagnose -->|"scores answers"| node_domain_calc
node_domain_calc -->|"compares"| node_content_services
node_domain_calc -->|"applies"| node_content_scoring
node_domain_calc -.->|"depends on"| node_domain_validate
node_app_result -->|"consumes"| node_domain_calc
node_app_result -->|"prepares share"| node_domain_share
node_domain_share -->|"feeds"| node_edge_ogp
node_app_lp -->|"reads"| node_content_lp_i18n
node_app_lp -->|"pairs with"| node_edge_lp_ogp
node_edge_lp_ogp -->|"uses"| node_content_lp_i18n
node_app_result -->|"localizes"| node_content_i18n
node_app_about -->|"explains"| node_content_scoring
node_app_about -.->|"documents"| node_docs_spec
node_ui_layout -->|"configured by"| node_runtime_next
node_runtime_opennext -.->|"driven by"| node_ops_scripts
node_ops_scripts -.->|"supports"| node_edge_ogp

click node_app_root "https://github.com/shumatsumonobu/hostme/blob/main/src/app/page.tsx"
click node_app_lp "https://github.com/shumatsumonobu/hostme/blob/main/src/app/lp/page.tsx"
click node_app_diagnose "https://github.com/shumatsumonobu/hostme/blob/main/src/app/diagnose/page.tsx"
click node_app_result "https://github.com/shumatsumonobu/hostme/blob/main/src/app/result/page.tsx"
click node_app_about "https://github.com/shumatsumonobu/hostme/blob/main/src/app/about/page.tsx"
click node_ui_layout "https://github.com/shumatsumonobu/hostme/blob/main/src/app/layout.tsx"
click node_ui_terminal "https://github.com/shumatsumonobu/hostme/blob/main/src/components/Terminal.tsx"
click node_ui_question "https://github.com/shumatsumonobu/hostme/blob/main/src/components/QuestionBlock.tsx"
click node_ui_progress "https://github.com/shumatsumonobu/hostme/blob/main/src/components/ProgressBar.tsx"
click node_ui_actions "https://github.com/shumatsumonobu/hostme/blob/main/src/components/ActionButtons.tsx"
click node_ui_typing "https://github.com/shumatsumonobu/hostme/blob/main/src/components/TypingText.tsx"
click node_content_questions "https://github.com/shumatsumonobu/hostme/blob/main/src/data/questions.ts"
click node_content_services "https://github.com/shumatsumonobu/hostme/blob/main/src/data/services.ts"
click node_content_scoring "https://github.com/shumatsumonobu/hostme/blob/main/src/data/scoring.ts"
click node_content_i18n "https://github.com/shumatsumonobu/hostme/blob/main/src/data/i18n.ts"
click node_content_lp_i18n "https://github.com/shumatsumonobu/hostme/blob/main/src/data/lp-i18n.ts"
click node_domain_calc "https://github.com/shumatsumonobu/hostme/blob/main/src/lib/calc.ts"
click node_domain_validate "https://github.com/shumatsumonobu/hostme/blob/main/src/lib/validate.ts"
click node_domain_share "https://github.com/shumatsumonobu/hostme/blob/main/src/lib/share.ts"
click node_edge_ogp "https://github.com/shumatsumonobu/hostme/blob/main/src/app/ogp/route.tsx"
click node_edge_lp_ogp "https://github.com/shumatsumonobu/hostme/blob/main/src/app/lp/ogp/route.tsx"
click node_runtime_next "https://github.com/shumatsumonobu/hostme/blob/main/next.config.js"
click node_runtime_opennext "https://github.com/shumatsumonobu/hostme/blob/main/open-next.config.ts"
click node_ops_scripts "https://github.com/shumatsumonobu/hostme/blob/main/scripts/deploy.sh"
click node_docs_spec "https://github.com/shumatsumonobu/hostme/blob/main/docs/spec.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_root,node_app_lp,node_app_diagnose,node_app_result,node_app_about,node_ui_layout,node_ui_terminal,node_ui_question,node_ui_progress,node_ui_actions,node_ui_typing toneBlue
class node_domain_calc,node_domain_validate,node_domain_share toneAmber
class node_content_questions,node_content_services,node_content_scoring,node_content_i18n,node_content_lp_i18n toneMint
class node_edge_ogp,node_edge_lp_ogp toneRose
class node_runtime_next,node_runtime_opennext toneIndigo
class node_ops_scripts,node_docs_spec toneTeal
```

## Components

### UI layer

App Router pages and reusable interaction components

- [Home](https://github.com/shumatsumonobu/hostme/blob/main/src/app/page.tsx): route · Main entry surface · `src/app/page.tsx`
- [Landing](https://github.com/shumatsumonobu/hostme/blob/main/src/app/lp/page.tsx): route · Marketing and product landing page · `src/app/lp/page.tsx`
- [Diagnose](https://github.com/shumatsumonobu/hostme/blob/main/src/app/diagnose/page.tsx): route · Seven-question quiz flow · `src/app/diagnose/page.tsx`
- [Result](https://github.com/shumatsumonobu/hostme/blob/main/src/app/result/page.tsx): route · Ranked recommendation view · `src/app/result/page.tsx`
- [About](https://github.com/shumatsumonobu/hostme/blob/main/src/app/about/page.tsx): route · Scoring explanation page · `src/app/about/page.tsx`
- [Shell](https://github.com/shumatsumonobu/hostme/blob/main/src/app/layout.tsx): app shell · Global layout and shared chrome · `src/app/layout.tsx`
- [Terminal UI](https://github.com/shumatsumonobu/hostme/blob/main/src/components/Terminal.tsx): interaction components · Quiz interaction and progress presentation · `src/components/Terminal.tsx`
- [Question block](https://github.com/shumatsumonobu/hostme/blob/main/src/components/QuestionBlock.tsx): question component · Renders an individual quiz step · `src/components/QuestionBlock.tsx`
- [Progress bar](https://github.com/shumatsumonobu/hostme/blob/main/src/components/ProgressBar.tsx): progress component · Shows quiz completion state · `src/components/ProgressBar.tsx`
- [Action buttons](https://github.com/shumatsumonobu/hostme/blob/main/src/components/ActionButtons.tsx): controls · Primary and secondary user actions · `src/components/ActionButtons.tsx`
- [Typing text](https://github.com/shumatsumonobu/hostme/blob/main/src/components/TypingText.tsx): animation component · Terminal-style animated copy · `src/components/TypingText.tsx`

### Domain layer

Scoring, validation, and sharing logic

- [Ranker](https://github.com/shumatsumonobu/hostme/blob/main/src/lib/calc.ts): scoring engine · Turns answers into ranked recommendations · `src/lib/calc.ts`
- [Validate](https://github.com/shumatsumonobu/hostme/blob/main/src/lib/validate.ts): input guard · Checks quiz state and scoring inputs · `src/lib/validate.ts`
- [Share link](https://github.com/shumatsumonobu/hostme/blob/main/src/lib/share.ts): share formatter · Builds shareable result URLs and metadata · `src/lib/share.ts`

### Content layer

Questions, service catalog, scoring data, and localized copy

- [Questions](https://github.com/shumatsumonobu/hostme/blob/main/src/data/questions.ts): quiz data · Seven-question interview flow · `src/data/questions.ts`
- [Services](https://github.com/shumatsumonobu/hostme/blob/main/src/data/services.ts): catalog data · Hosting platforms being compared · `src/data/services.ts`
- [Scoring](https://github.com/shumatsumonobu/hostme/blob/main/src/data/scoring.ts): weights data · Scoring matrix and ranking rules · `src/data/scoring.ts`
- [Copy](https://github.com/shumatsumonobu/hostme/blob/main/src/data/i18n.ts): localized content · English and Japanese app copy · `src/data/i18n.ts`
- [LP copy](https://github.com/shumatsumonobu/hostme/blob/main/src/data/lp-i18n.ts): localized content · Landing-page-specific copy · `src/data/lp-i18n.ts`

### Edge output

Dynamic preview image routes and social metadata

- [OGP route](https://github.com/shumatsumonobu/hostme/blob/main/src/app/ogp/route.tsx): edge image route · Dynamic Open Graph image generation · `src/app/ogp/route.tsx`
- [LP OGP](https://github.com/shumatsumonobu/hostme/blob/main/src/app/lp/ogp/route.tsx): edge image route · Landing-page social preview generation · `src/app/lp/ogp/route.tsx`

### Runtime

Framework and deployment configuration

- [Next config](https://github.com/shumatsumonobu/hostme/blob/main/next.config.js): build config · Next.js build and app packaging settings · `next.config.js`
- [OpenNext](https://github.com/shumatsumonobu/hostme/blob/main/open-next.config.ts): deployment config · Cloudflare Workers deployment shape · `open-next.config.ts`

### Operations

Scripts and docs for development and maintenance

- [Scripts](https://github.com/shumatsumonobu/hostme/blob/main/scripts/deploy.sh): workflow scripts · Dev, preview, deploy, and demo recording · `scripts/deploy.sh`
- [Specs](https://github.com/shumatsumonobu/hostme/blob/main/docs/spec.md): docs · Architecture, scoring, and maintenance rules · `docs/spec.md`

## Connections

- Home → Diagnose: starts · Main entry leads into the diagnostic flow
- Home → Landing: also routes · Home surface connects to marketing content
- Diagnose → Terminal UI: renders with · Diagnostic flow uses terminal-style interaction components
- Terminal UI → Question block: contains · Question blocks drive the quiz step UI
- Terminal UI → Progress bar: shows · Progress is presented alongside the quiz interaction
- Terminal UI → Action buttons: offers · Action buttons control progression and submission
- Terminal UI → Typing text: animates · Typing effect supports the terminal feel
- Question block → Questions: reads · Displays the seven interview questions
- Question block → Copy: localizes · Uses shared app copy for prompts and labels
- Diagnose → Validate: checks input · Validates quiz state before scoring
- Diagnose → Ranker: scores answers · Computes service rankings from responses
- Ranker → Services: compares · Evaluates the hosting catalog
- Ranker → Scoring: applies · Uses scoring weights and rule matrix
- Ranker → Validate: depends on · Keeps scoring inputs well-formed
- Result → Ranker: consumes · Renders the ranked services and rationale
- Result → Share link: prepares share · Builds shareable result metadata
- Share link → OGP route: feeds · Provides data used by social preview rendering
- Landing → LP copy: reads · Landing page is driven by localized marketing copy
- Landing → LP OGP: pairs with · Landing page has its own share preview route
- LP OGP → LP copy: uses · Generates preview cards from landing-page copy
- Result → Copy: localizes · Result view uses shared app copy
- About → Scoring: explains · User-facing explanation mirrors the scoring rules
- About → Specs: documents · Connects explanation page to maintained scoring specs
- Shell → Next config: configured by · Global app shell depends on framework build settings
- OpenNext → Scripts: driven by · Deployment is executed through release scripts
- Scripts → OGP route: supports · Operational workflow covers preview and demo generation
