Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@arrirpc/schema

Latest version: v0.86.1

Overview

Last scanned
23 Nov 2026
Published
23 Nov 2026
npm package Publisher: joshmossas
501 Stars
9 Forks
3 Versions
13.1K Downloads
TypeScript Repo language

Scan summary

@arrirpc/schema was last scanned on 23 Nov 2026 at version 0.86.1. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 3 versions; the latest 2 were published within 5 days (19–23 Nov 2026).
  • Findings: No rules fired in version 0.86.1.
  • Downloads: 13,089 downloads.

Versions

3 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.86.1 LATEST 23 Nov 2026 No rules fired
0.86.0 19 Nov 2026 No rules fired
0.85.0 3 Oct 2026 No rules fired

No rules fired in 0.86.1

Findings

Findings for v0.86.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.86.1; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Arri Schema

A Typescript validator and schema builder that can be compiled to other languages. A lot of inspiration was taken from both Typebox and Zod when designing this library. This library also supports standard-schema meaning it can be used with any third-party library that accepts standard schema.

Under the hood this library constructs Arri Type Definitions (ATD). These definitions can be passed to the Arri CLI to generate code for any of the client languages that Arri supports. Lastly, this library also comes with a JIT compiler which produces precompiled validators that are more than 100x faster than Zod.

Project Philosophy

The goals of this project are as follows:

  • Portable type definitions
  • High performance validation, parsing, and serialization
  • Consistent error reporting for parsing and serialization errors

I am not looking to support every feature of Typescript's type system or even every possible representation of JSON. The goal is that the data models defined through this library can be used as a source of truth across multiple programming languages. Both JSON and Typescript have to be limited to accomplish this.

Adherence to RFC 8927

Originally this library was created as a way for building schemas for Json Type Definition. However over time parts of the internal schema were modified to better suite the goals of Arri RPC. Some of these modifications include:

  • Adding support for 64-bit integers
  • Replacing the additionalProperties field with strict to allow for additional properties by default.
  • Restrict ref to only be used for recursive references.

Table of Contents

  • Installation
  • Basic Example
  • Usage with @arrirpc/server
  • Compiling to other languages
  • Tree-Shakeable Imports
  • Supported Types
    • Primitives
    • Enums
    • Arrays / Lists
    • Objects
    • Records / Maps
    • Discriminated Unions (Deprecated)
    • Tagged Unions
    • Recursive Types
  • Modifiers
    • Optional
    • Nullable
    • Extend
    • Omit
    • Pick
    • Partial
  • Utilities
    • Validate
    • Parse
    • Parse Unsafe
    • Coerce
    • Coerce Unsafe
    • Serialize
    • Serialize Unsafe
    • Errors
    • To JSON Schema
  • Metadata
  • Compiled Validators
  • Benchmarks
  • Development

Installation

# npm
npm install @arrirpc/schema

# pnpm
pnpm install @arrirpc/schema

Basic Example

import { a } from '@arrirpc/schema';

const User = a.object({
    id: a.string(),
    name: a.string(),
});

type User = a.infer<typeof User>;

// returns ResultSuccess<User>
a.parse(User, `{"id": "1", "name": "John Doe"}`);
// returns ResultFailure
a.parse(User, `{"id": "1", "name": null}`);

// returns true
a.validate(User, { id: '1', name: 'John Doe' });
// returns false
a.validate(User, { id: '1', name: null });

// outputs valid json
a.serialize(User, { id: '1', name: 'John Doe' });

// JIT compiled validator (faster but server-side only)
const $$User = a.compile(User);
$$User.validate({ id: '1', name: 'John Doe' });
$$User.parse(`{"id": "1", "name": "John Doe"}`);
$$User.serialize({ id: '1', name: 'John Doe' });

Usage With @arrirpc/server

See here for full details.

import { a } from '@arrirpc/schema';
import { defineRpc } from '@arrirpc/server';

export default defineRpc({
    params: a.object({
        name: a.string(),
    }),
    response: a.object({
        message: a.string(),
    }),
    handler({ params }) {
        // can now access params.name here
        return {
            message: `Hello ${params.name}`,
        };
    },
});

Compiling To Other Languages

All schemas defined with this library can be compiled to other languages using the Arri CLI.

Install the Arri ClI
# npm
npm i --save-dev arri

# pnpm
pnpm i --save-dev arri
Create Your Arri Config
import { defineConfig, generators } from 'arri';

export default defineConfig({
    generators: [
        // add your generators here
        generators.rustClient({
            // options
        }),
        generators.dartClient({
            // options
        }),
    ],
});
Create And Export Your Schemas

Use the createAppDefinition helper to export your schemas for the Arri CLI.

// definitions.ts
import { createAppDefinition } from 'arri';
import { a } from '@arrirpc/schema';

const User = a.object('User', {
    id: a.string(),
    name: a.optional(string()),
    email: a.nullable(a.string()),
    createdAt: a.timestamp({ description: 'When the user was created' }),
    updatedAt: a.timestamp(),
});

export default createAppDefinition({
    definitions: {
        User,
    },
});
Run the Code Generator
# npm
npx arri codegen ./definitions.ts

# pnpm
pnpm arri codegen ./definitions.ts

And your done. Now you can rerun this command whenever any of your schemas get updated.

Example Output
// dart output

class User {
  final String id;
  final String? name;
  final String? email;
  /// when the user was created
  final DateTime createdAt;
  final DateTime updatedAt;
  const User({
     required this.id,
     this.name,
     required this.email,
     required this.createdAt,
     required this.updatedAt,
  });

  // implementation details
}
// rust output

pub struct User {
  id: String,
  name: String,
  name: Option<String>,
  email: Option<String>,
  // when the user was created
  created_at: DateTime<FixedOffset>,
  updated_at: DateTime<FixedOffset>,
}

impl ArriModel for User {
  // implementation details
}
// kotlin output

data class User(
  val id: String,
  val name: String?,
  val email: String? = null,
  /**
   * When the user was created
   */
  val createdAt: Instant,
  val updatedAt: Instance,
) {
  // implementation details
}

See here for a list of all officially supported language generators.

Tree-Shakeable Imports

For those that are concerned about bundle sizes you can use Arri's optional modular import syntax. This makes it so that bundlers can remove unused Arri functions from JS bundles at build time. You can also enforce this in your codebase using the arri/prefer-modular-imports lint rule.

Using the modular import syntax Arri's bundle size can be as small as 4kb depending on how many functions you import.

// tree-shakeable (no `a` prefix)
import { string, boolean, object } from '@arrirpc/schema';
const User = object({
    id: string(),
    name: string(),
    isAdmin: boolean(),
});

// tree-shakeable (with `a` prefix)
import * as a from '@arrirpc/schema';
const User = a.object({
    id: a.string(),
    name: a.string(),
    isAdmin: a.boolean(),
});

// NOT tree-shakeable
import { a } from '@arrirpc/schema';
const User = a.object({
    id: a.string(),
    name: a.string(),
    isAdmin: a.boolean(),
});

Click here to see how Arri Schema's bundle sizes compares to the rest of the ecosystem.

Why isn't this the default?

Just personal preference. I find manually importing individual functions to be a bad developer experience.

// not a fan
import { foo, bar, baz } from 'foo';

Additionally, having an explicitly exported a namespace means that when I type a.{something} that the TS language server will autocomplete the available functions even if I haven't imported @arrirpc/schema yet. If we didn't have that explicit export, then you would not get autocomplete for a.{something} until you added the import * as a line to your file.

// this has to be added before you get autocomplete for `a.{whatever}`
import * as a from '@arrirpc/schema';

However I understand that keeping small bundle sizes can be important which is why I've allowed both options:

// if you care about bundle size use one of these two
import * as a from '@arrirpc/schema';
import { string, object, etc } from '@arrirpc/schema';

// if you aren't as particular about bundle sizes then use this
import { a } from '@arrirpc/schema';

Supported Types

Primitives
Arri Schema Typescript Arri Type Definition
a.any() any {}
a.string() string {"type": "string" }
a.boolean() boolean {"type": "boolean"}
a.timestamp() Date {"type": "timestamp"}
a.float32() number {"type": "float32"}
a.float64() number {"type": "float64"}
a.int8() number {"type": "int8"}
a.int16() number {"type": "int16"}
a.int32() number {"type": "int32"}
a.int64() BigInt {"type": "int64"}
a.uint8() number {"type": "uint8"}
a.uint16() number {"type": "uint16"}
a.uint32() number {"type": "uint32"}
a.uint64() BigInt {"type": "uint64"}
Enums

Enum schemas allow you to specify a predefine list of accepted strings

Usage

const Status = a.enumerator(['ACTIVE', 'INACTIVE', 'UNKNOWN']);
type Status = a.infer<typeof Status>; // "ACTIVE" | "INACTIVE" | "UNKNOWN";

a.validate(Status, 'BLAH'); // false
a.validate(Status, 'ACTIVE'); // true

Outputted ATD

{
    "enum": ["ACTIVE", "INACTIVE", "UNKNOWN"]
}
Arrays / Lists

Usage

const MyList = a.array(a.string());
type MyList = a.infer<typeof MyList>; // string[];

a.validate(MyList, [1, 2]); // false
a.validate(MyList, ['hello', 'world']); // true

Outputted ATD

{
    "elements": {
        "type": "string"
    }
}
Objects

Usage

const User = a.object({
    id: a.string(),
    email: a.string(),
    created: a.timestamp(),
});
type User = a.infer<typeof User>; // { id: string; email: string; created: Date; }

a.validate(User, {
    id: '1',
    email: 'johndoe@example.com',
    created: new Date(),
}); // true
a.validate(User, {
    id: '1',
    email: null,
    created: new Date(),
}); // false

Outputted ATD

{
    "properties": {
        "id": {
            "type": "string"
        },
        "email": {
            "type": "string"
        },
        "created": {
            "type": "timestamp"
        }
    }
}
Strict Mode

By default @arrirpc/schema will ignore and strip out any additional properties when validating objects. If you want validation to fail when additional properties are present then modify the strict option.

const UserStrict = a.object(
    {
        id: a.string(),
        name: a.string(),
        created: a.timestamp(),
    },
    {
        strict: true,
    },
);

a.parse(UserStrict, {
    id: '1',
    name: 'johndoe',
    created: new Date(),
    bio: 'my name is joe',
}); // fails parsing because of the additional field "bio"

Outputted ATD

{
    "properties": {
        "id": {
            "type": "string"
        },
        "email": {
            "type": "string"
        },
        "created": {
            "type": "timestamp"
        }
    },
    "strict": true
}
Records / Maps

Usage

const R = a.record(a.boolean());
type R = a.infer<typeof R>; // Record<string, boolean>

a.validate(R, {
    hello: true,
    world: false,
}); // true;
a.validate(R, {
    hello: 'world',
}); // false;

Outputted ATD

{
    "values": {
        "type": "boolean"
    }
}
Discriminated Unions (Deprecated)

Warning: this specific type definition has been deprecated and replaced with the union type def which can be seen below. The main benefit that the union type has over discriminators is that with discriminators every variants must be an object so that it can append the "discriminator" field (such as type). In contrast union types can use any sub type in their variants.

Usage

const Shape = a.discriminator('type', {
    RECTANGLE: a.object({
        width: a.float32(),
        height: a.float32(),
    }),
    CIRCLE: a.object({
        radius: a.float32(),
    }),
});
type Shape = a.infer<typeof Shape>; // { type: "RECTANGLE"; width: number; height: number; } | { type: "CIRCLE"; radius: number; }

// Infer specific sub types of the union
type ShapeTypeRectangle = a.inferSubType<Shape, 'type', 'RECTANGLE'>; // { type "RECTANGLE"; width: number; height: number; };
type ShapeTypeCircle = a.inferSubType<Shape, 'type', 'CIRCLE'>; // { type "CIRCLE"; radius: number; }

a.validate(Shape, {
    type: 'RECTANGLE',
    width: 1,
    height: 1.5,
}); // true
a.validate(Shape, {
    type: 'CIRCLE',
    radius: 5,
}); // true
a.validate(Shape, {
    type: 'CIRCLE',
    width: 1,
    height: 1.5,
}); // false

Outputted ATD

{
    "discriminator": "type",
    "mapping": {
        "RECTANGLE": {
            "properties": {
                "width": {
                    "type": "float32"
                },
                "height": {
                    "type": "float32"
                }
            }
        },
        "CIRCLE": {
            "properties": {
                "radius": {
                    "type": "float32"
                }
            }
        }
    }
}
Tagged Unions

The a.union() type def allows you to create tagged unions of any sub schema. This is in contrast to the deprecated discriminator type def which can only create a union of objects.

Usage

const CategoryFilter = a.union({
    one: a.string(),
    many: a.array(a.string()),
});

type CategoryFilter = a.infer<typeof CategoryFilter>;
// { one: string } | { many: string[] }

a.validate(CategoryFilter, { one: 'category-1' }); // true
a.validate(CategoryFilter, { many: ['category-1', 'category-2'] }); // true
a.validate(CategoryFilter, { all: true }); // false
a.validate(CategoryFilter, { many: 'category-1' }); // false

Outputted ATD

{
    "union": {
        "one": {
            "type": "string"
        },
        "many": {
            "elements": {
                "type": "string"
            }
        }
    }
}
Union Helpers

This library comes with some helpers to make interacting with unions easier

matchUnion()

This helper forces you to handle every possible variant case

const CategoryFilter = a.union({
    one: a.string(),
    many: a.array(a.string()),
});
type CategoryFilter = a.infer<typeof CategoryFilter>;

const filter: CategoryFilter = { one: 'category-1' };

// this forces us to handle every possible case
matchUnion(filter, {
    one: (value) => {
        console.log(value); // 'category-1'
    },
    many: (value) => {
        console.log(value); // this branch doesn't get reached
    },
});

matchUnion() will also return the result of the branch that it hits

const Shape = a.union({
    rectangle: a.object({
        width: a.float64(),
        height: a.float64(),
    }),
    circle: a.object({
        radius: a.float64(),
    }),
});
type Shape = a.infer<typeof Shape>;

function getShapeArea(shape: Shape): number {
    return matchUnion(shape, {
        rectangle: (rect) => rect.width * rect.height,
        circle: (circle) => 3.14 * (circle.radius ^ 2),
    });
}

getShapeArea({ rectangle: { width: 10, height: 10 } }); // 100
getShapeArea({ circle: { radius: 10 } }); // 314

unwrapUnion()

This helper makes it easy to use a union over a switch statement

// this is the same CategoryFilter type as above
const CategoryFilter = a.union({
    one: a.string(),
    many: a.array(a.string()),
});
type CategoryFilter = a.infer<typeof CategoryFilter>;

const filter: CategoryFilter = { one: 'category-foo' };

const [key, value] = unwrapUnion(filter);
switch (key) {
    case 'one': {
        console.log(value); // 'category-foo'
        break;
    }
    case 'many': {
        console.log(value); // this branch isn't reached
        break;
    }
    default:
        key satisfies never;
        break;
}
Recursive Types

You can define recursive schemas by using the a.recursive helper. This function accepts another function that outputs an object schema or a discriminator schema.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @arrirpc/schema

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Vulnerability Insights

Compromised Claude Code extensions (versions 2.1.312 & 2.1.313) in Cursor try to install a backdoor

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229