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

frgen

v0.4.2

Published

helper generator

Readme

🧰 FRGEN and Regen — CLI CRUD Generator

Backend

frgen is a Command Line Tool that automatically generates boilerplate files such as models, controllers, services, validations, and resources based on your database table structure.


📦 Installation

npm install frgen --save-dev

⚙️ General Options

| Option | Description | Example | |--------|--------------|----------| | --table=<table_name> | The table name used as the generation base | --table=users | | --schema=<schema_name> | (Optional) Database schema, default public | --schema=my_schema | | --path=<output_folder> | (Optional) Output file path | --path=modules/user | | --prisma | Use Prisma ORM | --prisma | | --pg | Use PostgreSQL client | --pg | | --mysql | Use MySQL client | --mysql |


🧩 Available Actions

1. make:model

Generates a model file based on the database table structure.

npx frgen make:model --table=users --schema=public

Process:

  • Reads the table structure from the database
  • Generates a PascalCase model name
  • Saves it in the default path or the specified --path

2. make:resource

Generates a resource file (usually a DTO or response mapper).

npx frgen make:resource --table=products

3. make:controller

Generates a complete set of files including:

  • Controller
  • Service
  • Validation
  • Resource
npx frgen make:controller --table=users --path=modules/users

Steps performed:

  1. generateController()
  2. generateService()
  3. generateValidation()
  4. generateContent()

4. make:crud

Generates a full CRUD structure at once, including:

  • Model
  • Controller
  • Service
  • Validation
  • Resource
npx frgen make:crud --pg --schema=public

Use this to generate the full CRUD boilerplate automatically.


5. make:validation

Generates an automatic validation file based on table structure.

npx frgen make:validation --table=orders

6. make:service

Generates a service layer file for business logic.

npx frgen make:service --table=users --path=modules/users

🧠 Internal Explanation

Key Variables

| Variable | Description | |-----------|--------------| | action | Main command (make:model, make:crud, etc.) | | tableName | Target table name | | _path | Output path for generated files | | schema | Database schema (default: public) | | client | Database client (pg or mysql) | | prisma | Boolean, whether Prisma ORM is used | | pool | Active database connection |


Execution Flow of frgen

  1. Parse CLI arguments
  2. Set DB_CLIENT according to the option (pg or mysql)
  3. Create a database connection using db.createPool()
  4. Check database connectivity with checkDatabaseConnection()
  5. Execute action based on the command:
    • make:modelgenerateModelContent()
    • make:controllergenerateController(), generateService(), etc.
    • make:crudgenerateAll()
  6. Close the database connection (pool.end() / pool.releaseConnection())

💡 Full Examples

PostgreSQL

npx frgen make:controller --table=users --schema=public --pg --path=modules/users

MySQL

npx frgen make:crud --mysql --path=modules/user

With Prisma

npx frgen make:service --table=products --path=modules/products --prisma

🧱 Internal Dependencies

| File | Description | |------|--------------| | ./db.js | Database connection utility | | ./utils.js | Utility functions: checkDatabaseConnection, removePluralSuffix, toPascalCase | | ./make:model.js | Model generator | | ./make:controller.js | Controller generator | | ./make:service.js | Service generator | | ./make:validation.js | Validation generator | | ./make:resource.js | Resource generator | | ./make:crud.js | Full CRUD generator |


🧨 Error Handling

| Error Message | Cause | |----------------|--------| | ❌ action undefined. | No command provided | | ❌ table undefined. | Table name missing | | ❌ ERROR: | Internal error (e.g. DB connection failure) |


regen CLI Tool

Frontend

regen is a Node.js-based code generator designed to create pages, forms, routes, services, validation schemas (Zod), dummy data, and TypeScript definitions based on a JSON Schema file. It supports customizable templates and MUI components.


Converting Prisma Schema to JSON Schema

If you are working with Prisma, you can automatically convert your Prisma schema into a JSON Schema using the following package:

🔗 https://www.npmjs.com/package/prisma-json-schema-generator

Steps

1. Install the generator

npm install -D prisma-json-schema-generator

2. Add the generator configuration to your schema.prisma

generator jsonSchema {
  provider              = "prisma-json-schema-generator"
  includeRequiredFields = "true"
}

This setup enables Prisma to generate a well-structured JSON Schema based on your models.
You can then use the generated schema with the regen CLI to automate creation of pages, forms, services, validations, and more.

📦 Installation

You can run it directly using npx:

npx regen <action> [options]

🚀 Usage

Basic Command Format

npx regen <action> [options]

🛠 Available Actions

1. make:page

Generates all pages and services for every definition inside json-schema.json.

This includes:

  • Service file
  • Validation file
  • Form component
  • Index page
  • Create page
  • Update page
  • View page
  • Dummy data
  • TypeScript definitions
npx regen make:page

2. make:dummy

Generates only dummy data based on schema.

npx regen make:dummy

3. make:route

Generates route file for all schema definitions.

npx regen make:route

4. make:validation

Generates validation files only.

npx regen make:validation

5. make:form

Generates form components only.

npx regen make:form

6. --help

Shows help message.

npx regen --help

⚙ Options

--file=<path>

Specify JSON schema file.

Default: ./json-schema.json

npx regen make:page --file=./schema/user.json

--mui

Use MUI templates (default).

npx regen make:page --mui

Custom Template Options

| Option | Description | |--------|-------------| | --index-template=<path> | Custom index page template | | --form-template=<path> | Custom form template | | --view-template=<path> | Custom view template | | --create-template=<path> | Custom create page template | | --update-template=<path> | Custom update page template | | --template=<dir> | Directory containing all templates |

Example:

npx regen make:page --template=./custom-templates

This expects:

custom-templates/
  index-template.js
  form-template.js
  view-template.js
  create-template.js
  update-template.js

--ignore=<templates>

Comma-separated list of templates to skip.

Options:

  • create
  • update
  • view
  • form
  • index
  • service
  • validation
  • dummy

Example:

npx regen make:page --ignore=form,view

📂 JSON Schema Requirements

Your json-schema.json must have:

{
  "definitions": {
    "User": {
      "properties": { ... },
      "required": [ ... ]
    }
  }
}

Each key inside definitions is treated as a module to generate.


🛑 Error Handling

Errors will be shown as:

❌ ERROR: <message>

🧾 License

This script is internal & open for customization, and can be modified freely for project needs.