• Home
BuildWithMatija
Get In Touch
  1. Home
  2. Blog
  3. Tools
  4. Introducing Prisma Standalone Types: Copy Your Database Types Anywhere

Introducing Prisma Standalone Types: Copy Your Database Types Anywhere

Generate clean, dependency-free TypeScript interfaces from your Prisma schema

17th September 2025·Updated on:17th September 2025·MŽMatija Žiberna·
Tools
Introducing Prisma Standalone Types: Copy Your Database Types Anywhere

📚 Get Practical Development Guides

Join developers getting comprehensive guides, code examples, optimization tips, and time-saving prompts to accelerate their development workflow.

No spam. Unsubscribe anytime.

Related Posts:

  • •Export Your Deezer Playlist for Free – No Tools Required!
  • •Introducing pgdock: A Modern CLI for PostgreSQL Docker Management
  • •Introducing image-filename-ai: AI-Powered Image Organization for Developers
  • •New Open Source Tool: Shopify Image Downloader

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:

  1. Reads your existing Prisma schema
  2. Generates JSON Schema using prisma-json-schema-generator
  3. Converts that to clean TypeScript interfaces
  4. 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

📄View markdown version
3

Comments

Leave a Comment

Your email will not be published

Stay updated! Get our weekly digest with the latest learnings on NextJS, React, AI, and web development tips delivered straight to your inbox.

10-2000 characters

• Comments are automatically approved and will appear immediately

• Your name and email will be saved for future comments

• Be respectful and constructive in your feedback

• No spam, self-promotion, or off-topic content

Matija Žiberna
Matija Žiberna
Full-stack developer, co-founder

I'm Matija Žiberna, a self-taught full-stack developer and co-founder passionate about building products, writing clean code, and figuring out how to turn ideas into businesses. I write about web development with Next.js, lessons from entrepreneurship, and the journey of learning by doing. My goal is to provide value through code—whether it's through tools, content, or real-world software.

You might be interested in

Export Your Deezer Playlist for Free – No Tools Required!
Export Your Deezer Playlist for Free – No Tools Required!

3rd April 2025

Introducing pgdock: A Modern CLI for PostgreSQL Docker Management
Introducing pgdock: A Modern CLI for PostgreSQL Docker Management

13th August 2025

Introducing image-filename-ai: AI-Powered Image Organization for Developers
Introducing image-filename-ai: AI-Powered Image Organization for Developers

24th August 2025

New Open Source Tool: Shopify Image Downloader
New Open Source Tool: Shopify Image Downloader

11th June 2025

Table of Contents

  • The Problem
  • The Solution
  • Example
  • How to Use It
  • Why This Matters
  • Get Started
On this page:
  • The Problem
  • The Solution
  • Example
  • How to Use It
  • Why This Matters
Build With Matija Logo

Build with Matija

Matija Žiberna

I turn scattered business knowledge into one usable system. End-to-end system architecture, AI integration, and development.

Quick Links

Payload CMS Websites
  • Bespoke AI Applications
  • Projects
  • How I Work
  • Blog
  • Payload CMS

    • Migration
    • Pricing

    Get in Touch

    Have a project in mind? Let's discuss how we can help your business grow.

    Contact me →
    © 2026BuildWithMatija•Principal-led system architecture•All rights reserved