How kapishdima/remocn works
1. Repository shape
This is a single Next.js application that serves three main products from one codebase: the marketing/docs site, the shadcn-style component registry, and a server-side video render API for the interactive “stars” tool.
2. Primary user-facing surfaces
The app routes under app/(home) provide the public site: homepage, sponsors page, and the /stars generator. The app/docs route is the documentation experience. These are separate route groups, but they share the same underlying component system and site configuration.
3. Docs system
Documentation content lives in content/docs as MDX, organized by category such as compositions, UI blocks, transitions, typography, and environment. app/docs/[[...slug]] renders those docs, and the components/docs folder supplies the docs shell, cards, previews, command blocks, and tabbed layouts used by the Fumadocs-powered site.
4. Registry as the distribution boundary
The actual copy-paste library is expressed in registry/. There are two main registry families: registry/remocn-ui for reusable UI primitives and transitions, and registry/remocn for higher-level scenes and compositional animations. Each package has its own index.tsx and config.ts, with some entries also shipping previews and tests.
5. Published registry artifacts
The public/r/*.json files are the generated registry payloads consumed by shadcn add @remocn/.... This is the external contract of the repo: consumers do not import from the app directly; they pull registry JSON that resolves to code copied into their own project.
6. Remotion integration layer
src/remotion contains the Remotion entry points (Root.tsx, demo roots, and demo entry wiring). This is the animation/runtime boundary for anything that renders video scenes, previews, or compositions. The repository’s registry components are written to be copied into Remotion projects, not used as a runtime package dependency.
7. The /stars live generator
app/(home)/stars is a client-heavy experience that lets a user enter a GitHub repo, customize output, preview the result, and export MP4. The hooks under app/(home)/stars/hooks manage the tool state: fetching stargazers, controlling the player, orientation, generation progress, and export.
8. Server-side MP4 render pipeline
The /api/render endpoints implement asynchronous video rendering. The route accepts jobs, tracks status by jobId, and exposes a download endpoint once the render completes. Under lib/server, the render flow is split into validation, queueing, bundling, path management, cleanup, and rate limiting.
9. External data dependencies
The app integrates with GitHub for repo parsing and stargazer data. lib/github.ts and lib/github-stargazers.ts are the main integration points, while /api/search and /api/stargazers expose that data to the UI. These endpoints feed the “stars” workflow and likely the landing-page social proof sections.
10. Design system and shared UI
components/ui is a large internal component library built from shadcn/Radix-style primitives, extended with custom controls like charts, sliders, dialogs, sidebars, and toasts. Higher-level reusable visuals such as Aurora, Dither, Silk, shimmering text, and spotlight surfaces live at the top level in components/.
11. Site composition and theming
app/layout.tsx, app/globals.css, config/site.ts, and utilities in lib/layout.shared.tsx establish the global shell, metadata, and shared presentation rules. Theme toggling and responsive behavior are handled through small hooks/components in app/(home)/components and hooks/.
12. Build and deployment constraints
The repo is built with Bun, Biome, and Tailwind CSS 4. Deployment is sensitive to Remotion’s headless Chromium requirements: the README and tooling split the render deployment into Nixpacks or Dockerfile paths, with scripts such as bundle-remotion.mts, ensure-browser.mts, and render-demos.mts supporting prebundling and render readiness.
13. What to draw in an architecture diagram
A good diagram would show: users entering the Next.js app; content flowing from MDX and registry definitions into docs pages and generated registry JSON; the /stars UI calling GitHub-backed API routes; and the server render API invoking Remotion/headless Chromium to produce downloadable MP4s. The key boundary is that registry consumers copy code out of the repo, while the live app uses the same primitives to present docs, demos, and video generation.
Main entry points: layout.tsx App shell · page.tsx Stars tool · remocn-ui UI registry · remocn Scene registry
Components 21
Next.js app
Public site, docs, and live stars tool routes.
- App shell · Global app layout and metadata shell.
app/layout.tsx - Home site · Marketing homepage and shared public surfaces.
app/(home)/page.tsx - Sponsors · Sponsor landing page within the public site.
app/(home)/sponsors/page.tsx - Stars tool · Interactive GitHub repo to MP4 generator.
app/(home)/stars/page.tsx - Stars hooks · Client state, stargazer fetching, orientation, export, and player control.
app/(home)/stars/hooks
Docs system
MDX content and docs-specific UI.
- Docs page · Fumadocs-powered docs renderer.
app/docs/[[...slug]]/page.tsx - MDX content · Structured documentation source for site sections.
content/docs - Docs UI · Shells, previews, cards, tabs, and command blocks for docs.
components/docs
Registry
Copy-paste component distribution boundary.
- Registry index · Top-level registry catalog and package boundary.
registry/__index__.tsx - UI registry · Reusable UI primitives, transitions, and controls for copy-paste use.
registry/remocn-ui - Scene registry · Higher-level compositions, animations, and scene presets.
registry/remocn - Registry JSON · External shadcn add payloads consumed by downstream projects.
public/r/registry.json
Remotion runtime
Video rendering entry points and demo wiring.
- Remotion root · Remotion entry points and demo wiring boundary.
src/remotion/Root.tsx
Render backend
API routes and server-side render pipeline.
- Stars APIs · Search and stargazer endpoints consumed by the stars workflow.
app/api/search/route.ts - Render API · Job submission, status tracking, and download endpoints for MP4 rendering.
app/api/render/route.ts - Render flow · Validation, queueing, bundling, cleanup, paths, and rate limiting.
lib/server - GitHub data · Repo parsing and stargazer data access layer.
lib/github.ts
Shared UI
Reusable site components and design primitives.
- Site config · Global site metadata and navigation configuration.
config/site.ts - UI library · Internal shadcn/Radix-style primitives and controls.
components/ui - Site visuals · Custom high-level visual surfaces used across the app.
components
Tooling
Scripts and deployment/runtime support.
- Build scripts · Bundling, browser readiness, and demo render support scripts.
scripts/bundle-remotion.mts
Connections 22
- App shell → Home site: hosts · The global shell renders the public site routes.
- App shell → Docs page: hosts · The app shell also wraps the docs experience.
- App shell → Stars tool: hosts · The same shell wraps the interactive stars generator.
- Site config → App shell: metadata · Site metadata and navigation feed the app shell.
- MDX content → Docs page: content · MDX content is rendered into the docs route.
- Docs UI → Docs page: renders · Docs-specific shells and blocks compose the page.
- UI library → Docs UI: primitives · Docs UI is built on top of shared design primitives.
- Site visuals → Home site: decorates · Custom presentation components power landing sections.
- UI library → Site visuals: foundation · Higher-level visuals use the shared UI layer underneath.
- Stars tool → Stars hooks: state · The generator screen delegates most behavior to hooks.
- Stars hooks → Stars APIs: fetches · Client state pulls stargazer and search data from APIs.
- Stars APIs → GitHub data: reads · API routes rely on GitHub parsing and stargazer helpers.
- Render API → Render flow: orchestrates · Render endpoints drive the async server pipeline.
- Render flow → Remotion root: bundles · The server pipeline prepares Remotion compositions for rendering.
- Remotion root → Build scripts: prepares · Remotion entry points are supported by build and bundling scripts.
- Registry index → UI registry: indexes · The root registry catalog includes the UI family.
- Registry index → Scene registry: indexes · The root registry catalog includes the scene family.
- UI registry → Registry JSON: publishes · UI registry packages are emitted as external JSON payloads.
- Scene registry → Registry JSON: publishes · Scene registry packages are also emitted as registry JSON.
- Scene registry → Remotion root: targets · Scene packages are authored for Remotion projects and runtime.
- UI registry → Docs UI: showcased in · Docs examples and previews present registry primitives.
- Stars tool → Render API: exports · The live generator submits render jobs to the backend.