How kaminono/echocast-workshop works
Project Type and Purpose
• EchoCast Workshop is a full-stack web application built with Next.js 15 (App Router).
• Purpose: A content-creator workstation that covers end-to-end idea collection (text & voice), AI-powered optimization, local storage, and multilingual timeline management.
File Structure Analysis
• src/app/ – Next.js pages and API routes.
• API layer under /api/asr/recognize (speech-to-text) and /api/ideas/optimize (AI optimization).
• UI pages under /ideas, /drafts, /timeline, root pages and global layout/styles.
• src/components/ – Reusable UI components (modals, navigation, filters).
• src/lib/
• ai/ – OpenAI-compatible X1 client and wrappers.
• asr/ – iFlytek IAT client, transports, utils.
• indexeddb.ts – Local DB abstraction.
• src/types/ – Domain model & API type definitions.
• scripts/ – CLI/test scripts for quick AI/ASR calls.
• Configuration: Next.js (next.config.js), Tailwind (tailwind.config.js), TypeScript (tsconfig.json), Vitest (vitest.config.ts).
Architectural Patterns & Principles
• App Router + API Routes – Serverless-style backend within the same Next.js project.
• Layered Separation – UI layer → API layer → library layer → external services.
• Client-Server Separation – UI and local IndexedDB on client; sensitive AI/ASR calls on server.
• SOLID/KISS/YAGNI/DRY – Modular code, single responsibility, minimal coupling.
• State Machine Flow – For voice recording → ASR → AI optimization → persistence & feedback.
Main Components & Interactions
a. Frontend (Browser)
• Next.js pages & React components render UI, modals for idea creation and voice recording.
• IndexedDB via src/lib/indexeddb.ts for offline storage of text and blobs.
b. Backend/API (Next.js Server)
• /api/asr/recognize route: receives base64/Buffer, invokes IATClient (HMAC-SHA256 via WebSocket/HTTP), returns transcript.
• /api/ideas/optimize route: receives text, calls X1 Chat (openaiCompatClient), returns optimized output.
c. External Services
• Starfire X1 AI model via OpenAI-compatible SDK.
• iFlytek IAT speech-to-text service.
d. Data Stores
• Client: IndexedDB for ideas (text metadata + audio Blob).
• Volatile: In-memory session data for streaming/recording progress.