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

nodearchgen

v2.0.3

Published

A CLI tool to generate a Node.js project with custom architecture.

Readme

NodeJS Project Generator

A CLI tool to generate a Node.js project with a custom architecture using Express and Prisma. The generated project follows domain-driven design (DDD) principles and Clean Architecture patterns, ensuring maintainability, scalability, and testability.

Features

  • Custom Architecture: Generates a project structure based on domain-driven design (DDD) and Clean Architecture principles.
  • Express Integration: Pre-configured with Express for building web applications.
  • Prisma ORM: Integrates Prisma as an ORM for database interactions.
  • Essential Middleware: Includes essential middleware like Helmet for security and Winston for logging.
  • Error Handling: Provides centralized error handling.
  • Environment Configuration: Manages environment variables using dotenv.
  • Testing Setup: Sets up unit, integration, and end-to-end testing directories.
  • Code Quality Tools: Includes ESLint and Prettier for code quality and consistent formatting.

Project Structure

The generated project follows this directory structure:

my-app/
├── src/
│   ├── application/                    //Handles business logic orchestration.
│   │   ├── services/
│   │   └── useCases/
│   ├── domain/                         //Contains core business logic and concepts.
│   │   ├── entities/
│   │   ├── repositories/
│   │   └── valueObjects/
│   ├── infrastructure/                 //Manages external dependencies and implementations of interfaces defined in other layers.
│   │   ├── config/
│   │   ├── database/
│   │   │   └── prismaClient.js
│   │   ├── http/
│   │   ├── logging/
│   │   │   └── logger.js
│   │   └── repositories/
│   ├── interfaces/                    //Defines how the outside world interacts with your application.
│   │   ├── controllers/
│   │   ├── dtos/
│   │   ├── middleware/
│   │   │   └── errorHandler.js
│   │   ├── routes/
│   │   │   └── index.js
│   │   └── validators/
│   └── utils/                         //Utility functions and classes.
│       ├── errors/
│       │   └── AppError.js
│       └── helpers/
├── tests/                             //The project includes directories for unit, integration, and end-to-end tests.
│   ├── unit/
│   ├── integration/
│   └── e2e/
├── .env
├── .env.example
├── .eslintrc.js
├── .prettierrc
├── package.json
├── README.md
└── index.js

Getting Started

Prerequisites

  • Node.js >= 20.X
  • npm or yarn or pnpm

Installation

  1. install the generator globally

    npm install -g nodearchgen
  2. Generate a new project

    npx nodearchgen
  3. follow the prompt to enter the project name and description

Next Steps

after generating the project, follow these steps to set it up:

  1. Navigate to the project directory

    cd <project-name>
  2. Navigate to the project directory

    npm install
  3. Generate Prisma Client

    after modifing the schema.prisma file and DATA_BASE_URL use this command

    npx prisma generate
  4. Start the server

    npm start

    Alternatively, for development purposes, you can use:

    npm run dev

Running Migrations

to apply migrations to your database run :

npx prisma migrate dev --name init

Using Prisma Studio

npx prisma studio

Project Architecture

Domain Layer

Contains core business logic and concepts.

  • Entities: Represents core business objects and their behavior.
  • Repositories: Interfaces for data access.
  • Value Objects: Immutable objects representing values or concepts within the domain.

Application Layer

Handles business logic orchestration.

  • Services: Business services that coordinate domain logic and infrastructure concerns.
  • Use Cases: Specific workflows supported by the application.

Infrastructure Layer

Manages external dependencies and implementations of interfaces defined in other layers.

  • Config: Configuration files for various environments.
  • Database: Database connection setup, migrations, etc.
  • HTTP: HTTP clients or utilities.
  • Logging: Logging utilities.
  • Repositories: Implementations of repository interfaces defined in the domain layer.

Interfaces Layer

Defines how the outside world interacts with your application.

  • Controllers: Handle incoming HTTP requests, delegate work to the application layer, and return responses.
  • DTOs: Data Transfer Objects used to transfer data between layers.
  • Middleware: Centralized middleware such as authentication, authorization, and error handling.
  • Routes: Define routing logic for API endpoints.
  • Validators: Validation logic for incoming requests.

Utilities Layer

Utility functions and classes.

  • Errors: Custom error classes for better error handling.
  • Helpers: General-purpose helper functions.

Testing

The project includes directories for unit, integration, and end-to-end tests. You can add your test cases in these directories:

  • tests/unit/
  • tests/integration/
  • tests/e2e/

Code Quality

The project includes ESLint and Prettier for maintaining code quality and consistent formatting.

  • ESLint: Lints your JavaScript code.
  • Prettier: Formats your code according to predefined rules.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Troubleshooting

Common Issues

Prisma Client Not Initialized

if you encounter the following error:

@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.

Run the following command to generate the Prisma client:

npx prisma generate

Missing .env File

Ensure that the .env file exists and contains the correct database connection string. Update the .env file with the appropriate credentials.

Example .envcontent:

DATABASE_URL=postgresql://user:password@localhost:5432/mydb

Support

if you have any questions or need assistance, feel free to open an issue on Github.