Free to install · Pro from $6.99 one-time

Stop writing types by hand.

Generate TypeScript types and Zod schemas from any data source — JSON, CSV, API URL, OpenAPI, GraphQL — in one command.

api.github.com → types/user.ts
$ 

npm install -D snaptype · Free forever, no account required

Project stats

Open source on GitHub415153.5k/mo npm downloadsMIT licenseNode 20+ ESM native

One tool, every source.

From a quick JSON file to a full OpenAPI spec — snaptype handles it all in one command.

  • from-json

    JSON file or object → TypeScript interface + Zod schema. Detects nested types, arrays, unions.

  • from-url

    Fetch any JSON endpoint and generate types directly. No download needed.

  • from-csv

    CSV file → typed interface with correct column types inferred from values.

  • from-stdin

    Pipe JSON from any source. Works with curl, cat, or any CLI tool.

  • from-openapi

    OpenAPI / Swagger spec → one typed file per schema. YAML and JSON supported.

  • Pro

    from-graphql

    GraphQL introspection → full TypeScript types for every query and mutation.

  • barrel

    Generate an index.ts that re-exports all types in a folder. One command, clean imports.

  • Pro

    diff --ci

    Detect breaking changes between two versions of your types. Exit code 1 in CI pipelines.

  • Pro

    mock

    Generate realistic mock data from a JSON schema. Useful for tests and Storybook.

  • Pro

    to-zod

    Already have TypeScript interfaces? Convert them to Zod schemas automatically.

  • Pro

    --watch

    Regenerate types automatically on every change to the source file.

  • Smart inference

    Emails, dates, URLs auto-detected. Low-cardinality strings become enums. Nullables handled.

See it in action.

Real input, real output — no configuration needed.

$ snaptype from-json ./user.json --zod -o types/user.ts
user.json
{
  "id": 1,
  "name": "Alice Dupont",
  "email": "alice@example.com",
  "role": "admin",
  "createdAt": "2024-01-15T10:30:00Z",
  "score": 9.4
}
types/user.ts
export interface User {
  id:        number;
  name:      string;
  email:     string;
  role:      "admin" | "user";
  createdAt: string;
  score:     number;
}

export const UserSchema = z.object({
  id:        z.number(),
  name:      z.string(),
  email:     z.email(),
  role:      z.enum(["admin", "user"]),
  createdAt: z.iso.datetime(),
  score:     z.number(),
});

Free vs Pro

Start for free. Upgrade once, keep forever.

Free
Pro$6.99
JSON / URL / CSV / stdin → Types
OpenAPI → Types (YAML & JSON)
Zod v4 schemas
Semantic inference (email, dates, enums)
Barrel generator (index.ts)
.snaptyperc config
Multi-file JSON / URL merge
GraphQL introspection
Breaking change detection (diff)
CI mode — exit 1 on breaking changes
Mock data generator
TypeScript → Zod (to-zod)
Watch mode (--watch)

One-time payment · Lifetime access · All future Pro features included

Simple pricing.

Start free. Pay once. Keep forever.

Free

$0

Always free, no account required

  • JSON, URL, CSV, stdin → Types
  • OpenAPI → Types (YAML & JSON)
  • Zod v4 schemas
  • Semantic inference (email, dates, enums)
  • Barrel generator
  • .snaptyperc config
Best value

Pro

$6.99

one-time

Lifetime access · all future features

  • Everything in Free
  • Multi-file JSON / URL merge
  • GraphQL introspection
  • Breaking change detection
  • CI mode (exit 1 on regression)
  • Mock data generator
  • TypeScript → Zod (to-zod)
  • Watch mode (--watch)

Frequently asked questions

snaptype generates native Zod v4 schemas, detects enums and semantic hints (email, datetime, URL), and supports GraphQL and breaking-change detection. quicktype is more generalist (multi-language); snaptype is optimised for TypeScript/Zod.
No — snaptype targets Zod v4 and uses its API exclusively (z.email(), z.url(), z.string().datetime(), etc.). Zod v3 is not supported.
The free CLI is open source. Pro features are in the same package, unlocked by a licence key.
One-time payment on Lemon Squeezy → licence key by email → run snaptype activate <key> or set the SNAPTYPE_LICENSE_KEY environment variable.
Yes. One-time payment means lifetime access to all versions, including future Pro features.
Yes — snaptype diff --ci exits with code 1 if breaking changes are detected, making it easy to block a PR when your types regress.