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

jari

v2024.1.20

Published

Jari is an opinionated code generation CLI library that makes it absolutely easy to build a CRUD RESTful Api with Node.js and Express.js using Typescript. Jari is capable of code generation for the following HTTP Verbs : POST, PUT and GET.

Downloads

22

Readme

Jari

Jari is an opinionated code generation CLI library that makes it absolutely easy to build a CRUD RESTful Api with Node.js and Express.js using Typescript. Jari is capable of code generation for the following HTTP Verbs : POST, PUT and GET.

Tech Stack

  • MongoDb
  • Express.js
  • Typescript
  • Node.js

Installation

Use the package manager npm to install jari.

$ npm install jari -g

Usage

Creating a project

Creating the project where project-name is the name of the project

$ jari create 'project-name'

The following folder structure will be created

project-name
-- src/
------ root/
------ security/
------ utils/
------ app.ts
------ route.index.ts

CD into project directory

Generating API files

Creating blank api endpoints, api-name is the name of api

$ jari api 'api-name'

The following files will be created

api-name/
-- test/
------ create.spec.ts
------ edit.spec.ts
------ read.spec.ts
-- api-name.controller.ts
-- api-name.entity.ts
-- api-name.routes.ts
-- api-name.schema.ts
-- api-name.service.ts
-- api-name.utils.ts

Scaffolding API

Scaffolding api logic, this will create POST, PUT and GET methods inclusive of e2e tests and documentation

Step 1

$ jari schema 'api-name'

The name must be in singular, e.g. user not users

  • jari api user

For api that have more than one word. Use kebab-case or camel case

  • jari api user-detail
  • jari api userDetail

Step 2

You will be prompted to enter the number of fields the schema have

Lets generate user-detail schema. Enter the number of fields

Step 3

*********** FIELD 1 ***********

Enter Field 1 Name

Step 4

Select the field data type

Enter Field 1 Type
1. String
2. Boolean
3. Number
4. Schema.Types.ObjectId
5. Date
6. Enum

Step 5

Select if field is required/mandatory

Is Field 1 Required 
1. True
2. False

Step 6

Is Field 1 Unique 
1. True
2. False

NB: The above steps will be repeated for all fields

Managing Relationship/References

There are two types of relationships that are supported.

One-To-Many:

First create the child entity using steps above. Then create the parent entity/schema. In the parent schema, create a field that references the child schema. The field must have 4. Schema.Types.ObjectId data type. On prompt Enter Field 1 Reference enter the name of the child as entered on creation.

Many-To-Many:

Create both schemas, then create an additional one for relation which has two fields both referencing respective schemas

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.