How shumatsumonobu/hostme works
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: Terminal.tsx Terminal UI · calc.ts Ranker · diagnose/page.tsx Diagnose · result/page.tsx Result
Components 25
UI layer
App Router pages and reusable interaction components
- Home · Main entry surface
src/app/page.tsx - Landing · Marketing and product landing page
src/app/lp/page.tsx - Diagnose · Seven-question quiz flow
src/app/diagnose/page.tsx - Result · Ranked recommendation view
src/app/result/page.tsx - About · Scoring explanation page
src/app/about/page.tsx - Shell · Global layout and shared chrome
src/app/layout.tsx - Terminal UI · Quiz interaction and progress presentation
src/components/Terminal.tsx - Question block · Renders an individual quiz step
src/components/QuestionBlock.tsx - Progress bar · Shows quiz completion state
src/components/ProgressBar.tsx - Action buttons · Primary and secondary user actions
src/components/ActionButtons.tsx - Typing text · Terminal-style animated copy
src/components/TypingText.tsx
Domain layer
Scoring, validation, and sharing logic
- Ranker · Turns answers into ranked recommendations
src/lib/calc.ts - Validate · Checks quiz state and scoring inputs
src/lib/validate.ts - Share link · Builds shareable result URLs and metadata
src/lib/share.ts
Content layer
Questions, service catalog, scoring data, and localized copy
Edge output
Dynamic preview image routes and social metadata
Runtime
Framework and deployment configuration
- Next config · Next.js build and app packaging settings
next.config.js - OpenNext · Cloudflare Workers deployment shape
open-next.config.ts
Connections 26
- 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