Skip to content

pdyck/plopslop

Repository files navigation

plopslop

CI License: MIT TypeScript

Type-safe pub/sub library for Node.js with Zod schema validation.

What is plopslop?

Plopslop provides ephemeral pub/sub messaging with:

  • Type-safe message handling using Zod schemas
  • Pluggable drivers (Redis, PostgreSQL, in-memory)
  • Plugin system for middleware-style processing
  • Async iterator and callback-based APIs

Designed for distributing real-time messages to WebSockets, SSE, and server instances.

Quick Start

pnpm add @plopslop/core @plopslop/redis ioredis zod
import { createPubSub } from '@plopslop/core';
import { redis } from '@plopslop/redis';
import { z } from 'zod';

const pubsub = createPubSub({
  driver: redis(),
  topics: {
    userCreated: {
      name: 'user.created',
      schema: z.object({ name: z.string() }),
    },
  },
});

// Subscribe
for await (const { payload } of pubsub.userCreated.stream()) {
  console.log(`User ${payload.name} created`);
}

// Publish
await pubsub.userCreated.publish({ name: 'Alice' });

See @plopslop/core for full API documentation.

Packages

Examples

When to use plopslop

Use plopslop when you need:

  • Real-time message distribution across server instances
  • Type-safe pub/sub with schema validation
  • Low-latency ephemeral messaging
  • Integration with WebSockets or Server-Sent Events

Don't use plopslop when you need:

  • Guaranteed message delivery
  • Message persistence and replay
  • Complex routing or message queuing
  • Dead letter queues or retries

Plopslop vs. Message Queues vs. Streaming

Plopslop is designed for ephemeral pub/sub, not message queuing or event streaming. Messages are delivered to active subscribers and then discarded. Unlike RabbitMQ or BullMQ, there is no message persistence or acknowledgment. Unlike Kafka or Pulsar, there is no message replay, consumer groups, or offset management.

Use plopslop for broadcasting real-time events. Use message queues (BullMQ, RabbitMQ) for reliable work distribution. Use event streaming platforms (Kafka, Pulsar) for event sourcing and analytics.

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT - see LICENSE

About

Type-safe real-time pub/sub for Node.js

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published