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 🙏

© 2024 – Pkg Stats / Ryan Hefner

craftflow

v1.0.5

Published

A CLI tool to generate API files and folder structure

Downloads

336

Readme

Craftflow CLI Tool

Craftflow CLI Tool is a command-line utility designed to streamline the setup of Node.js API projects, ensuring a well-structured and organized codebase. It automates the creation of essential files and folders, enhances code readability, and improves development productivity.

Features

  • Automatically generates controller, DTO, model, route, service, and validation files based on predefined templates.
  • Integrated global error handling to eliminate repetitive try-catch blocks and ensure robust error management.
  • Encourages best practices by enforcing a consistent file structure across projects.
  • Simplifies project initialization and module creation.

Prerequisites

Before using the Craftflow CLI Tool, ensure you have the following installed:

  • Node.js (version 12 or higher)
  • npm (Node Package Manager)

Installation

You can install the Craftflow CLI Tool globally using npm:

npm install -g craftflow

Usage

Initializing a New Project

To initialize a new project with Craftflow:

npx craftflow init

This command sets up the following structure in your project directory:

project-root/
├── src/
│   ├── configs/
│   ├── controllers/
│   ├── dtos/
│   ├── interfaces/
│   ├── mails/
│   ├── middlewares/
│   ├── models/
│   ├── routes/
│   ├── services/
│   ├── utils/
│   └── validations/
├── package.json
└── README.md

Creating a New Module

To create a new module in your project:

npx craftflow create <moduleName>

Replace <moduleName> with the name of your module. For example:

npx craftflow create user-activity

This command generates:

  • controllers/user-activity-controller.ts: Controller methods for handling API requests.
  • dtos/user-activity-dto.ts: DTOs for validating input/output data.
  • models/user-activity-model.ts: Mongoose model schema for MongoDB.
  • routes/user-activity-route.ts: Express routes for module-specific endpoints.
  • services/user-activity-service.ts: Business logic services for the module.
  • validations/user-activity-validation.ts: Validation schemas for input data.

Global Error Handling

Craftflow includes global error handling to ensure robustness and prevent server crashes. Errors are handled centrally, returning a consistent 500 Internal Server Error response with customizable error messages.

Templates

Craftflow uses predefined templates located in the templates directory of the tool's installation. These templates can be customized to suit specific project requirements, promoting code consistency and readability.

Project Structure

The tool assumes the following directory structure within your project:

project-root/
├── src/
│   ├── configs/
│   ├── controllers/
│   ├── dtos/
│   ├── interfaces/
│   ├── mails/
│   ├── middlewares/
│   ├── models/
│   ├── routes/
│   ├── services/
│   ├── utils/
│   └── validations/
├── package.json
└── README.md

Contributing

Contributions to the Craftflow CLI Tool are welcome! If you have any suggestions, improvements, or issues, please submit them to the GitHub repository.

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

License

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

About Me

I am an experienced Software Engineer, Security Researcher, and Hacker with a passion for creating robust and secure software solutions. With a track record of securing systems for renowned organizations, I bring expertise in enhancing digital security and developing innovative technologies.

Short Bio

Software Engineer 👩‍💻 | Security Researcher 📖 | Hacker 💻

Secured NASA, WHO, Paytm, Dell, Nokia, Lenovo, United Airlines, ABN AMRO Bank, and more.