Gathering detailed insights and metrics for napim-next
Gathering detailed insights and metrics for napim-next
Gathering detailed insights and metrics for napim-next
Gathering detailed insights and metrics for napim-next
npm install napim-next
Typescript
Module System
Node Version
NPM Version
TypeScript (92.32%)
JavaScript (6.13%)
Shell (1.55%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
2 Stars
132 Commits
1 Watchers
10 Branches
3 Contributors
Updated on Feb 20, 2022
Latest Version
4.0.2
Package Id
napim-next@4.0.2
Unpacked Size
753.63 kB
Size
133.32 kB
File Count
16
NPM Version
6.14.5
Node Version
14.4.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Node API Maker built with polka and nodejs
The idea is to make API development quick and easy. Every single end point is handled by one file that called service. One service include:
Install Napim CLI globally (optional)
npm install -g napim-cli
you can check by running napim --version
Generate Napim template (optional)
napim init project-name
change project name with your actual project name
for typescript support, ad -ts in the end eg:napim init project-name -ts
Install dependency
cd project-name && npm install
Update Napim to current version
npm install napim
This is default folder structur for typescript mode:
1. 2|-- dist //compiled script will be here 3|-- log //all error log will be here 4|-- src 5 |-- middleware 6 |-- model 7 |-- service 8|-- stub //napim template generator, edit the template to match your needs 9 |-- middleware.napim 10 |-- model.napim 11 |-- service.napim 12 index.ts //your main js file 13|-- .env 14|-- .gitignore 15|-- knexfile.js // by defaut napim use knex for Database Query Builder, delete it if you use nosql like mongo 16|-- package.json 17|-- router.json //this file will map your API endpoint to execute service file 18|-- tsconfig.json
Generate Service
napim make:service service-name
by default service have method GET, you can change by append the method argument in the end, eg:
napim make:service login --post
this command will create file login_post.ts in service folder and append route data to router.json with tag: "default"
inside post
array, just check it :)
By default, prefix for default tag is api
, so you can execute the service by access endpoint POST:[host]/api/login
If you want to add some tag, for example secure
(You can add middleware like Auth
later), add tag argument
napim make:service users --tag=secure
You can also make dynamic endpoint, for example find user by some id
napim make:service users/:id
Generate Model
If you use Model like Objection.js to you can generate Objection model by
napim make:model ModelName
if you prefer to use raw query, just import {db} from "napim"
and use it like db.query(trx)... see knex documentation for detail
If you want to use db transaction, just change transaction to true in your service file, ez
You like NoSQL like mongo, just edit your .env add DB_DRIVER=mongo
and create your own Model or Schema and import to your service like usually
TODO: implement db transaction for mongo
Generate Middleware
Want to make Auth, JWT, or handle uploaded file (eg: using multer) you can create it in middleware
napim make:middleware JWT
then use it in router, append it in middleware array for example:
1//router.json 2[ 3 { 4 "tag": "default", 5 "prefix": "/api", 6 "middleware": [], 7 "get": [], 8 "post": [ 9 { 10 "path": "/login", 11 "service": "/login_post" 12 } 13 ] 14 }, 15 { 16 "tag": "secure", 17 "prefix": "/api/secure", 18 "middleware": [ 19 "JWT" 20 ], 21 "get": [ 22 { 23 "path": "/products/:id", 24 "service": "/products/_id_get" 25 } 26 ] 27 }, 28 { 29 "tag": "admin", 30 "prefix": "/api/admin", 31 "middleware": [ 32 "JWT", 33 "Admin" 34 ], 35 "get": [ 36 { 37 "path": "/products", 38 "service": "/products_get" 39 } 40 ], 41 "post": [ 42 { 43 "path": "/products", 44 "service": "/products_post" 45 } 46 ], 47 "delete": [ 48 { 49 "path": "/products/:id", 50 "service": "/producst/_id_delete" 51 } 52 ], 53 "patch": [ 54 { 55 "path": "/products/:id", 56 "service": "/producst/_id_patch" 57 } 58 ] 59 } 60]
If you want to access polka instance, just import {app} from "napim"
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
30 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More