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 🙏

© 2025 – Pkg Stats / Ryan Hefner

restaculous

v1.9.1

Published

An opinionated ExpressJs based REST API generator.

Downloads

26

Readme

Rest-a-culous

An opinionated ExpressJs based REST API generator.

Installation

To use the generator simply install it globally using NPM:

npm install -g restaculous

Features

The generator produces a fully functional REST API based on NodeJs, ExpressJs and MongoDB.

The application generated has the following features:

  • [x] Fully tested API endpoints with CRUD operations
  • [x] Express-Validator Integration
  • [x] Automatically generate API documentation
  • [x] Linting of source to ensure proper code formatting
  • [x] Authentication
  • [ ] Authorization
  • [ ] Wizard to generate settings.json file
  • [ ] Logging Integration
  • [x] .env Integration
  • [ ] Microservices Setup

Structure

The generate application structure looks as follows.

..
.
 |--config/                 # configuration settings
 |--controllers/            # controllers based on models
 |--dal/                    # data access layer containing abstractions over models
 |--docs/                    # Auto-generated documentation for API endpoints
 |--lib/                    # utility library to do common tasks
 |--models/                 # the underlying models of the system
 |--routes/                 # REST-based API endpoints
   |--validators/           # Validators for API endpoints
 |--test/                   # tests for the entire code base
 |--.gitignore              # common file and folders to ignore by git
 |--app.js                  # the applications main entry point
 |--package.json            # specifies modules/packages used in the app
 |--README.md               # an introductory text about the application

Generate from a settings.json file

You can generate an entire application by simply supplying a json settings file in the following format.

{
  "name": "[name of the application]",
  "description": "[small description about the application]",
  "author": "[author name] <author email>",
  "directory": "[the directory where to output the new application]",
  "repository": {
    "type": "[repository type]",
    "url": "[repository address]"
  },
  "config": [
    {
    "name": "[name of the configuration]",
    "value":"[value of the configuration]",
    "comment": "[short comment about the config]"
    }
  ],
  "models": [
    {
      "name": "[model name(capitalized)]",
      "authentication": "[0 or more of the following 'get','post','put','delete','search']",
      "attributes": [
        {
          "name": "[name of the attribute]",
          "type": "[the data type of the attribute]",
          "desc": "[a small description about the attribute]",
          "example": "[an example of the attribute]",
          "validation": [
            { "type": "[based on Express Validator]" , "message": "[message to show when validation fails]"}
          ],
          "isPrivate": "[indicates the attribute will not be returned, e.g. password (optional)]",
          "isAuto": "[indicates that the value for the attribute will be generated automatically]"
        }
      ],
      "relations": [{
        "name": "[name of a related model(capitalized)]",
        "referenceType": "multiple"
      }]
    }
  ]
}

Note: For details on the Express Validator validators, please look at its documentation on GitHub.

Here is a Gist with an example settings.json file.

Important:

  • The top level authentication (Boolean) property adds token based authentication to the application.
  • The model level authentication (Array of Action Names) property specifies the API endpoints that require authentication to access. If you don't want authentication added, this key needs to be removed or left as an empty array.
  • Timestamp attributes, i.e. createdAt and updatedAt are automatically added to all models.
  • All settings fields in the above example are required except the ones identified as being optional. All configuration entries are mandatory; a starter settings.json file is given below:

DON'T FORGET TO REPLACE [app-name]

{
  "name": "[app-name]",
  "description": "",
  "author": "",
  "directory": "",
  "repository": {
    "type": "",
    "url": ""
  },
  "authentication": true,
  "config": [
    {"name": "HTTP_PORT", "value":"process.env.HTTP_PORT || 8000", "comment": "HTTP PORT"},
    {"name": "MONGODB_URL", "value":"'mongodb://localhost/[app-name]'", "comment": "Mongodb URL"},
    {"name": "SALT_LENGTH", "value":"13", "comment": "SALT VALUE LENGTH"},
    {"name": "TOKEN_LENGTH", "value":"253", "comment": "TOKEN LENGTH"},
    {"name": "MAX_PAGE_SIZE", "value":"100", "comment": "DEFAULT PAGE SIZE"},
    {"name": "DEFAULT_SORT", "value":"'updatedAt'", "comment": "DEFAULT SORT FIELD"}
  ],
  "models": [
    {
      "name": "",
      "authentication": ["get","post","put","delete","search"],
      "attributes": [
        {
          "name": "",
          "type": "",
          "desc": "",
          "example": "",
          "validation": [
            { "type": "", "message": "" }
          ]
        }
      ]
    }
  ]
}