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

@shamar/core

v0.1.4

Published

Filament-inspired resource DSL for Shamar admin (ORM-agnostic core).

Readme

@shamar/core

Filament-inspired Resource DSL for Shamar — forms, tables, infolists, actions, navigation, and auth contracts. ORM-agnostic: persistence lives in adapters (@shamar/lucid, @shamar/mongoose) or your own DataAdapter.

Most apps consume this transitively via @shamar/adonis. Use @shamar/core directly when building a custom host or adapter.

Install

pnpm add @shamar/core

No peer dependencies.

Resource skeleton

import {
  Resource,
  form,
  table,
  infolist,
  actions,
  Section,
  TextInput,
  Toggle,
  TextColumn,
  TextEntry,
} from '@shamar/core'
import User from '#models/user'

export default class UserResource extends Resource {
  static model = User
  static slug = 'users'
  static label = 'Users'
  static singularLabel = 'User'
  static recordTitleField = 'email'
  static navigationGroup = 'System'
  static navigationSort = 5

  static form() {
    return form((f) => {
      f.schema([
        Section.make('Identity')
          .columns(2)
          .schema([
            TextInput.make('fullName').required(),
            TextInput.make('email').email().required().unique(),
            TextInput.make('password').password().createOnly().required(),
            Toggle.make('active'),
          ]),
      ])
    })
  }

  static table() {
    return table((t) => {
      t.schema([
        TextColumn.make('fullName').sortable().searchable(),
        TextColumn.make('email').sortable().searchable().filterable(),
        TextColumn.make('active').boolean().filterable(),
      ])
    })
  }

  static infolist() {
    return infolist((i) => {
      i.schema([
        Section.make('User').schema([
          TextEntry.make('fullName'),
          TextEntry.make('email'),
          TextEntry.make('active').boolean(),
        ]),
      ])
    })
  }

  static resourceActions() {
    return actions((a) => {
      a.create()
      a.view()
      a.edit()
      a.delete()
      a.bulkDelete()
      a.header('export', 'Export').ability('viewAny')
      a.row('archive', 'Archive').confirm('Archive this user?')
    })
  }
}

Builders

| Builder | Purpose | |---------|---------| | form((f) => …) | Create / edit schemas | | table((t) => …) | List columns, filters, group-by defaults | | infolist((i) => …) | Show / view schemas | | actions((a) => …) | Create, view, edit, delete, bulk, header, and row actions | | panel(id) | Multi-panel registration (also re-exported from @shamar/adonis) |

Containers use .schema([...]) for children. Layout width uses .columns(n) on sections and fieldsets.

Layout

Section, Fieldset, Grid, Group, Flex, Tabs / Tab, Wizard / Step, Callout, EmptyState, Placeholder

Form fields

TextInput, Textarea, Select, Toggle, Checkbox, Radio, CheckboxList, Hidden, ColorPicker, TagsInput, DatePicker, DateTimePicker, FileUpload, RelationTable, PermissionsAssignment, AbilitiesAssignment

Table / infolist

TextColumn · TextEntry, IconEntry, ColorEntry, ImageEntry

  • TextEntry.make('payload').textarea() — scrollable, break-all block for long unbroken strings
  • Derived show schemas (no infolist()) wrap fields in a card Section by default

Layout width

  • Panel: panel('admin').contentMaxWidth('7xl') (or '80rem', 'full', …)
  • Resource: static contentMaxWidth = '3xl' (overrides the panel)

Common modifiers

| Modifier | Applies to | Notes | |----------|------------|--------| | .required() | fields | Validation | | .live() / .afterStateUpdated() | fields | Reactive form-state POST | | .searchable() | fields / columns | Global list search | | .sortable() | columns | Order by | | .filterable() / .groupable() | columns | List Filters / Group menus | | .relationship(slug, titleAttr) | relation fields | BelongsTo / M2M pickers | | .unique() | fields | Uses adapter exists() | | .createOnly() / .editOnly() | fields | Visibility by page | | .columnSpan(n) / .columnSpanFull() | fields / entries | Grid span |

List defaults:

table((t) => {
  t.defaultFilters([{ field: 'active', value: true, label: 'Active' }])
  t.defaultGroupBy('status')
  t.schema([/* columns */])
})

Soft delete & tenancy hooks

export default class OrderResource extends Resource {
  static softDelete = true // or { field: 'deleted_at' }
  // static companyScoped = true  // when tenancy is enabled in the host
}

Adapters exclude soft-deleted rows from list/find and stamp the field on delete when enabled.

Auth contracts

Resource exposes canAccess / canViewAny / canView / canCreate / canEdit / canDelete. Set static policy to a Cherubim Policy (or register via Adonis auth.policies) for record rules and scopeList.

See @shamar/cherubim for RBAC, policies, and API keys.

Custom ORM (DataAdapter)

import type { DataAdapter } from '@shamar/core'

const adapter: DataAdapter = {
  list(meta, query) { /* … */ },
  findOne(meta, id) { /* … */ },
  create(meta, data) { /* … */ },
  update(meta, id, data) { /* … */ },
  delete(meta, id) { /* … */ },
  exists(meta, column, value, options) { /* … */ },
  search(meta, query) { /* … */ },
}

Pass it as adapter in @shamar/adonis defineConfig, or wire it in a custom host.

Related