@lawhive / framework
The Framework
Shared TypeScript packages that define standard patterns, libraries, and APIs for how we build services at Lawhive.
// Define type-safe events with effects
const { event, router } = ev()
const taskEvents = router({
created: event({
schema: z.object({ name: z.string() }),
effect: async (input) =>
prisma.task.create({ data: input }),
selectId: ({ output }) => output.id,
}),
})
// Publish with composable adapters
const client = createEventClient(events, {
adapters: [createEventStoreAdapter({ storage })],
createContext: (fn) => prisma.$transaction((tx) => fn({ tx })),
})Standard Patterns & APIs
Everything you need to build reliable, event-driven services with consistent patterns across the organisation.
Event System
Type-safe event definitions with effects, transforms, and a full history API. Build event-driven services with compile-time guarantees.
- Aggregate & ephemeral events
- Composable adapters
- Typed history queries
- Transactional outbox
Prisma Extensions
Soft delete and audit trail as composable Prisma client extensions. Drop-in, transaction-aware, zero configuration.
- Automatic soft delete
- Mutation audit trails
- Before / after diffs
- Composable extensions
Testing Utilities
A composable test harness with progressive type accumulation. Fixtures for PostgreSQL containers and Prisma bootstrapping.
- Composable harness builder
- PostgreSQL containers
- Prisma bootstrap fixtures
- Test lifecycle management
Packages
Install what you need. Each package is independently versioned and published.
@lawhive/framework
Core primitives for building event-driven applications with Prisma. Events, adapters, extensions, and structured logging.
@lawhive/framework-server
Hono service bootstrap with health checks, request IDs, and structured logging out of the box.
@lawhive/framework-testing
Test harness and fixtures for integration testing. Composable, type-safe, container-ready.
Run the Example
The monorepo ships with a full reference app — a task manager with event sourcing, audit trails, and a Next.js frontend. Get it running in under a minute.
Start the database
Spins up a PostgreSQL container via Docker Compose.
Push the schema
Creates the event store, outbox, audit, and task tables.
Run the example
Starts the Hono server on :9001 and the Next.js app on :9000.
Requires Docker and Bun. See examples/server and examples/web for the full source.
Documentation
Jump straight to the section you need.