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

@expresscsv/schemas

v1.0.1

Published

Schema authoring and type inference package for ExpressCSV

Readme

@expresscsv/schemas

Schema authoring and type inference for ExpressCSV, without the importer launcher.

Use this package when you want to define schemas in shared or backend code without pulling in any frontend, importer, or React dependencies.

Usage

import { type Infer, x } from '@expresscsv/schemas';

const employeeSchema = x.row({
  name: x.string(),
  email: x.string().email(),
  salary: x.number().currency('USD').optional(),
});

type Employee = Infer<typeof employeeSchema>;

Shared And Backend Code

Because @expresscsv/schemas has no frontend launcher dependencies, you can define your schema once in shared code and reuse its inferred type across your frontend and backend.

import { type Infer, x } from '@expresscsv/schemas';

export const employeeSchema = x.row({
  email: x.string().email().label('Email'),
  name: x.string().label('Full Name'),
  startDate: x.date().optional().label('Start Date'),
});

export type Employee = Infer<typeof employeeSchema>;

Runtime-Built Schemas

If your backend or shared code has a fixed schema, model it with x.row(...):

import { x } from '@expresscsv/schemas';

export const customerSchema = x.row({
  email: x.string().email().label('Email'),
  lifecycleStage: x
    .select([
      { label: 'Lead', value: 'lead' },
      { label: 'Customer', value: 'customer' },
      { label: 'Churned', value: 'churned' },
    ])
    .label('Lifecycle Stage'),
  accountOwner: x.string().label('Account Owner').optional(),
});

x.row(...) also works for runtime-built schemas, which is useful when the shape depends on account data, user preferences, or enabled custom fields.

import { x } from '@expresscsv/schemas';

export function buildCustomerSchema(options: {
  collectCrmId: boolean;
  collectHealthScore: boolean;
  collectSegment: boolean;
}) {
  return x.row({
    email: x.string().email().label('Email'),
    companyName: x.string().label('Company Name'),
    ...(options.collectCrmId ? { crmId: x.string().label('CRM ID') } : {}),
    ...(options.collectHealthScore
      ? { healthScore: x.number().label('Health Score') }
      : {}),
    ...(options.collectSegment
      ? {
          segment: x
            .select([
              { label: 'SMB', value: 'smb' },
              { label: 'Mid-Market', value: 'mid-market' },
              { label: 'Enterprise', value: 'enterprise' },
            ])
            .label('Segment'),
        }
      : {}),
  });
}

const customerSchema = buildCustomerSchema({
  collectCrmId: true,
  collectHealthScore: false,
  collectSegment: true,
});

Dynamic schema assembly preserves the same runtime parsing behavior, but it can widen Infer<typeof schema> because the exact keys are no longer fully known to TypeScript. Use it intentionally.

Exports

  • x
  • Infer
  • ExType
  • ExBaseDef
  • ExRow
  • ExRowShape
  • ExRowWithOptionalColumns

Not included

This package intentionally does not export the importer launcher, React bindings, or importer configuration types. Use @expresscsv/sdk or @expresscsv/react for those integration surfaces.