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

fortify-schema

v2.2.1

Published

A modern TypeScript validation library designed around familiar interface syntax and powerful conditional validation. Experience schema validation that feels natural to TypeScript developers while unlocking advanced runtime validation capabilities.

Downloads

540

Maintainers

nehonixpkgnehonixpkg

Keywords

schemavalidationconditional-validationadvanced-validationtypescripttype-safeinterfaceruntime-validationschema-validationdata-validationinput-validationform-validationapi-validationjson-schematype-inferencecompile-time-safetyzod-alternativejoi-alternativeyup-alternativeajv-alternativetypescript-firsttype-checkingparseparserserializationdeserializationconstraintsstrict-typingruntime-typesinterface-likeschema-buildervalidation-librarytype-validationobject-validationarray-validationstring-validationnumber-validationemail-validationurl-validationdate-validationuuid-validationphone-validationpattern-validationregex-validationunion-typesliteral-typesoptional-fieldsrequired-fieldsnested-objectsnested-validationconditional-logicbusiness-rulesdynamic-validationcontext-awarefield-dependenciesschema-compositionschema-transformationschema-mergingpick-omitpartial-requiredtype-coercionloose-modestrict-modeerror-handlingvalidation-errorssafe-parsingtry-catchapi-schemarest-apigraphqljson-apiform-schemaconfigurationconfig-validationenvironment-variablesenv-validationdatabase-schemamodel-validationdtodata-transfer-objectrequest-validationresponse-validationmiddlewareexpressfastifykoanodenehonixtypescriptjavascriptfortifyjsnodejsbackendfrontendfullstackreactvueangularnextnuxtsvelteweb-developmentdeveloper-experiencedxclean-codemaintainablereadableintuitivesimplepowerfullightweightperformanttree-shakablebundle-sizezero-dependenciesenterpriseproduction-readybattle-testedreliablerobustscalable

Readme

Fortify Schema

npm version TypeScript Build Status Bundle Size


Important: Migration to Reliant-Type

The fortify-schema package is being deprecated and replaced by reliant-type.

While fortify-schema will continue to receive critical security patches, all new features, performance improvements, and ongoing development are now focused exclusively on reliant-type. We strongly recommend migrating to reliant-type for:

  • Latest features and improvements - All new capabilities are built into reliant-type
  • Active development - Ongoing enhancements and optimizations
  • Long-term support - Full maintenance and community support
  • Enhanced performance - Significant speed and efficiency gains
  • Expanded ecosystem - Growing tooling and integration support

Migration is straightforward - reliant-type maintains API compatibility with fortify-schema core features while introducing powerful new capabilities. See our Migration Guide for step-by-step instructions.

Quick Migration Example

// Before (fortify-schema)
import { Interface } from "fortify-schema";

// After (reliant-type)
import { Interface } from "reliant-type";

// Your existing schemas work without modification
const UserSchema = Interface({
  id: "uuid",
  email: "email!",
  name: "string(2,50)",
});

Overview

Fortify Schema is a TypeScript validation library featuring interface-like syntax and advanced conditional validation. Designed for TypeScript developers who value familiar patterns and powerful runtime validation capabilities.

Key Capabilities

  • Interface-like Syntax - Define schemas using TypeScript-style interface definitions
  • Advanced Conditionals - Implement complex business logic with when expressions
  • Custom Error Messages - Provide context-specific validation feedback using the --> operator
  • Complete Type Safety - Full TypeScript inference with zero runtime overhead
  • High Performance - Automatic precompilation and optimization
  • Professional Tooling - VS Code extension with IntelliSense and real-time validation

Installation

npm install fortify-schema

Note: For new projects, consider starting with reliant-type instead:

npm install reliant-type

Quick Start

import { Interface } from "fortify-schema";

// Define schemas with familiar TypeScript-like syntax
const UserSchema = Interface({
  id: "uuid",
  email: "email! --> Please provide a valid email address",
  name: "string(2,50) --> Name must be between 2 and 50 characters",
  age: "number(18,120)? --> Age must be between 18 and 120",
  role: "admin|user|guest --> Role must be admin, user, or guest",
  tags: "string[]",
  metadata: "record<string, any>",

  // Advanced conditional validation
  permissions: "when role=admin *? string[] : =[]",
});

// Validate with complete TypeScript inference
const result = UserSchema.safeParse(userData);
if (result.success) {
  console.log("Valid user:", result.data); // Fully typed
} else {
  console.log("Validation errors:", result.errors);
}

Core Features

Type System

Comprehensive support for primitive types, collections, and advanced formats:

  • Primitives - string, number, boolean, null, undefined
  • Specialized - email, url, uuid, date, iso8601
  • Collections - Arrays (string[]), Records (record<string, any>)
  • Objects - Generic object validation with object and object?
  • Unions - Enumerated values with admin|user|guest

Validation Modifiers

  • Optional - Mark fields as optional with ? suffix (e.g., "string?")
  • Required - Enforce non-empty values with ! suffix (e.g., "email!")
  • Constraints - Apply ranges and limits with (min,max) syntax
  • Custom Messages - Define user-friendly errors with --> operator

Conditional Validation

Implement complex business rules based on runtime data:

const ProductSchema = Interface({
  inStock: "boolean",
  discount: "when inStock=true *? number(0,100)? : =0",
  maxQuantity: "when inStock=true *? int(1,1000) : int(1,10)",
});

Documentation

Getting Started

Core Concepts

Advanced Features

Reference

Common Use Cases

Form Validation

const FormSchema = Interface({
  email: "email! --> Please enter a valid email",
  password: "string(8,)! --> Password must be at least 8 characters",
  confirmPassword: "string --> Passwords must match",
  terms: "boolean! --> You must accept the terms",
});

API Request Validation

const APIRequestSchema = Interface({
  method: "GET|POST|PUT|DELETE",
  endpoint: "url",
  headers: "record<string, string>",
  body: "object?",
});

E-Commerce Products

const ProductSchema = Interface({
  id: "uuid",
  name: "string(3,100)",
  price: "number(0.01,) --> Price must be greater than 0",
  category: "electronics|clothing|food",
  inStock: "boolean",
  discount: "when inStock=true *? number(0,100)? : =0",
});

User Management

const UserSchema = Interface({
  id: "uuid",
  email: "email!",
  role: "admin|user|guest",
  permissions: "when role=admin *? string[] : =[]",
  maxProjects: "when role=admin *? int(1,100) : int(1,3)",
});

VS Code Extension

Enhance your development workflow with professional IDE integration:

  • Syntax Highlighting - Comprehensive highlighting for schema types
  • IntelliSense - Context-aware autocompletion
  • Hover Documentation - Inline documentation and examples
  • Error Detection - Real-time schema syntax validation
  • Code Snippets - Pre-built templates for common patterns

Download Extension | Extension Documentation

Performance

Fortify Schema is optimized for production environments:

  • Fast Validation - Optimized execution paths with schema precompilation
  • Memory Efficient - Minimal overhead per schema instance
  • Scalable - Predictable performance across data complexity levels
  • Benchmarked - Continuous performance monitoring and optimization

Run benchmarks locally:

npm run benchmark
npm run benchmark:nestedObject

View Benchmark Results

Comparison

| Feature | Fortify Schema | Reliant-Type | Zod | Yup | Joi | | ---------------------- | -------------- | ------------ | ------- | ------- | ------- | | Interface-like syntax | Yes | Yes | No | No | No | | Conditional validation | Yes | Enhanced | Limited | No | Limited | | Custom error messages | Yes | Yes | Yes | Yes | Yes | | TypeScript inference | Full | Full | Full | Limited | No | | VS Code extension | Yes | Yes | No | No | No | | Active development | Maintenance | Active | Active | Active | Active | | Bundle size | Small | Small | Medium | Large | Large |

Note: reliant-type represents the evolution of fortify-schema with enhanced capabilities and ongoing development.

Community & Support

Get Help

Contributing

Contributions are welcome. Please review our Contributing Guide before submitting pull requests.

  • Report bugs and request features
  • Submit pull requests
  • Improve documentation
  • Share use cases and feedback

Stay Updated

License

MIT © Nehonix Team

Acknowledgments

Developed by the Nehonix Team with contributions from the open-source community.

Special recognition to:

  • The TypeScript team for language innovation
  • The open-source community for feedback and contributions
  • All contributors and users of Fortify Schema