TypeSwitch is a suite of local CLI utilities that automatically convert Prisma schemas to Drizzle ORM and OpenAI SDK calls to Anthropic Claude. You provide your API key, the tools handle everything else.
Select a migrator CLI utility below to view a recreation of its terminal execution.
Select a source file from the editor sidebar, click "Transpile", and witness the AST translation in real-time.
Each tool is a standalone TypeScript project you run with npx.
You purchase the source code — not a subscription, not a binary.
Converts Prisma schema files to Drizzle ORM TypeScript schemas, and rewrites PrismaClient query calls into Drizzle relational queries throughout your codebase.
pgTable definitions
@prisma/client → drizzle-orm packages
Scans your codebase for OpenAI SDK import references and rewrites them to use the Anthropic Claude SDK, including chat completions and embeddings.
chat.completions → Anthropic messages
openai → @anthropic-ai/sdk packages
We are actively developing additional migration modules. All license holders will receive these tools as free updates once compiled.
These are actual input/output examples from the CLI tools.
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
export async function getActiveUsers() {
return await prisma.user.findMany({
where: { role: "USER" },
include: { posts: true },
});
}
export async function createUser(email: string, name: string) {
return await prisma.user.create({
data: { email, name, role: "USER" },
});
}
import { eq } from "drizzle-orm";
import { db } from "@/db";
import { users } from "@/db/schema";
export async function getActiveUsers() {
return await db.query.users.findMany({
where: eq(users.role, "USER"),
with: { posts: true },
});
}
export async function createUser(email: string, name: string) {
return await db.insert(users).values({
email, name, role: "USER",
}).returning();
}
import OpenAI from "openai";
const openai = new OpenAI();
export async function askAssistant(prompt: string) {
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: prompt }
],
temperature: 0.7,
});
return response.choices[0]?.message?.content;
}
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic();
export async function askAssistant(prompt: string) {
const response = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 8192,
system: "You are a helpful assistant.",
messages: [
{ role: "user", content: prompt }
],
});
return response.content[0].text;
}
Run the CLI, point it at your project directory, and let it handle the rest.
Walks your project tree and identifies files with SDK imports or ORM references.
Copies every target file to .migration-backup/ before making changes.
Parses AST, builds contextual prompts, and rewrites each file using your LLM API key.
Swaps packages in package.json, generates auxiliary scripts, done.
You buy the TypeScript source code. No subscriptions, no tokens, no lock-in. LLM API costs are yours — typically under $2 per migration.
No. Both tools run entirely on your machine. Your files are read locally and sent directly to OpenAI or Anthropic's API using your own keys. We never see, store, or relay your code.
Every file is backed up before changes. Run the tool with --rollback to restore everything instantly. The output handles 90–95% of typical codebases cleanly; edge cases (raw SQL, complex middleware) may need manual review.
You do — directly to OpenAI or Anthropic. You provide your own API key. For a typical project, token cost is under $2 total.
Yes. You buy the full TypeScript source code. Open sdk-transpiler.ts or prisma-to-drizzle.ts and edit the prompt templates to match your coding standards.
Schema conversion is fully automated. Query conversion handles standard patterns (findMany, create, update, delete with relations). Complex patterns like raw SQL queries, Prisma middleware, or deeply nested transactions may need manual adjustment — the tool does the heavy lifting so you focus only on edge cases.