How jonrgull/convertium works
Project type and purpose
• This is a full-stack, single-page Next.js application (“Convertium”) for converting foreign names or Japanese text between Hiragana, full-width Katakana, half-width Katakana, and English via Google Cloud Translate.
• The README confirms: it’s built in Next.js + TypeScript with Chakra UI, uses two conversion libraries on the client, and calls Google Cloud Translate via a Next.js API route.
File structure
• Top-level:
• components/ ← React UI components (Footer, Nav, plus jpn-specific converters)
• pages/ ← Next.js pages & API routes
– index.tsx ← main UI page
– api/translate.ts ← server-side function calling Google Translate
• public/ ← static assets (images, gifs)
• styles/ ← global CSS
• package.json, tsconfig.json, pnpm-lock.yaml, etc.
• The presence of pages/api identifies an internal backend (Node) layer.
• UI logic (romaji-conv, encoding-japanese) lives in components/jpn; external API calls live in pages/api.
README for additional insights
• No database is in use.
• Key tech: Next.js (SSR/CSR hybrid), TypeScript, Chakra UI, Google Cloud Translate API, romaji-conv, encoding-japanese.
a. Main components:
1. Client Browser (React/Chakra UI)
2. Next.js Frontend (pages, components)
3. Next.js API Layer (pages/api/translate.ts)
4. External Service – Google Cloud Translate API
5. Conversion Libraries (romaji-conv, encoding-japanese)
6. Static Assets Server (public folder)
b. Relationships & data flows:
• User inputs text in the Client Browser.
• For simple conversions (Hiragana↔Katakana/half-width), client calls romaji-conv & encoding-japanese directly in the browser.
• For English→Japanese translation or other translations, browser issues HTTP POST to Next.js API (/api/translate).
• API route invokes Google Cloud Translate, processes the result server-side, returns JSON.
• Client receives JSON, updates UI.
• Static assets (Sample.gif) served from the public folder via Next.js.
c. Architectural patterns / design principles:
• Monorepo full-stack: UI and API in same codebase.
• API Routing: Next.js “pages/api” directory pattern.
• Component-based UI (React + Chakra UI).
• Separation of concerns: conversion logic split between client libraries and server API calls.
• No persistent storage; stateless conversion.
d. Relevant technologies:
• Next.js (React server/client rendering)
• TypeScript
• Chakra UI (design system)
• romaji-conv, encoding-japanese (client conversion)
• Google Cloud Translate API (third-party translation)
Final guidance
• Timing (e.g., SSR vs. CSR) if relevant.