# b-onlynify/onlynify-ui-site architecture

> Architecture diagram of the GitHub repository b-onlynify/onlynify-ui-site, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/b-onlynify/onlynify-ui-site
- Repository: https://github.com/b-onlynify/onlynify-ui-site

## Overview

Onlynify UI is a Next.js storefront and server-side source service for a multi-framework UI kit. Visitors browse component and block demos, preview themes and sites, and convert registry markup into framework code; paid capabilities add Pro components, site templates, saved themes, and licence-gated downloads for the CLI. Accounts and checkout issue licences that gate premium source. The graph emphasizes documented workflows and relationships visible in the provided excerpts or SOURCE INDEX; unsampled page implementations and some feature wiring are represented only where the README documents them.

Main entry points: [`src/app/api/registry/[slug]/route.ts`](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/registry/%5Bslug%5D/route.ts) (CLI Registry API), [`src/app/api/pro/[slug]/route.ts`](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/pro/%5Bslug%5D/route.ts) (Pro Source API), [`src/app/api/checkout/route.ts`](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/checkout/route.ts) (Checkout and Webhooks), [`src/lib/theme.ts`](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/theme.ts) (Theme Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Kit Catalog"]
  node_catalogui["Catalog and Galleries<br/>[page.tsx]"]
  node_registry[("Component Registry<br/>[registry.ts]")]
  node_converter["Framework Converter<br/>[convert.ts]"]
  node_blocksource["Block Source<br/>[block-source.ts]"]
  node_previews["Live Previews<br/>[route.ts]"]
  node_progallery[("Pro Components<br/>[pro-components.ts]")]
end

subgraph group_themesites["Themes and Sites"]
  node_themeui["Theme Builder<br/>[builder.tsx]"]
  node_themeengine["Theme Engine<br/>[theme.ts]"]
  node_themesapi["Saved Theme API<br/>[route.ts]"]
  node_sitesui["Site Gallery and Studio<br/>[studio.tsx]"]
  node_siteengine["Site Assembly<br/>[sites.ts]"]
end

subgraph group_accounts["Accounts and Licensing"]
  node_authapi["Account Routes<br/>[route.ts]"]
  node_auth["Sessions and Auth<br/>[auth.ts]"]
  node_store[("JSON Data Store<br/>[store.ts]")]
  node_checkout["Checkout and Webhooks<br/>[route.ts]"]
  node_payments["Licence Fulfilment<br/>[payments.ts]"]
  node_gatewayadapter["Gateway Adapter<br/>[gateway.ts]"]
end

subgraph group_delivery["Source Delivery"]
  node_siteapi["Site Source API<br/>[route.ts]"]
  node_proapi["Pro Source API<br/>[route.ts]"]
  node_registryapi["CLI Registry API<br/>[route.ts]"]
end

node_visitor(("Visitor"))
node_cli(("Onlynify CLI"))
node_gateway{{"Payment Gateway"}}

node_visitor -->|"browses"| node_catalogui
node_catalogui -->|"shows catalog"| node_registry
node_visitor -->|"opens preview"| node_previews
node_previews -->|"loads markup"| node_blocksource
node_blocksource -->|"reads block"| node_registry
node_visitor -->|"customizes theme"| node_themeui
node_themeui -->|"validates and encodes"| node_themeengine
node_visitor -->|"browses and configures"| node_sitesui
node_sitesui -.->|"previews variations"| node_siteengine
node_siteengine -->|"applies theme"| node_themeengine
node_visitor -->|"saves theme"| node_themesapi
node_themesapi -->|"normalizes theme"| node_themeengine
node_themesapi -->|"reads and writes"| node_store
node_visitor -->|"creates account"| node_authapi
node_authapi -->|"creates session"| node_auth
node_auth -->|"reads and writes"| node_store
node_visitor -->|"starts purchase"| node_checkout
node_checkout -->|"creates order"| node_payments
node_payments -->|"creates gateway order"| node_gatewayadapter
node_gatewayadapter -.->|"requests payment"| node_gateway
node_gateway -.->|"returns payment result"| node_checkout
node_payments -->|"fulfils and records"| node_store
node_visitor -->|"requests Pro source"| node_proapi
node_proapi -->|"gets component files"| node_progallery
node_proapi -->|"selects framework"| node_converter
node_proapi -->|"applies theme"| node_themeengine
node_visitor -->|"requests site source"| node_siteapi
node_siteapi -->|"assembles files"| node_siteengine
node_siteapi -->|"decodes theme"| node_themeengine
node_cli -->|"requests block source"| node_registryapi
node_registryapi -->|"gets block files"| node_blocksource
node_registryapi -->|"forwards site request"| node_siteapi
node_registryapi -->|"forwards Pro request"| node_proapi
node_registryapi -->|"validates framework"| node_converter
node_registryapi -->|"checks licence"| node_payments
node_checkout -.->|"verifies checkout"| node_gatewayadapter
node_gateway -->|"sends webhook"| node_checkout

click node_catalogui "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/blocks/page.tsx"
click node_registry "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/registry.ts"
click node_converter "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/convert.ts"
click node_blocksource "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/block-source.ts"
click node_previews "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/preview/%5Bslug%5D/route.ts"
click node_progallery "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/pro-components.ts"
click node_themeui "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/themes/builder.tsx"
click node_themeengine "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/theme.ts"
click node_themesapi "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/themes/route.ts"
click node_sitesui "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/sites/%5Bslug%5D/studio.tsx"
click node_siteengine "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/sites.ts"
click node_siteapi "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/sites/%5Bslug%5D/route.ts"
click node_proapi "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/pro/%5Bslug%5D/route.ts"
click node_registryapi "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/registry/%5Bslug%5D/route.ts"
click node_authapi "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/auth/signup/route.ts"
click node_auth "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/auth.ts"
click node_store "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/store.ts"
click node_checkout "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/checkout/route.ts"
click node_payments "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/payments.ts"
click node_gatewayadapter "https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/gateway.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_catalogui,node_registry,node_converter,node_blocksource,node_previews,node_progallery toneBlue
class node_themeui,node_themeengine,node_themesapi,node_sitesui,node_siteengine toneAmber
class node_authapi,node_auth,node_store,node_checkout,node_payments,node_gatewayadapter toneMint
class node_siteapi,node_proapi,node_registryapi toneRose
class node_visitor,node_cli,node_gateway toneIndigo
```

## Components

### Kit Catalog

- [Catalog and Galleries](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/blocks/page.tsx): `src/app/blocks/page.tsx`
- [Component Registry](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/registry.ts): `src/lib/registry.ts`
- [Framework Converter](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/convert.ts): `src/lib/convert.ts`
- [Block Source](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/block-source.ts): `src/lib/block-source.ts`
- [Live Previews](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/preview/%5Bslug%5D/route.ts): `src/app/preview/[slug]/route.ts`
- [Pro Components](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/pro-components.ts): `src/lib/pro-components.ts`

### Themes and Sites

- [Theme Builder](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/themes/builder.tsx): `src/app/themes/builder.tsx`
- [Theme Engine](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/theme.ts): `src/lib/theme.ts`
- [Saved Theme API](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/themes/route.ts): `src/app/api/themes/route.ts`
- [Site Gallery and Studio](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/sites/%5Bslug%5D/studio.tsx): `src/app/sites/[slug]/studio.tsx`
- [Site Assembly](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/sites.ts): `src/lib/sites.ts`

### Accounts and Licensing

- [Account Routes](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/auth/signup/route.ts): `src/app/api/auth/signup/route.ts`
- [Sessions and Auth](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/auth.ts): `src/lib/auth.ts`
- [JSON Data Store](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/store.ts): `src/lib/store.ts`
- [Checkout and Webhooks](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/checkout/route.ts): `src/app/api/checkout/route.ts`
- [Licence Fulfilment](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/payments.ts): `src/lib/payments.ts`
- [Gateway Adapter](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/lib/gateway.ts): `src/lib/gateway.ts`

### Source Delivery

- [Site Source API](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/sites/%5Bslug%5D/route.ts): `src/app/api/sites/[slug]/route.ts`
- [Pro Source API](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/pro/%5Bslug%5D/route.ts): `src/app/api/pro/[slug]/route.ts`
- [CLI Registry API](https://github.com/b-onlynify/onlynify-ui-site/blob/development/src/app/api/registry/%5Bslug%5D/route.ts): `src/app/api/registry/[slug]/route.ts`

### Other components

- **Visitor**
- **Onlynify CLI**
- **Payment Gateway**

## Connections

- Visitor → Catalog and Galleries: browses
- Catalog and Galleries → Component Registry: shows catalog
- Visitor → Live Previews: opens preview
- Live Previews → Block Source: loads markup (evidence: `src/app/preview/[slug]/route.ts`)
- Block Source → Component Registry: reads block (evidence: `src/lib/block-source.ts`)
- Visitor → Theme Builder: customizes theme
- Theme Builder → Theme Engine: validates and encodes
- Visitor → Site Gallery and Studio: browses and configures
- Site Gallery and Studio → Site Assembly: previews variations
- Site Assembly → Theme Engine: applies theme (evidence: `src/lib/sites.ts`)
- Visitor → Saved Theme API: saves theme
- Saved Theme API → Theme Engine: normalizes theme (evidence: `src/app/api/themes/route.ts`)
- Saved Theme API → JSON Data Store: reads and writes (evidence: `src/app/api/themes/route.ts`)
- Visitor → Account Routes: creates account
- Account Routes → Sessions and Auth: creates session (evidence: `src/app/api/auth/signup/route.ts`)
- Sessions and Auth → JSON Data Store: reads and writes (evidence: `src/lib/auth.ts`)
- Visitor → Checkout and Webhooks: starts purchase
- Checkout and Webhooks → Licence Fulfilment: creates order (evidence: `src/app/api/checkout/route.ts`)
- Licence Fulfilment → Gateway Adapter: creates gateway order (evidence: `src/lib/payments.ts`)
- Gateway Adapter → Payment Gateway: requests payment
- Payment Gateway → Checkout and Webhooks: returns payment result
- Licence Fulfilment → JSON Data Store: fulfils and records (evidence: `src/lib/payments.ts`)
- Visitor → Pro Source API: requests Pro source
- Pro Source API → Pro Components: gets component files (evidence: `src/app/api/pro/[slug]/route.ts`)
- Pro Source API → Framework Converter: selects framework (evidence: `src/app/api/pro/[slug]/route.ts`)
- Pro Source API → Theme Engine: applies theme (evidence: `src/app/api/pro/[slug]/route.ts`)
- Visitor → Site Source API: requests site source
- Site Source API → Site Assembly: assembles files (evidence: `src/app/api/sites/[slug]/route.ts`)
- Site Source API → Theme Engine: decodes theme (evidence: `src/app/api/sites/[slug]/route.ts`)
- Onlynify CLI → CLI Registry API: requests block source
- CLI Registry API → Block Source: gets block files (evidence: `src/app/api/registry/[slug]/route.ts`)
- CLI Registry API → Site Source API: forwards site request (evidence: `src/app/api/registry/[slug]/route.ts`)
- CLI Registry API → Pro Source API: forwards Pro request (evidence: `src/app/api/registry/[slug]/route.ts`)
- CLI Registry API → Framework Converter: validates framework (evidence: `src/app/api/registry/[slug]/route.ts`)
- CLI Registry API → Licence Fulfilment: checks licence (evidence: `src/app/api/registry/[slug]/route.ts`)
- Checkout and Webhooks → Gateway Adapter: verifies checkout
- Payment Gateway → Checkout and Webhooks: sends webhook
