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

@rangka/core

v0.1.3

Published

Server-side runtime engine for the Rangka framework.

Readme

@rangka/core

Server-side runtime engine for the Rangka framework.

How it works

This package boots a complete Fastify server from declarative model/page definitions. It handles module discovery, schema resolution, database sync, REST API generation, authentication, lifecycle hooks, background jobs, and events. All server-side behavior lives here.

Architecture

src/
├── api/            — Fastify server, route generation, handlers, OpenAPI schema
├── audit/          — Audit trail recording
├── auth/           — JWT sessions, permissions, scopes, field-level access
├── boot/           — Boot sequence: discovery, schema loading, merging, registry init
├── db/             — DatabaseClient, auto-sync (DiffEngine), model-ops (Kysely CRUD)
├── events/         — EventBus (transaction-scoped pub/sub)
├── external-model/ — Adapter-based external data sources
├── fixtures/       — Seed data loading
├── helpers/        — Stamping, ownership checks, validation utilities
├── hooks/          — Hook registry, executor, middleware, context builder
├── jobs/           — Job registry, worker, scheduler, enqueue
├── model-api/      — Query builder, filter translation, scope enforcement, includes
├── plugins/        — Plugin lifecycle, adapter registry, loader
├── schema/         — SchemaRegistry, relationship resolution
├── services/       — ServiceRegistry, service factory
├── validation/     — Field-level validation engine
├── widgets/        — Server-side widget registry (for studio)
├── context.ts      — FrameworkContext builder
├── errors.ts       — AppError, BadRequestError, NotFoundError
└── index.ts        — Public exports

Key internal systems

| System | Entry point | Purpose | | ----------- | ----------------------------- | ---------------------------------------------- | | Boot | boot/index.ts | Orchestrates full server startup | | Schema | schema/registry.ts | Holds resolved models and relationships | | Model API | model-api/index.ts | CRUD with scopes, permissions, filters | | Hooks | hooks/executor.ts | Lifecycle pipeline (validate → before → after) | | Middleware | hooks/middleware.ts | Wraps hooks into Fastify request handlers | | Routes | api/route-generator.ts | Auto-generates REST endpoints per model | | Auth | auth/session.ts | JWT session management | | Permissions | auth/permission-registry.ts | Role-based model/field access | | Scopes | auth/scope-registry.ts | Row-level tenant isolation | | Services | services/registry.ts | Named business logic with DI | | Jobs | jobs/registry.ts | Background job processing | | Events | events/bus.ts | Transaction-scoped pub/sub |

Commands

pnpm --filter @rangka/core build   # Compile TypeScript
pnpm --filter @rangka/core test    # Unit tests
pnpm test:integration              # Integration tests (from repo root)

Contributing

  • All data access in hooks/services goes through ctx.models (the ModelAccess interface). Never write raw Kysely for basic CRUD.
  • All hooks/services/jobs receive FrameworkContext. Use it. Don't build parallel context objects.
  • The hook pipeline is fixed: validate → beforeSave → (write) → afterSave. Don't add new phases.
  • Route handlers are auto-generated by route-generator.ts. Don't duplicate CRUD routes manually.
  • Registries are singletons created at boot. Extend existing ones, don't create new ones for the same purpose.
  • Helper utilities (helpers/stamping.ts, helpers/validation.ts, helpers/assert-ownership.ts) must be reused. Don't recreate stamping or ownership logic.
  • This package imports from @rangka/shared only. Never import from @rangka/client.