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

nodejs-typescript-express-prisma

v1.6.1

Published

A template for Node.js and Express with Prisma setup

Readme

Node.js Express CRUD Template

This project template provides a Node.js TypeScript setup with Express, Prisma, and jsonwebtoken (JWT) for authentication. It includes an out-of-the-box CRUD setup and allows the generation of additional routes, controllers, and services for new database tables.

Getting Started

To start a new project using this template, run:

npx nodejs-typescript-express-prisma

Setup Instructions

Upon initialization, you will be prompted to provide specific project configurations:

  1. Roles: Specify any custom roles you'd like to add, in addition to the default ADMIN role already configured in the schema. List roles in a comma-separated format, e.g., ROLE1,ROLE2,....

  2. Environment Variables: You will be prompted to set up the following environment variables:

    • NODE_ENV: Environment (development/production)
    • PORT: The port number to run the Express server
    • JWT_SECRET: Secret key for JWT-based authentication (auto-generated)
    • DB_STRING: PostgreSQL connection URI for Prisma
    • HOST: The root URL for the API
    • SMTP_HOST: SMTP server host for email
    • SMTP_PORT: SMTP server port
    • SMTP_USER: SMTP username
    • SMTP_PASS: SMTP password
    • CORS_ORIGIN: Allowed CORS origins
    • API_RATE_LIMIT: Rate limiting per minute

Features

  • ✨ Interactive CLI for CRUD operations
  • 🔒 JWT Authentication with role-based access
  • 📝 OpenAPI/Swagger documentation
  • 🚀 TypeScript support
  • 🗄️ Prisma ORM with PostgreSQL
  • ✅ Input validation with Joi
  • 🔍 Error handling middleware
  • 📧 Email integration
  • 🔄 API rate limiting
  • 🌐 CORS support
  • 📊 API monitoring

CRUD Operations

Generate New Module

yarn crud:generate

This interactive tool will guide you through:

  1. Entity name selection
  2. Field definitions with types
  3. Generation of:
    • Controller with OpenAPI docs
    • Service layer
    • Routes
    • Validation schemas
    • TypeScript interfaces

Delete Existing Module

yarn crud:delete

This will:

  1. Show existing modules
  2. Remove selected files
  3. Clean up routes
  4. Update documentation

Available Field Types

  • string: String data type
  • int: Integer data type
  • date: Date with timestamp
  • double: Double/Float data type
  • boolean: Boolean data type
  • id: UUID primary key
  • fid: UUID foreign key
  • array: JSON array
  • object: JSON object
  • text: Text data type

API Documentation

Documentation is automatically generated and available at:

  • Interactive UI: http://localhost:3000/api-docs
  • Raw OpenAPI spec: http://localhost:3000/api-docs.json

Default Schema

model User {
  id            String         @id @default(cuid())
  name          String?        @db.VarChar(255)
  password      String?        @db.VarChar(255)
  email         String?        @unique @db.VarChar(255)
  phoneNumber   String?        @default("0600000000") @map("phone_number") @db.VarChar(255)
  role          UserRolesEnum? @default(ADMIN)
  createdAt     DateTime       @default(now()) @map("created_at")
  updatedAt     DateTime       @updatedAt @map("updated_at")
  @@map("users")
}

enum UserRolesEnum {
  ADMIN
}

Project Structure

src/
├── config/         # Configuration files
├── controllers/    # Route controllers
├── docs/          # API documentation
│   ├── swagger.ts # Swagger configuration
│   └── *.yml     # API specifications
├── middlewares/    # Custom middlewares
├── routes/         # API routes
├── services/      # Business logic
├── utils/         # Utility functions
└── index.ts       # Application entry point

Scripts

{
  "scripts": {
    "dev": "nodemon -r tsconfig-paths/register src/index.ts",
    "build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
    "start": "node dist/index.js",
    "crud:generate": "ts-node ./scripts/crud-creation.ts",
    "crud:delete": "ts-node ./scripts/crud-deletion.ts",
    "init:prisma": "ts-node ./scripts/init-prisma.ts",
    "prisma:generate": "prisma generate",
    "prisma:migrate": "prisma migrate dev",
    "prisma:studio": "prisma studio"
  }
}

Requirements

  • Node.js v18 or higher
  • PostgreSQL
  • Yarn or npm