
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
@rubriclab/state
Advanced tools
A lightweight, real-time state management library for Next.js applications with WebSocket support.
bun add @rubriclab/state
@rubriclab scope packages are not built, they are all raw TypeScript. If using in a Next.js app, make sure to transpile.
import type { NextConfig } from 'next'
export default {
transpilePackages: ['@rubriclab/state']
} satisfies NextConfig
If using inside the monorepo (@rubric), simply add
{"@rubriclab/state": "*"}to dependencies and then runbun i
To get started, define a few objects.
import { z } from 'zod/v4'
export const schema = z.object({
todos: z.record(z.string(), z.object({
title: z.string(),
completed: z.boolean()
})).default({})
})
The provider handles fetching initial data for first-paint (SSR)
import { RealtimeProvider } from '@rubriclab/state'
export default function Layout({ children }) {
return (
<RealtimeProvider websocketUrl="ws://localhost:3001">
{children}
</RealtimeProvider>
)
}
Pass your schema into the hook creator to get typesafe states.
import { createLiveState } from '@rubriclab/state/client'
const { useLiveState } = createLiveState(schema)
export function MyComponent() {
const [todos, setTodos] = useLiveState('todos')
const addTodo = () => {
setTodos(prev => ({
...prev,
[crypto.randomUUID()]: { title: 'New todo', completed: false }
}))
}
return (
<div>
<button onClick={addTodo} type="button">
Add Todo
</button>
<ul>
{Object.entries(todos).map(([id, todo]) => (
<li key={id}>
<input
type="checkbox"
checked={todo.completed}
onChange={() =>
setTodos(prev => ({
...prev,
[id]: { ...todo, completed: !todo.completed }
}))
}
/>
{todo.title}
</li>
))}
</ul>
</div>
)
}
Use it as you would useState.
Run bun run rubriclab-state-start to start the server.
The server can be deployed eg. on Railway by setting this as the custom start command.
To enable state persistence across server restarts, set the REDIS_URL environment variable:
REDIS_URL=redis://localhost:6379 bun run rubriclab-state-start
When Redis is configured:
state:{channelId}This is particularly useful for production deployments where you want state to survive server restarts.
Open your Next.js app in two browser windows. Values should be synced between the two.
Try disabling JS in one browser:
⌘+⇧+i > ⌘+⇧+p > disable j... > ⏎
then refreshing - the page should still reflect fresh data.
Start the WebSocket server:
bun dev
FAQs
Unknown package
The npm package @rubriclab/state receives a total of 6 weekly downloads. As such, @rubriclab/state popularity was classified as not popular.
We found that @rubriclab/state demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.