How adityakanu/memphi-ui works
Project type and purpose
• This is a Next.js-based documentation and demo site for a React component library (“Memphi UI”).
• It serves three primary purposes:
• Host interactive docs under app/docs/
• Live examples under app/examples/
• Publish a generated component registry (JSON files in public/r/)
File structure
• Top-level:
• app/ – Next.js App Router (pages, docs, examples, layout)
• components/ – The actual Memphi UI library (components/memphi/) and supporting UI utilities (components/ui/)
• registry/ – Schema and TypeScript source for building the registry
• scripts/ – build-registry.ts that reads registry/ sources and outputs JSON under public/r/
• public/ – Static assets, including the generated registry JSON (public/r/*.json)
• Configs and tools:
• next.config.ts, tsconfig.json, postcss.config.mjs, eslint.config.mjs
• Tailwind CSS applied via globals.css in app/
• Dependencies: Radix UI, class-variance-authority, clsx, tailwind-merge
Key insights from README
• Architecture is wholly front-end, with a build step to generate registry data.
• No runtime backend or external data store; everything is SSG or client-side fetch of JSON.
• Documentation and examples are built into the same Next.js app.
a. Main components
• Developer Local Environment (IDE, Node/npm)
• Build Script (scripts/build-registry.ts)
• Source Registries (registry/*.ts, registry/ui/*.tsx)
• Generated JSON Registry (public/r/*.json)
• Next.js App (the app/ directory)
• Component Library (components/memphi/*)
• UI Utility Components (components/ui/*)
• Browser Client (user’s browser)
b. Relationships and interactions
1. Developer runs npm run registry:build
→ Build Script reads registry/ sources
→ Emits JSON artifacts under public/r/
2. npm run build for Next.js
→ Static Site Generation (SSG) of docs, examples, and component pages
→ Incorporates JSON registry as data source
3. Runtime:
• Browser requests pages
• Next.js serves pre-rendered HTML or hydrates on client
• Client-side React can fetch JSON from /r/*.json to power interactive demos
c. Architectural patterns and design principles
• Monorepo-style separation of concerns: “library” vs. “docs” vs. “registry”
• Static site generation using Next.js App Router
• Code-as-data registry pattern: TS sources → JSON → docs UI
• Utility-first CSS (Tailwind) with design-system theming via CSS variables
d. Relevant technologies/frameworks
• Next.js 15 with App Router
• React + TypeScript
• Tailwind CSS (configured in globals.css)
• Radix UI primitives for accessibility
• class-variance-authority, clsx, tailwind-merge for styling
Important notes
• Clearly distinguish between build-time and runtime responsibilities
• Registry generation step is prominent; it’s central to the system’s architecture
• Don’t over-complicate—focus on showing accurate, distinct modules and their interactions