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

@sincpro/web-framework

v5.0.1

Published

The web client of sincpro_framework: entities, lists and records bound to the metadata the server publishes, drawn with @sincpro/web-ui and arranged with @sincpro/web-composer.

Readme

@sincpro/web-framework

The web side of how Sincpro builds business software. It takes what sincpro_framework already resolves on the server — entities, criteria, commands, drafts, events — and puts it on screen with @sincpro/web-ui, opened where @sincpro/web-composer says. What every client shares — the transport, the entities, the generated client, the application's use cases traced and reported — is @sincpro/client-framework's; this package is the screens. An application declares its entities and names its fields; the rest follows. Every Sincpro framework speaks one ubiquitous language: a bounded context, a Feature, the process, the context mean the same here, on the phone and on the server.

yarn add @sincpro/web-framework @sincpro/client-framework @sincpro/web-ui @sincpro/web-composer \
  @sincpro/criteria @sincpro/criteria-react react react-dom

Requires React 19 or newer.

What we believe

The founding statement is MANIFESTO.md: what this repository is, what it is not, how it is composed and where it is going. What follows is how those beliefs show in the pieces that exist today.

An ERP is modular, so its framework must be open. Somebody will always have the case nobody foresaw — a reconciliation screen, a strange relation, a wizard over three entities. They must be able to build it here, without asking us and without fighting us. So:

  1. Defaults, never cages. Every piece comes in three levels, and any of them can be skipped:

    | Level | What you write | Example | | ------------ | ---------------------------------------- | ------------------------------------------------------------------ | | Declarative | names of fields and entities | <EntityList listing={l} columns={["number", "state"]} /> | | Parts | one region of the screen is yours | <EntityList listing={l}><EntityList.Bar /><MyMap /></EntityList> | | Hooks | your own screen over our state | useListing + web-ui's List | | Loose pieces | straight to criteria, the client, web-ui | readPage(operations, invoices, criteria) |

    Adding a piece obliges nothing else; removing it breaks nothing else.

  2. We ship good practice, not business rules. A rule lives in the backend. Here the framework reads what the backend publishes — the model definition, the form hints, the preview, the refusal — and never re-implements it. If a rule matters, the server keeps it.

  3. Integration should be solved once, here. Every Sincpro application used to write its own client, its own date formatting, its own error box, its own "load more". That is the same code everywhere, and it belongs in one place, written well.

  4. The server describes, the screen decides. The backend says what a field is — its word, its type, what it accepts, what it points at. Where it goes, how prominent it is and what colour a state is stay in the screen's code. That keeps us out of server-side view XML, which is where frameworks like Odoo stop being extensible.

  5. Many entities, one screen. Business work happens between records: a list with its detail beside it, an invoice with its lines, a statement reconciled against invoices. The framework is built for that, not for one form at a time.

  6. Use the whole Sincpro stack, not a copy of it. Composer already knows where things open, what is selected and which keys do what; web-ui already knows how a record looks. This package uses them — it does not wrap them in a second, weaker version.

The stack

| Project | Brings | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | sincpro_framework | Entities, criteria, reads (Get, LiteralSearch, Search, Preview), commands and dry runs, drafts, events, permissions, protocols (REST, JSON-RPC, gRPC, MCP) | | @sincpro/criteria | The contract with the server: Criteria, Meta, Page, Problem | | @sincpro/client-framework | What every client shares — web, mobile, a server-side render, a script: the transport, entity(), the generated client, Feature and ApplicationService traced and reported by default | | @sincpro/web-ui | What a screen looks like: List, Record, SearchBar, Picker, Activity | | @sincpro/web-composer | Where it opens and the context: page, peek, window, panels, shared selection, ⌘K, shortcuts | | this package | The screens: state, lists, records, pickers and commands drawn with web-ui, opened with composer; optional browser telemetry and error reporting | | Your application | What an invoice is |

How it fits together

Four packages, one direction. client-framework talks to the server and runs the application's logic — the same on every platform. web-ui draws and tells («they pressed this name, and asked for a modal»); it never imports composer and never knows where anything opens. Composer decides where — page, modal, preview, side panel, window, the breadcrumb, the phone — and never draws a record. This package connects them on the web, from what the server publishes about each model.

flowchart LR
  subgraph server["sincpro_framework · the backend"]
    api["entities · criteria · commands · drafts<br/>events · client contract · its traces"]
  end
  criteria["@sincpro/criteria<br/>Criteria · Meta · Page · Problem"]
  subgraph cf["@sincpro/client-framework · every platform"]
    direction TB
    wire["Transport · restTransport · entity()<br/>client contract · model definitions"]
    services["BoundedContext · Feature · ApplicationService · EventHandler<br/>configureProcess · processContext · ContextStore<br/>a span, a report, a context per run"]
    generator["sincpro-client generate<br/>domain · client · entities"]
  end
  subgraph fw["@sincpro/web-framework · the web"]
    direction TB
    core["core/<br/>textOf · summaryOf · forms · lines · explain"]
    react["react/<br/>useListing · useRecord · useCommand<br/>useLookup · useServiceQuery · useServiceCommand · useContextValues"]
    web["web/<br/>EntityList · EntityRecord · RecordField<br/>EntityPicker · entityView · SincproApp"]
    optional["./telemetry · ./errors<br/>optional: OpenTelemetry · GlitchTip"]
    core --> react --> web
  end
  ui["@sincpro/web-ui · draws and tells<br/>List · Record · Picker · SearchBar"]
  composer["@sincpro/web-composer · decides where<br/>page · modal · preview · side · window"]
  app["your application<br/>entrypoints · bounded contexts<br/>(generated · services · components)"]

  api <-->|"criteria and traceparent<br/>over the wire"| wire
  criteria --> cf
  cf --> fw
  web -->|"props read from the model"| ui
  ui -->|"gestures"| web
  web -->|"api.open · api.pick"| composer
  composer -->|"mounts the view"| web
  generator -.->|"writes"| app
  app -->|"its services and entities"| cf
  app -->|"its screens"| fw

What happens when a screen runs one of the application's use cases — one trace from the click to the database:

sequenceDiagram
  actor person as Person
  participant screen as Screen<br/>(useServiceCommand)
  participant service as CloseAndNotify<br/>(ApplicationService)
  participant feature as Issues<br/>(Feature)
  participant client as Generated client<br/>(bound transport)
  participant server as sincpro_framework

  person->>screen: presses «Close»
  screen->>service: run(input) — busy
  service->>service: interceptor opens project/CloseAndNotify
  service->>feature: this.feature.Issues.close(…)
  feature->>feature: child span project/Issues.close
  feature->>client: this.client.closeIssue(…)
  client->>server: POST … traceparent, sincpro-context
  server-->>client: answer (the server's span is a child of the client's)
  client-->>screen: answer — or a failure: refused (shown) / unexpected (reported once)

What happens when a person presses the customer of an invoice:

sequenceDiagram
  actor person as Person
  participant value as RelationValue<br/>(web-ui)
  participant related as RelatedRecord / openIn<br/>(this package)
  participant composer as Composer
  participant view as Customer view<br/>(entityView)
  participant server as Server

  person->>value: presses «Globex Bolivia»
  value->>related: onOpenIn("modal") — the first of openTargets
  related->>related: targetsFor(api): inside a modal? then beside, never a modal
  related->>composer: api.open(ventas:cliente/C-004, { to: "modal", size: 760×560 })
  composer->>view: mounts the registered view over the invoice
  view->>server: useRecord → the record (and its model, once)
  server-->>view: record + meta
  view->>composer: api.setTitle("Globex Bolivia") — the modal and the crumb say its name

Everything a screen shows about a value or a record is read from the model the same way, so a cell, a fact, a card and a link cannot disagree:

flowchart LR
  meta["Meta<br/>(server, defineMeta or OpenAPI)"] --> text["textOf<br/>«Pagada» · 12 mar 2026 · 1 150,50"]
  meta --> summary["summaryOf<br/>name · description · state · type<br/>image · created · updated"]
  record["a record"] --> text
  record --> summary
  declared["entity(…, { summary })"] -.->|"its own field names"| summary
  text --> cells["columns · facts · chips"]
  summary --> card["cardOf → RecordCard"]
  summary --> relation["relationOf → RelationValue"]

Integrating it in an application

1. Styles. web-ui's tokens, and Tailwind told to look inside the packages (Tailwind v4 skips node_modules, so their classes would never be generated). Composer brings its own sheet.

@import "@sincpro/web-ui/tokens.css";
@source "../node_modules/@sincpro/web-ui/dist";
@source "../node_modules/@sincpro/web-framework/dist";
@source "./";

2. The operations — the one door to the backend, from @sincpro/client-framework: the contract's operations over a wire. The session is the application's: it puts its headers on the transport under them. The screens never name a route; REST is only its adapter's.

import { restOperations, restTransport } from "@sincpro/client-framework";

export const transport = restTransport({
  base: "/v1",
  headers: () => ({ Authorization: `Bearer ${session.token}` }),
});
export const operations = restOperations(transport); // JSON-RPC: jsonRpcOperations(…)

The definition of every model — its fields, operators, hints, widgets, formulas — is the contract's, and each generated entity carries its own (meta): a face that imports an entity has its model, with nothing to declare and no contract to download. An answer says only its model_version, and nothing reads a model at runtime. metas (on SincproApp, FrameworkProvider or ModelDefinitions) only replaces one. A form computes a published formula itself and asks the server for a preview only when a change reaches something it cannot answer.

3. The entities — written by sincpro-client generate from the contract («From the contract», below): each an index over the client's operations — which one is its search, its get, its edit, its history, its export, its Commands —, and its key in the workspace (domain:kind). Nobody writes a route; the application only adds what the contract cannot say: summary when its fields are not the conventional ones, and how a record looks (presented).

summary is how an application says which of its fields plays each part of a record — its state, its type, its description, its picture, who made it. The convention only knows English names (state/status, type/kind/category, description/summary, image…): a model whose state is estado names it, or its header shows no state and its rows no tag. Guessing is not safe — an entity may hold two choices — so a field not named this way plays no part.

// quipu's payment: Spanish field names, said once.
export const payments = {
  ...generated.pagos,
  summary: { state: "estado", description: "descripcion" },
};
// sales/adapters/generated/entities.ts — generated, never edited:
export const invoices = entity("sales:invoice", {
  model: "Invoice",
  search: operations.listInvoices,
  get: operations.getInvoice,
  edit: operations.editInvoice,
  events: operations.invoiceEvents, // its DomainEvents: a record's facts
  commands: { post: operations.postInvoice, create: operations.createInvoice },
});

An entity without an edit — a payment, an order that only its Commands move — has its records drawn read only, whole: nothing on screen invites typing what nobody can store.

How a record looks is the client's, declared once with the entity (presented): its row, card and option, the columns of a table of it, the colour of each value of a choice and of each kind of fact in its history. Cells, rows, cards, the record's tag and its activity use them:

export const payments = presented(generated.payments, {
  tones: { estado: { EN_REVISION: "warn", VALIDADO: "good", RECHAZADO: "bad" } },
  facts: { pago_aprobado: "good", pago_rechazado: "bad" }, // by a fact's `name`, or its last part
  columns: ["periodo", "monto", "estado"],
});

4. The views — each entity becomes a composer view: its list without an id, its record with one, its search in ⌘K. Declared and nothing more, it already has both screens, drawn from its model: EntityList (literal search on Enter, pages, «New») and EntityRecord (its name, type and state on top; its fields in the model's order, a many2one as a picker of its entity; each one2many in a tab; «save / discard», the conflict, the restored draft, who made it, its history; «3 / 64» and the arrows to its neighbours when it was opened from a list).

const views = [
  entityView(invoices, { operations, name: "Invoices" }), // both screens, from the model
];

They are defaults, not cages: give your own screens, or keep EntityRecord and choose what it shows. A screen of your own is written with the framework's parts — what is not written is not there, a part written empty is the framework's, and a block of yours reads the record with useScreenRecord (the list: EntityList.* and useScreenListing; see docs/PATTERNS.md):

function InvoiceView(props: ViewProps) {
  return (
    <RecordScreen entity={invoices} {...props}>
      <RecordScreen.Rail />
      <RecordScreen.Paper>
        <RecordScreen.Notices />
        <InvoiceTotals /> {/* useScreenRecord(invoices) */}
        <RecordScreen.Fields names={["customer_id", "due_date"]} />
        <RecordScreen.Audit />
      </RecordScreen.Paper>
    </RecordScreen>
  );
}
const views = [
  entityView(invoices, {
    operations,
    name: "Invoices",
    list: InvoiceList,
    record: InvoiceView,
  }),
  entityView(customers, {
    operations,
    name: "Customers",
    list: CustomerList,
    record: CustomerView,
  }),
];

5. The application — operations, models, language (web-ui's, composer's and the framework's words), cache, toasts and the workspace, in one place. transport is only where a file goes (uploadTo), when the app takes files:

<SincproApp
  operations={operations}
  transport={transport}
  views={views}
  entities={[invoices, customers]} // a relation of a model resolves to one of these, alone
  start={invoices.ref()}
  language="es"
/>

An application with its own shell mounts the same pieces itself: FrameworkProvider, composer's Composer with webUiSkin, and the three copy tables.

6. The screens. A list is the entity and the names of its fields — the server searches, filters, orders, groups and pages; a row opens the record's page:

function InvoiceList({ api }: ViewProps) {
  const listing = useListing(invoices);
  return (
    <EntityList
      listing={listing}
      api={api}
      columns={["number", "customer", "state", "amount_total"]}
    />
  );
}

A record keeps writing web-ui's Record tree. Its fields come from the model; a related record is read with its summary and opened where it belongs; a many2one is chosen with a literal search on the server, and «Buscar más…» opens the customers' own list to choose from:

function InvoiceView({ api, resource }: ViewProps) {
  const invoice = useRecord(invoices, resource.id ?? "");
  const crumbs = useCrumbs(api);
  useRecordInWorkspace(api, invoice); // its real name in the crumb, «unsaved» asks first
  const dirty = dirtyOf(invoice); // «Save / Discard» while something was typed
  if (invoice.status !== "ready") return <Skeleton rows={4} label="Loading" />;
  return (
    <Record
      identity={{ title: invoice.record.number }}
      {...(dirty === undefined ? {} : { dirty })}
    >
      <Record.Rail>
        <Record.Crumbs crumbs={crumbs} />
        {/* Always there on an edited record: without them web-ui remounts the paper on «dirty». */}
        <Record.Actions>
          <CommandButton entity={invoices} id={invoice.id} command="post" label="Post" />
        </Record.Actions>
      </Record.Rail>
      <Record.Paper>
        <Field label="Customer">
          <RelatedRecord api={api} entity={customers} value={invoice.record.customer} />
        </Field>
        <RecordField
          record={invoice}
          name="customer_id"
          // Inside a workspace the picker opens the chosen and «see all…» there by itself.
          as={({ value, set }) => (
            <EntityPicker entity={customers} value={String(value ?? "")} onChange={set} />
          )}
        />
        <RecordField record={invoice} name="notes" />
      </Record.Paper>
    </Record>
  );
}

A field is drawn by what the model says it is, with no as: money (widget: "money") is typed in its currency — «Bs 1.150,50» —; formatted text (widget: "html", sincpro_framework#371) is web-ui's editor written and its cleaned HTML read; a relation to a person (summary.person) is their face and name; a file or a picture is given right there, its bytes sent where the application says. What is the application's is said once, on the provider:

<SincproApp
  // …
  currency="BOB"
  region="es-BO" // numbers and money as the business writes them; words stay in `language`
  richText={{ toolbar: "full", embeds: ["youtube"], sanitized: true }} // the backend cleans it
  uploads={{
    // sincpro_framework takes no file inside a Command (#364): the application's Command asks
    // for an upload id for this record's field; the framework sends the bytes there, with
    // progress, and the field holds `value` — what the save's Command names.
    publish: async (file, { entity, id, field }, signal) => {
      const { upload_id } = await mediaBoundedContext.execute(
        new CommandStartUpload({ entity, id, field, name: file.name }),
        { signal },
      );
      return {
        link: `/files/uploads/${upload_id}`,
        value: upload_id,
        src: `/media/${upload_id}`,
      };
    },
  }}
/>

A refusal is said by its reason in the copy's words (FILE_TOO_LARGE and its limit, FILE_TYPE_NOT_ALLOWED and what it takes); src is where a picture inside a rich text is seen. Without uploads a file field is only read. A field the model does not mark as formatted text asks for it by reference — <RecordField record={notice} name="body" as={richTextControl} /> —, a screen of its own draws a choice's tag with <ChoiceTag entity={payments} field="state" value={payment.state} />, and useTextOf().money(total) reads a bare amount a use case answered.

An action that asks before it runs says which answers it needs — «Confirmar» stays off, and the dialog says what is missing, until they are given; how long or what shape an answer must be is the use case's to refuse:

<CommandButton
  entity={receipts}
  command="reject"
  id={receipt.id}
  label="Reject…"
  ask={[{ name: "reason", label: "Reason", widget: "textarea", required: true }]}
/>

How a record of an entity LOOKS — as a choice, a row, a card, a tile — is said once, around the entity, and every place that draws one uses it (EntityPicker, EntityTags, ⌘K, EntityList's rows, board and tiles). Each size answers web-ui's props for it, over the default; give only what changes:

export const customers = presented(
  entity<Customer>("sales:customer", { list: "/customers" }),
  {
    option: (c) => ({ meta: `NIT ${c.tax_id}`, aside: <Balance value={c.balance} /> }),
    row: (c) => (c.blocked ? { tags: <Tag tone="bad">Blocked</Tag> } : {}),
    card: (c) => ({ subtitle: c.city }),
    tile: (c) => ({ media: { src: c.logo_url }, figure: <Balance value={c.balance} /> }),
  },
);

Any record, at any size, from its summary:

const summarize = useSummaryOf(customers);
<RecordCard
  {...cardOf(summarize(row))}
  onOpen={() => openIn(api, customers.ref(row.id), "page")}
/>;

7. The application's logic lives in its services — Feature and ApplicationService of each bounded context, set up with @sincpro/client-framework the way sincpro_framework sets one up (its dependencies, its services, project.Issues.close(input); see its README) — and a screen only runs them. The process is where the application injects its telemetry, its error reporting and where the context lives, once, in main; without them, everything runs the same:

// entrypoints/main.tsx
import { configureProcess, processContext } from "@sincpro/client-framework";
import { glitchtipReporter, reportUncaught } from "@sincpro/web-framework/errors"; // optional
import { browserTracer } from "@sincpro/web-framework/telemetry"; // optional

const release = "my-app:1.0.0"; // <name>:<version>, the backend's APP_RELEASE
configureProcess({
  identity: { release }, // + tenant, when the deployment serves one
  // recordExceptions: false — a failure's message and stack stay in GlitchTip, not in every span
  tracer: browserTracer({ endpoint: settings.otlp, release, recordExceptions: false }),
  reporter: glitchtipReporter({ dsn: settings.glitchtip, release }),
});
reportUncaught(); // optional: what nobody caught — a click handler, a promise nobody waited for
processContext.set({ tenant_id: session.tenant }); // every use case runs with it and sends it

reportUncaught() listens to window's error and unhandledrejection and hands each to the process's reportError: a cancellation or a refusal is not a fault, and a use case's failure already reported is not reported again. Without it, only what the process decides is unexpected reaches the reporter, as before.

function CloseButton({ issueId }: { issueId: string }) {
  const close = useServiceCommand(projectBoundedContext, CommandCloseIssue); // execute · busy · response · error
  return (
    <>
      <Button
        disabled={close.busy}
        onClick={() => close.execute(new CommandCloseIssue(issueId))}
      >
        Close
      </Button>
      {close.error ? <Refused error={close.error} /> : null}
    </>
  );
}

Or the button that draws it — CommandButton's gesture for a use case: off while it runs, a refusal where it happened, and an action that destroys asks first what it would do (the use case run dry) and shows it:

<ServiceButton
  label="Cancel"
  run={() => projectBoundedContext.execute(new CommandCancelIssue(issue.id))}
  rehearse={() => projectBoundedContext.execute(new CommandCancelIssue(issue.id, true))}
/>

What a use case wrote, every screen sees. Each write an operation adapter of the framework sends is announced on the process's change feed (processChanges, client-framework) — a screen's save, a use case's generated client, a panel beside. The cache forgets what it touched, and every reading on screen — useListing, useRecord, useHistory, useGroups, usePivot, useNameOf — reads again, keeping its filter, order and page; a record being edited keeps what was typed. A screen never calls reload() after an action. A reading of an application's own follows the same feed:

const writes = useWrites(invoices); // how many times a write named the invoices' model
useEffect(() => { … }, [writes]);

A bounded context with no sincpro_framework behind it declares its model by hand and is drawn the same way:

const tickets = defineMeta({
  aggregate: "Ticket",
  identity: "id",
  display: "title",
  search: ["title"],
  fields: {
    id: field.text({ readonly: true }),
    title: field.text({ label: { es: "Título" }, required: true }),
    stage: field.choice(["new", "done"], { labels: { new: { es: "Nuevo" } } }),
  },
});

8. Rendered on a server — only when the application renders pages on one (Next.js, TanStack Start, Remix); a single-page application skips it and ships nothing of it. Three pieces, and none imports an SSR framework: the application wires its own framework's hooks.

A page prefetches on the server the queries its screens run in the browser, and arrives with its data in its HTML. prefetchQueries returns the Responses as plain JSON by query key — a Client Component receives data, never instances —, leaving out, with one line on the process's log, a query that failed: the page is drawn anyway and the browser fetches it on mount. <HydrationBoundary state> hands them to the screens below, which find them by running the same query — no initial prop:

// a route's loader or a Server Component — plain logic, no screen loaded
import { prefetchQueries } from "@sincpro/web-framework/core";
const state = await prefetchQueries([
  [membersBoundedContext, new CommandReadBalance(memberId)],
]);
return (
  <HydrationBoundary state={state}>
    <Balance member={memberId} />
  </HydrationBoundary>
);

// the screen, rendered there and hydrated in the browser: it fetches nothing on mount
const balance = useServiceQuery(membersBoundedContext, new CommandReadBalance(member));

A record screen starts the same way. readRecordOnServer reads the record with the operations the provider is given, its model the contract's — plain JSON (RecordRead), undefined and one line on the log when it fails — and useRecord starts ready from it (so do useRecordScreen and EntityRecord, by initial): the HTML carries the record, not a skeleton, and the browser asks nothing for it on mount. Only for the record it was read for; editing, previews, drafts and saving stay the browser's, as always. Give the provider the business's timeZone and locale: without them an instant is written on the server's clock and then on the browser's, and the HTML does not match:

// the Server Component
import { readRecordOnServer } from "@sincpro/web-framework/core";
const invoice = await readRecordOnServer(operations, invoices, params.id, { meta });
return <InvoicePage id={params.id} initial={invoice} />;

// the page ("use client"), under <FrameworkProvider timeZone="America/La_Paz" locale="es">
function InvoicePage({ id, initial }: { id: string; initial?: RecordRead<Invoice> }) {
  const invoice = useRecord(invoices, id, { initial }); // ready on the server already
  …
}

The server's use cases are traced like the browser's and their traceparent reaches the API — the counterpart of browserTracer, in its own optional entry. The provider is registered once per process, where the SSR framework's own spans land too; the process is configured once per realm (Next bundles instrumentation, Server Components and server rendering apart), and never in a browser:

// instrumentation.ts (Next) — once per process
export async function register() {
  if (process.env.NEXT_RUNTIME !== "nodejs") return;
  const { registerServerTracing } = await import("@sincpro/web-framework/telemetry/server");
  const endpoint = process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT; // none: tracing stays off
  await registerServerTracing({
    endpoint,
    release,
    environment,
    oneTreePerRequest: true,
    recordExceptions: false, // the detail is the error tracker's
  });
}

// where the server runs use cases — once per realm; in a browser it does nothing
import { configureServerProcess } from "@sincpro/web-framework/telemetry/server";
configureServerProcess({ identity: { release } });

With oneTreePerRequest, each request is one trace: the request the SSR framework traced, its renders, the use cases its page read and what the API did with them. It registers Node's AsyncLocalStorage context manager (the optional peer @opentelemetry/context-async-hooks), unless the platform registered one first, and a use case with no parent of its own starts under the active span (client-framework 2.5's adoptActiveSpan). Without it — the default — each use case's span starts a trace of its own, as before.

recordExceptions: false (both tracers, client-framework 2.6+) keeps a failed use case's span to what the run says — error.type, sincpro.outcome, an ERROR status — without its exception: where errors go to an error tracker with their trace id, the message and the stack are already there, under its access rules, and a failure's message can name a customer. Default true.

registerServerTracing also registers the W3C trace-context propagator (no baggage), unless the platform registered one: an SSR framework reads and writes traceparent only through it. With it and oneTreePerRequest, a request that arrives with a traceparent continues that trace, and Next writes the request's own into the page (experimental.clientTraceMetadata: ["traceparent"], <meta name="traceparent"> — on dynamic pages only: a cached page would hand every visitor one trace).

A page drawn on the server can hand its trace to the browser: with browserTracer({ …, continueServerTrace: true }) the page's first use case is a child of the render's span (<meta name="traceparent">), one trace from the request to the first read the browser made; what a person does later starts traces of its own. Only on pages rendered per request — a cached page (ISR, a static export) carries one meta for every visitor, so leave it off where that cannot be told.

A page that broke while drawing shows the route's error screen instead of the framework's generic one: plain words, the code the server logged it with (Next's digest), «try again» and «home», reported once through the process:

// app/(portal)/error.tsx (Next) — the boundary is the framework's, the screen this one
"use client";
import { RouteError } from "@sincpro/web-framework";
export default function PortalError({ error, reset }: { error: Error; reset: () => void }) {
  return <RouteError error={error} reset={reset} where="portal" home="/panel" />;
}

What fails on the server reaches GlitchTip too, with its real stack — the browser only ever gets Next's generic message and the digest. ./errors/server keeps one Sentry-compatible client per process (@sentry/core's server client, not @sentry/node, which would set up an OpenTelemetry of its own); a request's report carries the same digest the visitor sees, its route and its trace — and the browser's report of it (RouteError, through glitchtipReporter) is tagged with that digest too, so the two reports of one failure are found together:

// instrumentation.ts (Next) — once per process, and each request that failed
export async function register() {
  if (process.env.NEXT_RUNTIME !== "nodejs") return;
  const { registerServerErrors } = await import("@sincpro/web-framework/errors/server");
  await registerServerErrors({ dsn: process.env.SENTRY_DSN, release, environment }); // none: off
}
export async function onRequestError(error, request, context) {
  const { reportRequestError } = await import("@sincpro/web-framework/errors/server");
  reportRequestError(error, {
    method: request.method,
    path: request.path,
    route: context.routePath,
  });
}

// where the server runs use cases: what fails unexpectedly there is reported, with its trace
import { serverReporter } from "@sincpro/web-framework/errors/server";
configureServerProcess({ identity: { release }, reporter: serverReporter() });

Readable stacks. A production stack points at built bundles (page.js:1:4313). On the server nothing has to be uploaded: build the server with its source maps and run Node with its own (experimental.serverSourceMaps: true in Next, NODE_OPTIONS=--enable-source-maps), and each reported frame says where it was in the source (app/cursos/page.tsx:12) — Next prints its stacks mapped but hands over errors whose stack is not, so ./errors/server maps them itself with node:module. In the browser the maps must never be served: inject debug IDs at build and upload them to GlitchTip with its CLI, then drop them from what is deployed:

# the application's build (Next: productionBrowserSourceMaps: true)
glitchtip-cli sourcemaps inject .next/static
glitchtip-cli sourcemaps upload .next/static --release "$RELEASE"  # SENTRY_URL, SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT
find .next/static -name '*.map' -delete

The abstractions

Each answers one question, and each comes in the three levels — use the component, drop to the hook and draw your own, or go straight to the loose piece.

| Question | Declarative | Hook | Loose piece | | ------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------ | | Where is the data? | entity() (client-framework) | — | restTransport, memoryTransport | | The application's logic | its Features and ApplicationServices (client-framework) | useServiceCommand | boundedContext.execute(new CommandX(…)) | | Read through a use case | its Features (client-framework) | useServiceQuery | QueryCache, queryKeyOf | | Read it on the server first | the same query, before the page is drawn: <HydrationBoundary state> | useServiceQuery | prefetchQueries, DehydratedState | | A record read on the server | EntityRecord initial | useRecord(…, { initial }) | readRecordOnServer, RecordRead | | What every use case runs with | processContext, project.context (client-framework) | useContextValues | ContextStore | | What happened, what broke | ./telemetry, ./errors (optional) | — | configureProcess({ tracer, reporter }) | | What happened, on the server | configureServerProcess (./telemetry/server, optional) | — | registerServerTracing, serverTracer | | What broke, on the server | reportRequestError (./errors/server, optional) | — | registerServerErrors, serverReporter | | A page that broke | RouteError, in the route's error boundary | — | reportError (client-framework) | | What is each field? | Meta from the server, or defineMeta | — | textOf, viewOf, metaFromSchema | | A value outside a model | — | useTextOf | moneyTextOf, dayTextOf, instantTextOf, numberTextOf | | A file or a photo it holds | EntityList, RecordField: by its widget, as a FileValue | — | attachmentOf, storedFileOf, renditionUrl | | A file given in the record | RecordField with uploads: FileControl (DropZone) | useUpload | sendFile, uploadRefusalOf | | Formatted text | RecordField (widget: "html"), factsOf: RichTextControl | — | richTextPlainOf, holdsRichText | | A person, read | RecordField, factsOf: PersonValue (UserChip) | useSummaryOf | isPersonEntity | | A choice's tag outside a list | ChoiceTag | — | choiceTagOf | | What is a record, at any size? | cardOf, relationOf | useSummaryOf | summaryOf | | How does a record look? | presented(entity, { option, row, card, tile }) | — | presentationOf | | N records: search, filter, page | EntityList, EntitySearchBar | useListing, useGroups | readPage(operations, entity, criteria) | | A named slice (to collect, …) | defineList + listView | useListing(list) | scopeOf | | A record's whole screen | EntityRecord, entityView without record | useRecordScreen | formOf | | One region of a record screen | RecordScreen.* (Rail, Paper, Fields, Pages, Audit…) | useScreenRecord | web-ui's Record.* | | One region of a list | EntityList.* (Bar, Search, Table, Board, Pager…) | useScreenListing, useEntityList | web-ui's List.* | | The models a face brings | ModelDefinitions entities metas events; SincproApp without operations | — | metasOf, eventMetasOf (client-framework) | | What a record screen says of it | RecordScreen title subtitle tag creating moment actions | useRecordScreen (same options) | web-ui's Record identity, Record.Dock moment | | What hangs off a record, counted | RecordScreen links (RelatedLink: entity, where, title) | useCounts | listRef | | The notices, on a hand-written screen | — | useRecordNotices | web-ui's Record.Notice | | A block laid out as the form | — | useScreenColumns | — | | Who is who in a history | SincproApp people, FrameworkProvider people, ModelDefinitions people | usePeopleOf | the application's use case | | «New» in the business's words | EntityList create="Nueva noticia" | — | canCreate (create or Edit) | | The list as a spreadsheet | EntityList «Exportar» (the entity's export) | — | csvOf, exportColumnsOf; exportRoute (client-framework) | | Spanish in tú | SincproApp voice="tú" | — | SPANISH_FRAMEWORK_COPY_TU, web-ui's SPANISH_COPY_TU | | Previous / next from a record | EntityRecord (from a list) | — | placeOf, stepIn (Trail) | | How much each group adds up | EntityList sums | useGroups (sums) | sumsOf, detailOf | | One record: read, edit, save | RecordField, factsOf, RecordLines | useRecord | readRecord, operations.call(entity.operations.edit, …) | | Its lines: add, edit, remove | RecordField name="lines" (LineItems) | useRecord (edit.cell, errorAt) | lineKey, editableLines, pathOf | | Its relations, inside it | RelatedList | useRelated | relatedOf | | What other records hold of it | web-ui's SmartButton opening entity.listRef(cut, name) | useCount | entity.listRef (client-framework) | | Choose one (literal search) | EntityPicker, chooserIn | useLookup | lookupOf + criteria's matching | | Choose several (many2many) | EntityTags | useLookup (values) | lookupOf | | A relation, from the model alone | RecordField name="customer_id" | useEntityFor | relationFieldOf, entityFor | | Open it where it belongs | RelatedRecord, entityView, EntityList openTargets | — | openIn, targetsFor, OpenInMenu | | Look at the set several ways | EntityList views (table, rows, board, sheet, tiles) | — | web-ui's List.* | | Cross it by two fields | EntityList pivot | usePivot | pivotOf | | Order by several fields | the bar's criteria builder | listing.orderBy([...]) | criteria's order | | Act on it (with a dry run) | ServiceButton (a use case), CommandButton, row commands | useServiceCommand, useCommand | callFor, operations.call | | What is chosen in a list | EntityList selectable selection | useSelection | Selection, chosen, allMatching (client-framework) | | Act on each chosen one | BatchProgress, selectionActions={(chosen) => …} | useBatchCommand | runBatch, keysOf (client-framework), sendRoute | | A list's actions, by the style | EntityList actions, selectionActions (DockActions) | — | web-ui's List.Dock, ViewStyleProvider | | A record's actions, by the style | EntityRecord actions, web-ui's Record.Dock | useRecordLifecycleActions | DockedAction, ActionLook | | A use case or a Command, there | ServiceButton, CommandButton (as buttons) | useServiceAction/useCommandAction | — | | Delete it | EntityRecord (RecordLifecycle) | useRecordLifecycle | entity.operations.delete, useOperationCommand | | Its trash | EntityRecord (RecordLifecycle), listView(trashOf(entity)) | useRecordLifecycle | entity.operations.archive, .restore, trashOf | | Read again when it was written | every reading of this package, by itself | useWrites | processChanges (client-framework) | | What happened to it | Record.Activity fed by useHistory | useHistory | historyOf | | The application context | SincproApp | useRecordInWorkspace, useFollowed | FrameworkProvider, webUiSkin |

The rules behind them, in short:

  • A reference names any record (domain:kind/id, entity.ref(id)). Two contexts talk by reference, never by import; whatever must survive a reload travels in it.
  • A related record opens in a modal the size of a record, and «Abrir en…» offers preview, side and page. From inside a modal, beside or as a preview — never a modal over a modal. openIn decides it from what composer says about the view, so no screen writes it.
  • What a record does not have is not drawn: no picture, no image; no state, no tag.
  • Every word on screen is the model's (labelOf, choiceLabelOf) or the framework's copy table (frameworkCopy()), never a string in a component.

Where state lives

There is no store of ours to learn: each kind of state already has its owner.

| State | Lives in | Read with | | -------------------------------------------- | ---------------------------------------------------------- | ------------------------------------ | | Who answers, language, known models | FrameworkProvider (this package) | the hooks, through context | | What the backend sees on every request | processContext (client-framework), as sincpro-context | the backend's use_context() | | What an opening carries (company, a default) | composer: the reference's params | api.self.params, api.setParams | | The record a modal covers | composer: api.over | api.over | | What a chooser was asked | composer: pick(…, { question }) | api.choosing | | What the user is on, what is selected | composer: api.context | useWorkspaceContext(api) | | A screen's list, record, groups | the hooks | useListing, useRecord, … | | What anyone wrote | processChanges (client-framework): every write announced | useWrites, the hooks by themselves |

Not yet: a new record does not take the params it was opened with as its initial values (ROADMAP.md, «Estado y contexto»).

Inside

Three levels, one direction, and optional entries — make doctor keeps the arrows:

| Folder | Knows | Why apart | | --------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | | core | what a value and a record read as, forms, lines, the trail, explain, the cache | plain logic, tested in Node in milliseconds | | react | useListing, useRecord, useRelated, useSummaryOf…, the provider | state that draws nothing: usable without EntityList | | web/list | a collection: EntityList, EntitySearchBar, columnsOf | N records, any size | | web/record | one record: RecordField, factsOf, RelatedList, EntityPicker, cardOf | works outside a workspace (no composer) | | web/workspace | the composer: entityView, openIn, RelatedRecord, <SincproApp> | where it opens, the application context | | telemetry, errors | browserTracer, glitchtipReporter: built from the application's settings | optional peers, loaded after the first render; nothing else imports them | | telemetry/server | registerServerTracing, configureServerProcess: a server's use cases traced | optional peers too; Node only — a browser never loads it | | errors/server | registerServerErrors, serverReporter, reportRequestError: to GlitchTip | optional peer @sentry/core; a browser never loads it |

Screens import from @sincpro/web-framework. What every platform shares — the transport, entity(), model definitions, Feature and ApplicationService, the generated client — is @sincpro/client-framework's, imported from there and never re-exported here. @sincpro/web-framework/core is the screens' plain logic (what a value reads as, a form's defaults, lines), loaded without React.

From the contract

A service built on sincpro_framework exports what it publishes — its models and every operation, what each one is for its entity and how each wire reaches it — as one client contract per bounded context. sincpro-client generate (@sincpro/client-framework) writes, from it, what the screens used to declare by hand:

python -m sincpro_framework.entrypoints export-client-contract app.http:gateways contracts/
npx sincpro-client generate contracts/project.contract.json --out src/generated/project --base /v1

| File | What it holds | | --------------- | --------------------------------------------------------------------------------------------------- | | domain.ts | the DTOs — every model, every operation's input and answer — with the server's own docs. Types only | | client.ts | every operation as typed data (operations), and api, implemented by apiOf(api, operations) | | entities.ts | an entity() per model a screen lists: an index over its operations, by role, and its Commands | | contract.json | the snapshot they came from: metasOf(contract, "project") preloads the definitions |

What is generated is never edited; a screen extends it (presented(issues, { row }), a type with &). Keep the folder out of prettier and eslint, and let CI regenerate and compare it. The definitions are the contract's: regenerate when the backend changes. How an application adopts it — where each file goes, what is written by hand, how a hand-written screen moves to the generated one — is docs/ADOPTION.md.

Where it stands

| Piece | What it solves | Status | | --------------------------------------- | ----------------------------------------------------------------------------------------------- | ------ | | restTransport, memoryTransport | The backend, or the same engine in memory (client-framework) | ✅ | | defineMeta, metaFromSchema | A model by hand, or completed from OpenAPI (client-framework) | ✅ | | useServiceCommand | A screen executes a Command on a gesture: execute, busy, response, error | ✅ | | useServiceQuery | A screen queries a use case: cached by query key, shared, invalidated by writes and context | ✅ | | prefetchQueries | A page's queries prefetched on the server, hydrated by HydrationBoundary: plain JSON | ✅ | | readRecordOnServer | A record screen filled in the server's HTML: useRecord starts from it, nothing asked on mount | ✅ | | ./telemetry, ./errors | Optional: the application's traces to its OTLP endpoint, its errors to GlitchTip | ✅ | | ./telemetry/server | Optional: a rendering server's use cases on its OTLP provider, their trace continued by the API | ✅ | | ./errors/server | Optional: what fails on a rendering server to GlitchTip, with the visitor's digest and trace | ✅ | | RouteError | A page that broke: plain words, the server's code, retry and home; reported once | ✅ | | selection | Filters named as criteria 2.0 and the backend read them, the search bar's included | ✅ | | useListing, EntityList | N records: criteria, search bar, builder, paging | ✅ | | useRecord, factsOf, RecordLines | One record: facts, relations with their real total | ✅ | | Definitions | Each generated entity carries its model (meta); metas replaces one; no answer carries one | ✅ | | useLookup, EntityPicker | Literal search: a many2one select, ⌘K | ✅ | | useRecord + RecordField, dirtyOf | Editing: hints evaluated live, preview, save with version (409), server drafts | ✅ | | useCommand, CommandButton | An entity's actions, with a dry run before what destroys | ✅ | | ServiceButton | A use case as an action: the same gesture, its dry run the use case's own | ✅ | | useWrites, the change feed | Every reading on screen reads again when anyone writes what it shows — a use case included | ✅ | | Typed Commands (the contract's) | A name the entity does not declare, or a field its operation does not take, does not compile | ✅ | | Typed answers (the contract's) | What each Command answers, typed: run(…) returns it with no type argument written | ✅ | | A Query of the context's own | operations.call(…) (/me): neither a page nor a record, never cached | ✅ | | A key alone (EntityID), useNameOf | A key that names whose record it is, drawn as a many2one; names asked in one request per entity | ✅ | | versionsOf, onVersionDrift | A snapshot behind the server is told once per model — never an error | ✅ | | sincpro-client generate | A context's DTOs, client and entities out of its exported client contract | ✅ | | metasOf, targeted | Definitions from that snapshot; a Command's record written where its operation names it | ✅ | | useHistory | Business events in Record.Activity (comments: backend first) | ✅ | | entityView | An entity as a composer view: list, record, ⌘K search | ✅ | | <SincproApp> | The application context in one place, the workspace dressed as web-ui (webUiSkin) | ✅ | | useRecordInWorkspace | A record tells the workspace its real name and its unsaved work (composer 1.0) | ✅ | | Paging by pages, ceiling on «more» | One page on screen, walked by the server's cursor: a million rows never freeze it | ✅ | | cachedOperations | Repeated Queries from memory and shared in flight, forgotten when anyone writes the entity | ✅ | | EntitySearchBar | The search bar + criteria builder as a loose piece, for any List | ✅ | | EntityList views | The same set as table, rows or board | ✅ | | useRelated, RelatedList | A record's relation as a live list: searched and paged by the server, inside a form | ✅ | | EntityPicker chooser | «see all…» opens the whole set, searched on the server: a many2one over millions | ✅ | | useRecord(entity, ""), create | A new record: the model's defaults, saved to create (or edit), then it IS that record | ✅ | | retryKeys, Idempotency-Key | A Command or a create retried after a lost answer runs once, not twice | ✅ | | entity.newRef(), «New» in the list | The record's form with no id, in a page or a window; replaced by the record once created | ✅ | | EntityPicker criteria | A many2one narrowed by another field: the invoices OF the chosen customer | ✅ | | chooserIn, entity.chooserRef() | «see all…» as the composer's chooser: a row answers (api.pick) | ✅ | | EntityPicker / EntityTags in a view | Open and choose in the workspace by themselves; the chooser carries the picker's cut | ✅ | | newEntityId, edit on a new record | A new record born under a UUID v7 minted here: its draft and its save go through Edit | ✅ | | useGroups, «Group by» | Groups counted by the server over the whole set; a group's rows read when it is opened | ✅ | | defineList, listView | A named list (a fixed scope, its columns and filters) as data, and as a workspace view | ✅ | | EntityPicker browse, columns | The chooser always a click away, as a table searched literally by the server | ✅ | | useFollowed | A detail panel follows the record the person is on, without knowing the list | ✅ | | commands, useRowCommands | An entity's Commands on each row, idempotent, offered only where when holds | ✅ | | summaryOf, cardOf, relationOf | Any record at any size: name, description, state, type, picture, who made and changed it | ✅ | | openIn, RelatedRecord | A related record opens in a modal; «Abrir en…» for the rest; never a modal over a modal | ✅ | | Literal search everywhere | Picker: the first ten, the server's search as you type; tables: «Buscar «X»» on Enter | ✅ | | EntityTags | A many2many as chips over thousands: the server's search, faces, the chosen never again | ✅ | | RecordField + entities | A many2one / one2many drawn from the model alone, opened where the view says | ✅ | | EntityRecord, formOf | Any entity's record screen without writing it | ✅ | | Trail, Record.Pager | Previous / next from a record, across the server's pages | ✅ | | EntityList sums | Each group says how much it adds up, summed by the server over all of it | ✅ |

What it does not do: mobile screens (@sincpro/mobile draws them; what it shares with the web is @sincpro/client-framework), sessions and login (the application's), routing (composer's), string-named widget registries, technical logs on a record's screen, business rules.

Still to come (docs/prd/PRD_02_how-an-application-is-built.md): the framework's own reads and writes as traced Features, so every screen it draws is traced too — today the application's use cases are; the levels of context and the bounded contexts; the extension model.

The full purpose — literal search, drafts, composer context, several entities per screen — is in docs/PURPOSE.md; what was found while building and what comes next is in docs/ROADMAP.md.

Built for large sets

Nothing is filtered, ordered, counted or grouped on the page: every gesture is a question the server answers. A list holds ONE page by default and walks the server's keyset cursor (page 4 000 costs what page 1 costs); «load more» stops at a ceiling and asks to narrow the search; the count is the server's, capped; typing waits for a pause; a newer question cancels the older one; the model definition is asked once per entity; repeated reads come from a cache that a write clears. Story «15 · Un conjunto grande sin congelar» runs it over 200 000 rows.

The use cases are the tests

Every use case is a Storybook story run against an in-memory server that answers with the same criteria engine as sincpro_framework, and each one carries a play. The story IS the test: make test runs every story in a real Chrome with vitest (@storybook/addon-vitest), awaits its play and checks its a11y — and the same tests run from Storybook's sidebar («Run tests»). The plain logic is tested in Node by the same runner. A case the framework cannot do yet shows up there first.

Development

nvm use       # Node 26, from .nvmrc
make init     # pre-commit + yarn install
make test     # vitest: the logic in Node + every use case (story + play) in Chrome
make dev      # Storybook on :6008 — the use cases, «Run tests» in the sidebar
make build

Every operation — local or CI — goes through the Makefile; run make to list the targets. Working on this repository, human or agent: read AGENTS.md first.

CI/CD

The workflows in .github/workflows/ only delegate to the shared Sincpro-SRL/.github pipeline, which calls make init, `make verify-format