Introducing Prisma Standalone Types: Copy Your Database Types Anywhere
Generate clean, dependency-free TypeScript interfaces from your Prisma schema

📚 Get Practical Development Guides
Join developers getting comprehensive guides, code examples, optimization tips, and time-saving prompts to accelerate their development workflow.
Related Posts:
I had a problem. I was working with Prisma across multiple projects and needed to share database types between them. The regular Prisma client comes with all its dependencies and runtime overhead. What I really wanted was just the clean TypeScript interfaces I could copy anywhere.
The Problem
When you use Prisma, you get fantastic type safety. But those types are tied to the Prisma client. If you want to use the same types in:
- Your frontend React app
- A separate microservice
- A shared utility library
- Another project entirely
You're stuck. You either duplicate type definitions manually or import the entire Prisma client just for types. Neither solution felt right.
The Solution
I built prisma-standalone-types
. It generates clean TypeScript interfaces from your Prisma schema with zero dependencies. You can copy these types anywhere and they just work.
Here's what it does:
- Reads your existing Prisma schema
- Generates JSON Schema using prisma-json-schema-generator
- Converts that to clean TypeScript interfaces
- Outputs a file you can copy to any project
Example
Your Prisma schema:
enum UserRole { ADMIN USER } model User { id String @id @default(uuid()) name String email String? role UserRole @default(USER) createdAt DateTime @default(now()) }
Generated output:
export enum UserRole {
ADMIN = 'ADMIN',
USER = 'USER',
}
export interface User {
id: string;
name: string;
email?: string | null;
role: UserRole;
createdAt: Date;
}
Perfect. Clean. No dependencies.
How to Use It
Install the package:
npm install --save-dev prisma-standalone-types
Make sure your prisma/schema.prisma
includes the JSON schema generator:
generator jsonSchema { provider = "prisma-json-schema-generator" output = "../types" }
Generate your types:
npx prisma-standalone-types --output types/database.ts
That's it. Copy the generated file anywhere you need those types.
Why This Matters
Type safety shouldn't stop at project boundaries. With standalone types, you can:
- Share types between frontend and backend
- Use the same types in multiple microservices
- Keep types in sync across your entire stack
- Avoid runtime dependencies when you just need types
The generated files are completely self contained. No imports, no dependencies, just pure TypeScript interfaces you can use anywhere.
Get Started
The package is available on npm and the source code is on GitHub.
Links:
- npm: https://www.npmjs.com/package/prisma-standalone-types
- GitHub: https://github.com/matija2209/prisma-standalone-types
- Documentation: Full README with examples and options
I built this because I needed it. Hopefully it solves the same problem for you. The package handles all the complex JSON Schema to TypeScript conversion automatically. You just run one command and get clean, copyable types.
Try it out and let me know what you think. Issues and contributions welcome on GitHub.
Built with ❤️ for the Prisma community