How saddysk/audiogram works
Project Type and Purpose
• This is a full-stack, Next.js (T3-stack) web application with two principal modes of operation:
– A client-rendered audiogram-editor UI served by Next.js’s pages and API routes.
– A standalone “bundler” tool that packages the audiogram into a static HTML+JS bundle and deploys it to AWS Lambda.
• Core functionality: take an audio file + transcript, generate interactive audiogram visualizations (waves, bars, hills, subtitles), and optionally produce a static embeddable bundle.
File Structure
Top-level directories and files:
• src/pages – Next.js pages:
– index.tsx, Audio.tsx: entrypoints for the UI
– api/render.ts: serverless endpoint that can render audiogram server-side
• src/components – reusable React components for audio I/O and UI
• src/audiogram – core audiogram library (visualization components, schema, audio utilities)
• public & bundled/public – static assets (audio.mp3, subtitles.srt, transcript.txt)
• bundled – output of the bundling process (bundle.js, index.html, public assets)
• createBundle.mjs – Node script using esbuild to produce the “bundled” folder
• deployProjectInLambda.mjs – Node script to upload the bundled output to AWS Lambda
• next.config.mjs, postcss.config.cjs, tailwind.config.ts, etc. – build/config files for Next.js and Tailwind
README
• Confirms use of the T3 stack (Next.js, NextAuth.js, Prisma, Tailwind CSS, tRPC), though Prisma/tRPC aren’t currently present in the file tree.
• Deployment targets include Vercel, Netlify, Docker—but here we see a custom AWS Lambda deployment script.
Main System Components
a. Developer Tooling (Local):
– createBundle.mjs (esbuild)
– deployProjectInLambda.mjs (AWS Lambda deployer)
b. Next.js Application:
– Frontend (Browser): pages under src/pages, React components in src/components & src/audiogram, styled by Tailwind CSS
– Serverless API (Next.js API Routes): /api/render.ts
c. Core Library:
– src/audiogram visualizations (WaveVisualization, BarsVisualization, HillsVisualization, subtitles)
– audioUtils, Schema.ts
d. Static/Public Assets:
– public/audiogram (audio.mp3, subtitles.srt, transcript.txt)
– bundled/public (same assets, packaged)
e. Deployment Target:
– AWS Lambda (serving the static index.html + bundle.js)
f. External Services (potential/optional):
– Authentication (NextAuth.js)
– Database (Prisma) – if added in future
– tRPC endpoints – if added
Relationships and Data Flows
• User (Browser) → Next.js Frontend → (reads public assets or calls API)
• Next.js Frontend ↔ Next.js API (/api/render) → potentially renders frames server-side
• Core Library (in browser or serverless) processes audio + transcript, produces visualization DOM or canvas
• Developer CLI (createBundle) uses core library to emit a static build → bundled/index.html + bundle.js
• deployProjectInLambda pushes bundled/* to AWS Lambda → serves static site under a custom domain
Architectural Patterns
• “Monorepo-like” structure combining:
– Full-stack React/Next.js app (SSR + SPA)
– CLI tooling for static bundling
– Serverless deployment pipeline
• Separation of concerns:
– src/pages for routing, src/components for UI primitives, src/audiogram for domain logic
– public vs. bundled for development vs. production assets