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

typeweaver

v1.1.3

Published

Stop manually syncing types between your backend and frontend. Auto-generate TypeScript types from your ORM schemas.

Readme

🧵 TypeWeaver

Stop manually syncing types between your backend and frontend.

Auto-generate TypeScript interfaces from your ORM schemas in real-time.

npm version License: MIT


🔥 The Problem

Full-stack TypeScript developers face a daily problem:

// Backend: Update User model
const userSchema = new Schema({
  name: String,
  email: String,
  phoneNumber: String, // ← NEW FIELD
});

// Frontend: Types are now OUT OF SYNC ❌
interface User {
  name: string;
  email: string;
  // Missing phoneNumber!
}

// Result: Runtime bugs that TypeScript should have caught

The consequences:

  • ⏰ 30+ minutes per week manually copying types
  • 🐛 Type mismatches cause production bugs
  • 🔄 Constant context switching between backend/frontend
  • 😤 Forgotten updates slip through code reviews

✨ The Solution

# One-time setup
npx typeweaver init

# Generate types once
npx typeweaver generate

# Or watch mode (auto-sync on every change)
npx typeweaver watch

That's it. Your frontend types stay in sync automatically.


🚀 Quick Start

Run locally (Windows PowerShell)

If you're on Windows and using PowerShell, here are copy/paste-friendly commands:

# install deps
npm install

# interactive setup
npx typeweaver init

# generate types once
npx typeweaver generate

# watch mode
npx typeweaver watch

# run tests
npm test

# run dev CLI
npm run dev

Installation

npm install -D typeweaver

Setup (Interactive)

npx typeweaver init

This creates typeweaver.config.json:

{
  "orm": "prisma",
  "schemaPath": "./prisma/schema.prisma",
  "outputPath": "./types",
  "outputMode": "single"
}

Generate Types

# One-time generation
npx typeweaver generate

# Watch mode (auto-regenerate on changes)
npx typeweaver watch

📋 Features

✅ Supported ORMs

| ORM | Status | Description | | ------------- | -------------- | ------------------------- | | Prisma | ✅ Ready | Parse schema.prisma files | | Mongoose | ✅ Ready | Parse Schema definitions | | TypeORM | 🚧 Coming Soon | Parse decorators | | Sequelize | 🚧 Coming Soon | Parse models |

✨ Key Features

  • Zero Migration - Works with your existing code
  • Real-Time Sync - Watch mode updates types instantly (<500ms)
  • Safe Writes - Automatic backups before overwriting
  • Multi-ORM - Prisma, Mongoose, and more
  • Flexible Output - Single file or one file per model
  • Type-Safe - Handles complex types, enums, arrays, references
  • Smart Detection - Auto-detects your ORM

📖 Usage Examples

Prisma

// schema.prisma
model User {
  id    String @id @default(cuid())
  email String @unique
  name  String
  age   Int?
  posts Post[]
}

model Post {
  id      String @id
  title   String
  content String?
  author  User   @relation(fields: [authorId], references: [id])
  authorId String
}

Generated TypeScript:

// types/index.ts
export interface User {
  id: string;
  email: string;
  name: string;
  age?: number | null;
  posts: string[];
}

export interface Post {
  id: string;
  title: string;
  content?: string | null;
  author: string;
  authorId: string;
}

Mongoose

// models/User.js
const userSchema = new Schema({
  name: { type: String, required: true },
  email: { type: String, required: true },
  age: Number,
  role: { type: String, enum: ["user", "admin"] },
  posts: [{ type: Schema.Types.ObjectId, ref: "Post" }],
});

Generated TypeScript:

// types/index.ts
export interface User {
  name: string;
  email: string;
  age?: number | null;
  role: "user" | "admin";
  posts: string[];
}

⚙️ Configuration

Config File (typeweaver.config.json)

{
  "orm": "auto",
  "modelsPath": "./models",
  "schemaPath": "./prisma/schema.prisma",
  "outputPath": "./types",
  "outputMode": "single",
  "watch": false,
  "includeComments": true,
  "exclude": ["**/node_modules/**", "**/*.test.{js,ts}"]
}

Configuration Options

| Option | Type | Default | Description | | ----------------- | -------- | -------------------------- | ---------------------------------------- | | orm | string | "auto" | ORM to use: auto, prisma, mongoose | | modelsPath | string | "./models" | Path to Mongoose models | | schemaPath | string | "./prisma/schema.prisma" | Path to Prisma schema | | outputPath | string | "./types" | Where to generate types | | outputMode | string | "single" | single file or separate files | | watch | boolean | false | Enable watch mode | | includeComments | boolean | true | Include JSDoc comments | | readonly | boolean | false | Generate readonly properties | | exclude | string[] | [] | Files to exclude |


🖥️ CLI Commands

init

Initialize configuration with interactive prompts.

npx typeweaver init

Options:

  • --force - Overwrite existing config

generate

Generate types once from your schemas.

npx typeweaver generate

Options:

  • --config <path> - Custom config file path
  • --output <path> - Override output path
  • --dry-run - Preview without writing
  • --verbose - Show detailed output

watch

Watch schemas and auto-generate types on changes.

npx typeweaver watch

Options:

  • --config <path> - Custom config file path
  • --output <path> - Override output path

verify

Verify types are in sync with schemas (great for CI/CD).

npx typeweaver verify

info

Show current configuration.

npx typeweaver info

clean

Remove all generated type files.

npx typeweaver clean

Options:

  • --dry-run - Preview files to be deleted

🎯 Use Cases

1. MERN Stack Development

backend/
  models/
    User.js
    Post.js
  typeweaver.config.json

frontend/
  types/  ← Auto-generated
    index.ts

2. Monorepo with Multiple Frontends

{
  "orm": "prisma",
  "schemaPath": "./backend/schema.prisma",
  "outputPath": [
    "../web-app/src/types",
    "../mobile-app/src/types",
    "../admin-dashboard/src/types"
  ]
}

3. API Development

Generate types for your TypeScript SDK:

api/
  schema.prisma
  typeweaver.config.json → outputs to sdk/types/
sdk/
  types/
    index.ts  ← Auto-generated

🔧 Advanced Usage

Custom Type Mapping

{
  "customTypeMap": {
    "ObjectId": "string",
    "Mixed": "Record<string, any>"
  }
}

Multiple Output Paths

{
  "outputPath": ["./frontend/types", "./mobile/types"]
}

Exclude Patterns

{
  "exclude": ["**/node_modules/**", "**/*.test.js", "**/deprecated/**"]
}

🆚 Comparison

| Solution | Zero Migration | Real-Time | No Stack Lock-in | Setup Time | | ------------------- | --------------------- | --------------------- | ---------------- | ---------- | | typeweaver | ✅ | ✅ (<500ms) | ✅ | <1 min | | GraphQL Codegen | ❌ (Requires GraphQL) | ⚠️ (Slow) | ❌ | Weeks | | tRPC | ❌ (Full rewrite) | ✅ | ❌ | Days | | Manual npm packages | ✅ | ❌ (10+ min) | ✅ | Hours | | Monorepo sharing | ⚠️ (Complex) | ⚠️ (Requires rebuild) | ✅ | Days |


🤝 Contributing

Contributions are welcome! See CONTRIBUTING.md.

Development Setup

# Clone repo
git clone https://github.com/yourusername/type-bridge.git
cd type-bridge

# Install dependencies
npm install

# Run tests
npm test

# Test CLI locally
node bin/typeweaver.js generate --help

📝 License

MIT © TypeWeaver Contributors


🙏 Acknowledgments

  • Inspired by the pain of manual type synchronization
  • Built for the full-stack TypeScript community
  • Thanks to all contributors and early adopters

📞 Support


🗺️ Roadmap

✅ v1.0.0 (Current - November 2025)

  • ✅ Prisma support
  • ✅ Mongoose support
  • ✅ Circular reference detection
  • ✅ Nested object support
  • ✅ Verification command
  • ✅ Better type mappings
  • ✅ Production ready!

v1.1.0 (Planned)

  • [ ] Custom type mappings configuration
  • [ ] Field transformations (removeFields, renameFields)
  • [ ] Better error messages with line numbers

v1.2.0 (Planned)

  • [ ] DTO generation (CreateDto, UpdateDto, ResponseDto)
  • [ ] TypeORM support
  • [ ] Sequelize support

v1.3.0+ (Future)

  • [ ] Zod schema generation
  • [ ] GraphQL schema generation
  • [ ] React Query hooks generation
  • [ ] tRPC router generation
  • [ ] VS Code extension

Made with ❤️ for full-stack TypeScript developers

Stop wasting time on type synchronization. Start using typeweaver today! 🚀