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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rapidd/build

v1.2.2

Published

Dynamic code generator that transforms Prisma schemas into Express.js CRUD APIs with PostgreSQL RLS-to-JavaScript translation

Readme

@rapidd/build

Dynamic code generator that transforms Prisma schemas into complete Express.js CRUD APIs with intelligent PostgreSQL RLS-to-JavaScript translation.

Features

  • 🚀 Automatic CRUD API Generation - Creates Express.js routes from Prisma models
  • 🔒 RLS Translation - Converts PostgreSQL Row-Level Security policies to JavaScript/Prisma filters (ACL: Access Control Layer)
  • 🎯 Dynamic & Schema-Aware - Zero hardcoding, adapts to any database structure
  • 🔗 Relationship Handling - Supports 1:1, 1:n, n:m including junction tables
  • 👥 Role-Based Access Control - Properly handles role checks in filters
  • 📊 Model Generation - Creates CRUD model classes with capitalized filenames
  • 🗺️ Relationships JSON - Generates complete relationship mappings with foreign keys
  • Selective Generation - Update only specific models or components

Requirements

  • Prisma 7+ (recommended) - Full support for Prisma 7's new architecture
  • Node.js 14.0.0 or higher

Installation

npm install @rapidd/build

Quick Start

# Generate everything in current directory (default)
npx rapidd build

# Generate in specific directory
npx rapidd build --output ./generated

# Generate only specific model
npx rapidd build --model user

# Generate only specific component
npx rapidd build --only model
npx rapidd build --only route
npx rapidd build --only acl
npx rapidd build --only relationship

# Combine model and component filters
npx rapidd build --model account --only route

# Specify custom user table
npx rapidd build --user-table accounts

CLI Options

  • -o, --output <path> - Output directory (default: ./)
  • -s, --schema <path> - Prisma schema file (default: ./prisma/schema.prisma)
  • -m, --model <name> - Generate/update only specific model (e.g., "account", "user")
  • --only <component> - Generate only specific component: "model", "route", "acl", or "relationship"
  • --user-table <name> - User table name for ACL (default: auto-detected)

Selective Generation

Update Single Model

# Update only the account model across all components
npx rapidd build --model account

This will:

  • Generate/update src/Model/Account.js
  • Generate/update routes/api/v1/account.js
  • Update the account entry in rapidd/relationships.json
  • Update the account entry in rapidd/acl.js

Update Single Component

# Regenerate all routes
npx rapidd build --only route

# Regenerate all ACL configs
npx rapidd build --only acl

# Regenerate all models
npx rapidd build --only model

# Regenerate relationships
npx rapidd build --only relationship

Combine Filters

# Update only the route for a specific model
npx rapidd build --model user --only route

# Update ACL for account model
npx rapidd build --model account --only acl

Generated Structure

./
├── src/Model/
│   ├── User.js
│   ├── Post.js
│   └── ...
├── routes/
│   ├── user.js
│   ├── post.js
│   └── ...
└── rapidd/
    ├── acl.js
    ├── relationships.json
    └── rapidd.js

ACL Translation Example

PostgreSQL Policy:

CREATE POLICY user_policy ON posts
  FOR SELECT
  USING (author_id = current_user_id() OR current_user_role() IN ('admin', 'moderator'));

Generated JavaScript:

getAccessFilter: (user) => {
  if (['admin', 'moderator'].includes(user?.role)) return {};
  return { author_id: user?.id };
}

Use Cases

During Development

# After adding a new model to schema
npx rapidd build --model newModel

# After changing relationships
npx rapidd build --only relationship

# After updating RLS policies
npx rapidd build --only acl

Continuous Integration

# Full rebuild for CI/CD
npx rapidd build --output ./generated

Incremental Updates

# Update specific model after schema changes
npx rapidd build --model user --only model
npx rapidd build --model user --only acl

Migration from Prisma 6 to 7

If you're upgrading from Prisma 6, this package now automatically:

  1. Uses @prisma/internals for DMMF access (no longer relies on generated client)
  2. Reads database URL from multiple sources in order:
    • prisma.config.ts (Prisma 7 default)
    • Schema file datasource.url (Prisma 5/6 style)
    • DATABASE_URL environment variable
  3. Maintains full compatibility - no changes needed to your workflow

Simply update your dependencies and rebuild:

npm install @rapidd/build@latest
npm install prisma@^7.0.0 @prisma/client@^7.0.0
npx rapidd build

For more details on Prisma 7 migration, see the official Prisma upgrade guide.

License

MIT