Plotcn Registry
Source distribution for visualization components. The Plotcn Registry packages charts, shared primitives, utilities, dependencies, and metadata into installable source items that can be resolved by the shadcn CLI and copied directly into your application.
pnpm dlx shadcn@latest add @plotcn/line-basicPlotcn Registry Distribution Architecture
How registry manifests, npm packages, and shared primitives flow from the remote catalog directly into your local codebase.
What is the Plotcn Registry?
The Plotcn Registry is the source-distribution layer for Plotcn visualizations. Instead of forcing every chart into a monolithic npm runtime package, registry items describe the source files, npm packages, shared primitives, and metadata required to install one focused piece of the visualization system.
When you install a component, the shadcn CLI fetches the JSON manifest from the registry, resolves any nested dependencies, and writes pristine, fully-typed TypeScript source files directly into your project repository.
Why source distribution over an npm library?
Traditional chart libraries ship pre-bundled JavaScript with opaque internal styles, rigid markup wrappers, and heavy peer dependencies. If you need to tweak an SVG attribute, customize an axis label, or adapt an internal hook, you are blocked by the package boundary.
With the Plotcn Registry:
- Zero wrapper abstraction: You receive raw React and SVG elements you can directly inspect and modify.
- Selective installation: Installing a basic line chart pulls only
rechartsand the shared container primitive—never D3, Google Charts, or unrelated visual engines. - Seamless design integration: Components immediately adopt your Tailwind CSS tokens, CSS variables, and font configurations.
Registry mental model
Understanding the registry requires shifting from a "package dependency" mindset to a "source adoption" lifecycle:
Source Delivery Lifecycle
Understanding the shift from external node_modules package dependencies to direct Git-tracked source code adoption.
- 01DoneDiscovery & Catalog
Browse chart primitives or query registry catalog index for Cartesian, D3, or Google choropleths.
- 02Doneshadcn CLI Resolution
CLI parses @plotcn/<item>, fetches static manifest from https://plotcn.vercel.app/r/{name}.json, and audits dependencies.
- 03ActiveLocal Materialization
Writes pure TypeScript source to components/charts/, resolves chart-container primitive, and rewrites aliases.
- 04DoneNative App Compilation
Your Next.js or Vite bundler compiles standard React components. Zero telemetry or ongoing server dependency.
The 4-step mental flow
- Discovery & Catalog: You browse available chart primitives or search the registry index for specific layout needs (Cartesian line, bar, D3 force simulation, Google GeoChart).
- Item Resolution: The shadcn CLI parses the item address (e.g.
@plotcn/line-basic), resolves the registry endpoint from yourcomponents.json, and downloads the static JSON manifest. - Local Source Materialization: The CLI verifies required npm dependencies, resolves shared registry primitives (
chart-container.tsx), and writes the code into your designated@/components/chartsdirectory. - Independent Application Compilation: From this point onward, your bundler (Turbopack, Vite, Webpack) compiles the code like any other component in your project.
A critical distinction for Google Charts
While Recharts and D3.js components compile and execute entirely from local code and npm dependencies, Google Charts components rely on Google's hosted google.visualization runtime. The registry item for a Google chart provides the local React wrapper, lifecycle hook, and container styling, while the underlying chart rendering engine is loaded on-demand in the client browser from Google's secure CDN.
Registry namespace
Modern shadcn CLI supports namespaced registries using the @namespace/item convention configured in components.json.
For Plotcn, the intended public namespace format is:
@plotcn/<item>For example, @plotcn/line-basic resolves to the basic Cartesian line chart manifest.
Namespace Anatomy & CLI URL Resolution
How the shadcn CLI maps the namespaced command to the remote manifest endpoint.
Configuring the namespace in components.json
To enable the @plotcn namespace in your project, declare it under the registries dictionary in your components.json:
{ "$schema": "https://ui.shadcn.com/schema.json", "style": "new-york", "rsc": true, "tsx": true, "tailwind": { "config": "tailwind.config.ts", "css": "app/globals.css", "baseColor": "zinc", "cssVariables": true }, "aliases": { "components": "@/components", "utils": "@/lib/utils", "ui": "@/components/ui", "lib": "@/lib", "hooks": "@/hooks" }, "registries": { "@plotcn": "https://plotcn.vercel.app/r/{name}.json" }}The {name} parameter acts as a URL template. When you request @plotcn/line-basic, the CLI substitutes {name} with line-basic and requests https://plotcn.vercel.app/r/line-basic.json.
Browse and inspect items
The shadcn CLI provides built-in discovery and auditing tools for configured registries:
shadcn CLI Registry Commands
Installs the line chart component source and required Recharts dependency directly into your application.
pnpm dlx shadcn@latest add @plotcn/line-basic✔ Resolving @plotcn/line-basic
✔ Installing dependencies: recharts
✔ Creating components/charts/recharts/line-basic.tsx
✔ Creating components/charts/shared/chart-container.tsx
✔ Installation complete.Inspecting before installation with view
Transparency is central to Plotcn's philosophy. Before writing any files to your project or installing npm packages, you can inspect the exact manifest payload:
Checking public registry…
View local registry JSONCopied as source into your project (requires recharts).
This outputs the complete JSON manifest, allowing you to audit:
- All required npm packages (
dependencies) - All required shared Plotcn primitives (
registryDependencies) - Every source file and target destination (
files)
Anatomy of a registry item
Every installable Plotcn visualization is described by a single static JSON manifest following the official shadcn Registry specification.
Registry Item JSON Schema Explorer
Click any field to inspect its role in dependency resolution and file copying.
{
"name": "line-basic",
"type": "registry:component",
"description": "Responsive cartesian line chart with tooltip and hover state.",
"dependencies": ["recharts"],
"registryDependencies": ["chart-container", "chart-theme"],
"files": [
{
"path": "components/charts/recharts/line-basic.tsx",
"type": "registry:component",
"target": "components/charts/recharts/line-basic.tsx"
}
]
}Standard npm packages that must be installed in package.json for this chart to run.
Strictly isolated per engine. A Recharts chart installs 'recharts' only. D3 charts install granular packages like 'd3-shape'.
Core schema fields
name: The kebab-case identifier for the item (e.g.line-basic,d3-force-network).type: The resource type, typically"registry:block"for standalone charts or"registry:ui"for shared primitives likechart-container.description: A concise technical summary used by CLI search and developer tooling.dependencies: Array of npm package dependencies that must be present or installed inpackage.json.registryDependencies: Array of other registry item names required by this component.files: Array of file objects specifying local content or remote source URLs and target installation paths.
Catalog metadata separation
Plotcn maintains rich catalog metadata (engine category, accessibility tags, complexity tier) in our internal documentation catalog. However, in strict adherence to shadcn standards, we never inject non-standard fields into the published registry JSON manifests. This guarantees 100% compatibility with standard shadcn tooling.
Files
A well-architected registry item declares only the source files actually required for that visualization. Plotcn avoids bundling massive monolithic utilities when installing a single chart.
Filesystem Evolution (Pre vs Post Install)
Zero Framework BloatTarget aliases resolve directly from your components.json configuration. Source files are written directly into your designated directory, never into an inaccessible node_modules package.
File destination mapping
The CLI maps registry source paths to your application structure based on your components.json alias settings:
File Destination & Alias Path Mapping
The shadcn CLI maps registry manifest source paths to your local project structure based on your components.json aliases.
components.jsonFiles are written with standard UTF-8 encoding and immediately formatted according to your project's TypeScript and linting rules.
Package dependencies
Plotcn distinguishes between ordinary npm dependencies (dependencies) and registry source dependencies (registryDependencies).
Modular Engine Dependencies
Strict engine isolation: each chart declares only the minimal npm packages required for its runtime.
Modular D3 packaging
Plotcn never installs the monolithic d3 package. Instead, D3 components declare only the granular micro-modules they actually invoke:
- Scale calculations:
d3-scale - SVG path generation:
d3-shape - Data array transformations:
d3-array - Force simulation algorithms:
d3-force
This ensures your client bundle remains lean and avoids pulling unused layout algorithms or obsolete DOM manipulation code.
Registry dependencies
Registry dependencies enable shared source code reuse without duplicating identical utility files across multiple chart installations.
Shared Primitive Reuse Architecture
How multiple charts share chart-container without duplicated files or deep dependency chains.
Shared primitives in Plotcn
Plotcn maintains a focused set of reusable registry primitives:
chart-container: Provides responsive SVG sizing, CSS variable bridge, and dark/light theme observer.chart-state: Standardized loading skeleton, error boundary, and empty state wrapper.chart-accessibility: Off-screen ARIA tables, summary captions, and keyboard navigation helpers.
Preventing dependency explosions
We adhere to a strict rule: No deep dependency graphs. A chart item may depend on 1 or 2 shared base primitives, but we never create multi-tier cascades (chart → wrapper → sub-wrapper → helper → util) that obscure code ownership.
Engine isolation
One of Plotcn's foundational architectural rules is strict engine isolation.
Strict Engine Boundary Enforcement
Plotcn components never leak dependencies across engines. Each visualization stack remains completely independent.
Shared primitives (container, theme, loading states) are completely agnostic of the underlying visualization engine. They interact solely with standard React DOM elements and CSS variables.
Installation lifecycle
When you run an install command, the shadcn CLI executes a deterministic, multi-phase installation lifecycle:
Deterministic 8-Step CLI Installation Sequence
The deterministic, step-by-step execution path executed by the shadcn CLI when installing a Plotcn chart.
- 01DoneParse Item Address
CLI parses '@plotcn/line-basic' into namespace '@plotcn' and name 'line-basic'.
- 02DoneResolve Registry Endpoint
Matches @plotcn in components.json to generate URL: https://plotcn.vercel.app/r/line-basic.json.
- 03DoneFetch JSON Manifest
Downloads verified component manifest payload over secure HTTPS.
- 04DoneResolve registryDependencies
Recursively downloads shared primitives (e.g. chart-container) to assemble full file list.
- 05ActiveAudit Package Dependencies
Compares manifest 'dependencies' against local package.json to identify missing packages.
- 06ActiveMap Target Paths
Resolves destination directory paths using configured aliases (@/components/charts/...).
- 07ActiveMaterialize Source Files
Writes pure TypeScript files directly to your repo and rewrites import statements.
- 08DoneInstall npm Packages
Executes detected package manager (pnpm, npm, yarn, bun) to install missing engine dependencies.
Step-by-step CLI execution
- Parse Item Address: Evaluates the input string (e.g.
@plotcn/line-basicor direct URL). - Resolve Registry: Looks up
@plotcnincomponents.jsonunderregistriesto determine the manifest URL template. - Fetch Manifest: Performs an HTTP GET request to retrieve
line-basic.json. - Resolve Registry Dependencies: Recursively resolves any referenced registry items (e.g.
chart-container) to assemble the complete list of files. - Resolve Package Dependencies: Reads
dependenciesand compares them against your localpackage.json. - Determine Target Paths: Calculates destination filesystem paths using your configured aliases (
@/components/...). - Write Source Files: Emits clean TypeScript files into your codebase.
- Install Packages: Uses your detected package manager (
pnpm,npm,yarn,bun) to install any missing npm dependencies.
What gets added
Here is a concrete example of the exact modifications made to your project when installing a typical Plotcn visualization (@plotcn/line-basic):
No hidden side-effects
- No background telemetry scripts.
- No global stylesheet modifications (Plotcn uses your existing
--chart-1through--chart-5variables). - No unrequested npm dependencies.
Source ownership
Once a Plotcn component is written into your repository, the source code belongs entirely to you.
The Source Ownership Model
Components move from the remote registry into your Git repository as native source code with 100% developer control.
- Direct Editing: You can change colors, modify TypeScript interfaces, adjust SVG responsive viewBoxes, or add custom annotations directly in the code.
- Zero Lock-In: You never need to wait for an upstream pull request or library release to fix an edge case or adjust chart behavior.
- Git Versioned: Changes to your charts are committed directly to your application's Git repository, giving your team complete review control.
Underlying library ownership
While Plotcn source files belong to your project:
- Recharts and D3 dependencies remain governed by their respective open-source licenses (MIT/BSD).
- Google Charts components execute Google's hosted visualization library subject to Google's terms of service.
Updates and upgrades
Because installed components live as source code in your repository, Plotcn never silently overwrites your local files.
The update philosophy: Intentional adoption
The Update Philosophy: Intentional Adoption
Plotcn never silently overwrites your production code. You intentionally inspect and adopt upstream improvements.
- 01Done01. Install
CLI downloads verified TypeScript source directly into components/charts/.
- 02Done02. Own
Source becomes part of your Git repository. Zero external runtime dependencies or callbacks.
- 03Active03. Modify
Freely change SVG layout, theme tokens, animations, or data interfaces to fit your product.
- 04Done04. Review Upstream
Use shadcn view to compare upstream improvements, diff changes, and cherry-pick enhancements.
When Plotcn publishes updates to a component (such as performance optimizations or new accessibility features), your local implementation is protected:
- Inspect upstream changes: Run
shadcn view @plotcn/<item>to see the current published manifest and code. - Compare with local code: Diff upstream changes against your customized local implementation.
- Cherry-pick improvements: Manually or semi-automatically merge improvements that benefit your project.
- Run typecheck & tests: Validate that your updated chart continues to compile cleanly.
Plotcn does not provide opaque upgrade or migrate CLI scripts that risk breaking customized production code.
Local development
For contributors, teams building custom internal registries, or developers testing in offline environments, the shadcn CLI supports testing against local HTTP endpoints.
Local Contributor & Registry Testing Pipeline
How contributors and teams author, build, serve, and test Plotcn registry items locally before release.
- 01DoneAuthor Source Component
Develop chart inside registry/recharts/ or registry/d3/ with strict TypeScript and accessibility attributes.
- 02DoneCompile Static Manifests
Execute pnpm build:registry to extract metadata, audit dependencies, and output public/r/*.json.
- 03ActiveServe Locally
Run pnpm dev to expose local registry endpoint at http://localhost:3000/r for testing.
- 04DoneFresh App Verification
Run shadcn add http://localhost:3000/r/line-basic.json in clean consumer project to verify install & compilation.
Serving registry items locally
- Run the local Plotcn development server:
pnpm dev- In a separate test application, add the component using the local endpoint URL:
pnpm dlx shadcn@latest add http://localhost:3000/r/line-basic.jsonLocal namespace testing
You can also temporarily map the @plotcn namespace to your local server in your test application's components.json:
{ "registries": { "@plotcn": "http://localhost:3000/r/{name}.json" }}This lets you test the exact production command shadcn add @plotcn/line-basic against your locally running dev server.
Publishing
Plotcn's registry is compiled from modular source files into static JSON artifacts during the build process:
Registry Build & Publishing Architecture
How raw chart source code in the monorepo compiles into static JSON artifacts deployed to the global CDN.
Build validation pipeline
Before any registry manifest is published, our automated CI pipeline enforces strict quality checks:
- Schema Validation: Ensures all JSON files conform to the official shadcn Registry specification.
- Dependency Audit: Verifies that every imported package is declared in
dependenciesand that no circularregistryDependenciesexist. - Type Checking: Compiles all component source with TypeScript in strict mode.
- Target Integrity: Verifies that file target paths map to valid directory structures without colliding with user code.
GitHub installation
In addition to HTTP registry endpoints, the shadcn CLI supports installing components directly from public GitHub repositories without requiring namespace configuration in components.json.
Comparison: Namespaced Registry vs. GitHub Direct
| Feature | Configured Namespace (@plotcn/...) | GitHub Direct Address |
|---|---|---|
| Command Syntax | shadcn add @plotcn/line-basic | shadcn add https://github.com/.../line-basic.json |
| Branding | Clean, branded developer experience | Repository URL path |
| Configuration | Handled automatically by shadcn CLI (or in components.json) | Zero configuration required |
| Best Used For | Production apps, teams, standard DX | Fast prototyping, branch previews, testing PRs |
Plotcn recommendation
For standard projects, use shadcn add @plotcn/<chart> for concise, native installations. Use direct GitHub or local URLs when testing unpublished branches or preview builds.
Security
Installing source code from external registries requires the same diligence as adding any third-party dependency to your project.
Core security principles
- Audit Before Installing: Always run
shadcn view @plotcn/<item>before runningaddon unfamiliar registry items. - Enforce HTTPS: Production registry endpoints must always use encrypted HTTPS to prevent man-in-the-middle tampering.
- Zero Secrets Rule: Plotcn registry manifests never include API keys, access tokens, or private credentials.
- Engine Verification: Inspect package dependencies to ensure no extraneous or suspicious packages are being installed.
Troubleshooting
Common registry resolution issues and their immediate solutions:
Unknown Registry Namespace
CAUSE:components.json does not register the @plotcn namespace.
Item Not Found (404)
CAUSE:The component name is misspelled or not yet published to the registry catalog.
Missing Package Dependency
CAUSE:The component imports an npm package (e.g. recharts) not declared in item dependencies.
Broken Registry Dependency
CAUSE:A shared primitive (e.g. chart-container) failed to resolve or download.
TypeScript Alias Resolution Error
CAUSE:Target component was copied into components/charts/ but tsconfig.json lacks @/* mapping.
Cross-Engine Package Leakage
CAUSE:Installing a Recharts component unexpectedly pulls D3 packages.
Verify the registry
Plotcn enforces a comprehensive quality matrix across all visualization engines before items are eligible for public release:
Plotcn Registry Quality & Validation Standards
Quality InvariantsJSON adheres to official shadcn schema with valid types and URLs.
Installs in a brand new project without manual file movement.
TypeScript compiles with zero errors on strict mode.
Does not install or import unrelated visualization engines.
Reads --chart-1 through --chart-5 CSS variables correctly in dark/light mode.
Includes ARIA roles, descriptive summaries, and keyboard focus states.
Next steps
Now that you understand the registry architecture and distribution pipeline, explore how to use and customize your installed components: