npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vyuh/react-core

v0.6.3

Published

The core package for the Vyuh Platform.

Readme

@vyuh/react-core

npm version

Overview

@vyuh/react-core is the foundation of the Vyuh platform for CMS-driven React applications. It provides a robust architecture for building modular, feature-rich applications with a focus on:

  • Feature-based architecture: Organize your application into self-contained features
  • Plugin system: Extend functionality through a flexible plugin system
  • Content management: Seamlessly integrate with headless CMS platforms
  • Type safety: Built with TypeScript for enhanced developer experience

Installation

# Using npm
npm install @vyuh/react-core

# Using yarn
yarn add @vyuh/react-core

# Using pnpm
pnpm add @vyuh/react-core

Core Concepts

Features

Features are the building blocks of your application. Each feature is a self-contained module that can:

  • Define its own UI components
  • Register content types
  • Provide extensions for other features
  • Handle its own initialization and cleanup

Plugins

Plugins extend the core functionality of the platform:

  • Content Plugin: Connects to your CMS and renders content
  • Navigation Plugin: Handles routing and navigation
  • Telemetry Plugin: Collects analytics and logs
  • Event Plugin: Manages application-wide events

Content System

The content system provides a structured way to:

  • Define content types with schemas
  • Render content from various sources
  • Configure layouts and styling
  • Handle content-driven navigation

Allied Packages

The Vyuh ecosystem includes several packages that work together:

| Package | Description | | -------------------------------------------- | ------------------------------------ | | @vyuh/react-core | Core platform and architecture | | @vyuh/react-extension-content | Content management system | | @vyuh/react-feature-system | System-level features and components | | @vyuh/react-plugin-content-provider-sanity | Sanity.io content provider |

Getting Started

Basic Setup

import { VyuhProvider, PluginDescriptor } from '@vyuh/react-core';
import { DefaultContentPlugin } from '@vyuh/react-extension-content';
import { SanityContentProvider } from '@vyuh/react-plugin-content-provider-sanity';
import { feature as systemFeature } from '@vyuh/react-feature-system';

// Configure your content provider
const contentProvider = new SanityContentProvider({
  projectId: 'your-project-id',
  dataset: 'production',
  perspective: 'published',
  useCdn: true,
});

// Configure plugins
const plugins = new PluginDescriptor({
  content: new DefaultContentPlugin(contentProvider),
});

// Define your features
const getFeatures = () => [
  systemFeature,
  // Your custom features
];

// Set up your application
function App() {
  return (
    <VyuhProvider features={getFeatures} plugins={plugins}>
      <YourApp />
    </VyuhProvider>
  );
}

Router Integration

Vyuh works with your preferred routing solution. Here's an example with Next.js:

import { RouterProvider } from './components/router-provider';
import { VyuhProvider } from '@vyuh/react-core';
import { NextNavigationPlugin } from './plugins/next-navigation-plugin';

// Configure plugins with navigation
const plugins = new PluginDescriptor({
  content: new DefaultContentPlugin(contentProvider),
  navigation: new NextNavigationPlugin(),
});

function App({ children }) {
  return (
    <VyuhProvider features={getFeatures} plugins={plugins}>
      <RouterProvider>{children}</RouterProvider>
    </VyuhProvider>
  );
}

And the router provider component:

import { NextNavigationPlugin } from './plugins/next-navigation-plugin';
import { useVyuh } from '@vyuh/react-core';
import { useRouter } from 'next/navigation';
import { useEffect, useRef } from 'react';

export function RouterProvider({ children }) {
  const router = useRouter();
  const { plugins } = useVyuh();
  const routerInitialized = useRef(false);

  useEffect(() => {
    if (
      plugins.navigation instanceof NextNavigationPlugin &&
      !routerInitialized.current
    ) {
      (plugins.navigation as NextNavigationPlugin).setRouter(router);
      routerInitialized.current = true;
    }
  }, [router, plugins.navigation]);

  return <>{children}</>;
}

Creating a Feature

Features are the building blocks of your application:

import { FeatureDescriptor } from '@vyuh/react-core';
import {
  ContentExtensionBuilder,
  ContentExtensionDescriptor,
} from '@vyuh/react-extension-content';
import { Command } from 'lucide-react';
import React from 'react';

// Import your content descriptors and builders
import { MyCardDescriptor } from './content/card/card-descriptor';
import { MyCardContentBuilder } from './content/card/card-builder';

export const myFeature = new FeatureDescriptor({
  name: 'my-feature',
  title: 'My Feature',
  description: 'A custom feature for my application',
  icon: <Command />, // Using Lucide icon

  // Extensions provided by this feature
  extensions: [
    new ContentExtensionDescriptor({
      contents: [
        new MyCardDescriptor(),
        // Other content descriptors
      ],
      contentBuilders: [
        new MyCardContentBuilder(),
        // Other content builders
      ],
      // Optional: register actions and conditions
      actions: [
        // Action type descriptors
      ],
      conditions: [
        // Condition type descriptors
      ],
    }),
    // Other extension descriptors
  ],

  // Initialization logic
  init: async () => {
    console.log('My feature initialized');
  },
});

Using the Vyuh Hook

Access platform features and plugins from anywhere in your application:

import { useVyuh } from '@vyuh/react-core';

function MyComponent() {
  const { features, plugins } = useVyuh();

  // Access content plugin
  const contentPlugin = plugins.content;

  // Render content
  return (
    <div>
      {contentPlugin.render({
        _type: 'myContentType',
        title: 'Hello World',
        // ...other content properties
      })}
    </div>
  );
}

Contributing

We welcome contributions to the Vyuh platform! Please see our contributing guidelines for more information.

License

MIT © Vyuh Technologies