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

node-prisma-structure

v1.1.2

Published

A Node.js API structure using Prisma ORM for scalable and modular development. This package includes a complete authentication API (signup, login, logout, password reset, and token-based authentication) and provides a well-organized directory structure fo

Downloads

47

Readme

node-prisma-structure

The node-prisma-structure npm package is designed to simplify the setup of authentication APIs in your project. It allows you to quickly copy a predefined project structure, install all the required dependencies, and get your project up and running. This package is particularly useful for creating projects with a consistent and reusable authentication system.

npm version License

Features

  • Quickly sets up a predefined project structure for authentication APIs.
  • Automatically installs all required dependencies.
  • Supports Prisma for database handling.
  • Saves time and ensures consistency across projects.
  • Provides a ready-to-run setup.

How to Install

To install the package, run the following command:

  npm i node-prisma-structure

or

  yarn i node-prisma-structure

How to Publish

After installing the package, follow these steps:

  • Run the following command to copy the project structure and API files into your project:
  npx create-prisma-structure
  • Set up your .env file:
    • Add the necessary environment variables required for your project.
    • Ensure the DATABASE_URL for Prisma is properly configured.

How to configure

Generate Prisma client:

Run the following Prisma command to generate the client:

  npx prisma generate

Publish Prisma Database:

Run the following Prisma command to publish database:

  npx prisma migrate dev

Import necessary libraries

In your main run file (e.g., index.js, server.js, app.js, etc.), you need to import the required modules:

// Load environment variables
require("dotenv").config(); // Add this line if not present

// Import necessary libraries
const express = require('express');
const { createDoc } = require('node-api-document');
const apiDoc = require('./api-doc');
const apiPath = require('./modules/api');

Configure Express

Create an instance of express and configure it:

const app = express();

API Configuration

Next, configure the middleware for parsing incoming requests:

// API Config
app.use(express.json()); // Parse JSON request bodies
app.use(express.text()); // Parse text request bodies

Set Up API Routes

Map your API paths to the express application:

// Auth API Path Mapping
app.use('/v1/', apiPath);

Add API Documentation (Optional)

You can also generate API documentation using node-api-document. Set it up like this:

// API Documentation mapping
createDoc(app, 'api-key, token, accept-language, z-user-ip', apiDoc);

Full Code Example

Here is the full code for the main file to use the authentication API:

require("dotenv").config(); // Add this line if not present
const express = require('express');
const { createDoc } = require('node-api-document');
const apiDoc = require('./api-doc');
const apiPath = require('./modules/api');
const app = express();

// API Config
app.use(express.json());  // Parse JSON request bodies
app.use(express.text());  // Parse text request bodies

// Auth API Path Mapping
app.use('/v1/', apiPath);

// API Documentation mapping
createDoc(app, 'api-key, token, accept-language, z-user-ip', apiDoc);

// Start the server
app.listen(process.env.PORT || 3000, () => {
    console.log('Server running on port 3000');
});

Setup Sentry for Error Monitoring

To set up Sentry for error tracking, run the following command:

npx @sentry/wizard@latest -i sourcemaps

Start your project

  • If nodemon is installed, use the following command to start the project:
  nodemon index.js
  • If nodemon is not installed, start the project with:
  node index.js

🔖 Notes

  • Ensure that your .env file is properly configured with the correct database URL and API keys for seamless integration.
  • The createDoc function automatically generates API documentation based on your API's main path. Once set up, the documentation can be accessed at the following endpoint: http://localhost:3000/api-doc/.
  • You can customize the port number in the app.listen() method to suit your project’s configuration.

📌 Prerequisites

  • Node.js: Ensure you have Node.js installed on your system with version 20.12.0 or higher.
  • Prisma: Make sure you have Prisma configured for database handling.
  • Environment Variables: Properly configure the .env file as per your project requirements.

🤝 Contributing

Feel free to submit issues or pull requests for new features, bug fixes, or general improvements.

🔗 Author Details

portfolio linkedin

License

MIT