Stop writing types by hand.
Generate TypeScript types and Zod schemas from any data source — JSON, CSV, API URL, OpenAPI, GraphQL — in one command.
$ ▋npm install -D snaptype · Free forever, no account required
Project stats
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.
{
"id": 1,
"name": "Alice Dupont",
"email": "alice@example.com",
"role": "admin",
"createdAt": "2024-01-15T10:30:00Z",
"score": 9.4
}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(),
});id,customer,email,plan,amount
1,Alice,alice@example.com,pro,49.99
2,Bob,bob@example.com,free,0.00
3,Carol,carol@example.com,pro,49.99export interface Order {
id: number;
customer: string;
email: string;
plan: "pro" | "free";
amount: number;
}
export const OrderSchema = z.object({
id: z.number(),
customer: z.string(),
email: z.email(),
plan: z.enum(["pro", "free"]),
amount: z.number(),
});Free vs Pro
Start for free. Upgrade once, keep forever.
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
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.