Gathering detailed insights and metrics for nodstarter
Gathering detailed insights and metrics for nodstarter
Gathering detailed insights and metrics for nodstarter
Gathering detailed insights and metrics for nodstarter
Starter application for Node.js to provide rapid Restful APIs development, pre-configured, secured routers, services, and models
npm install nodstarter
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
1 Stars
66 Commits
1 Forks
1 Watchers
15 Branches
4 Contributors
Updated on Aug 22, 2024
Latest Version
1.0.21
Package Id
nodstarter@1.0.21
Unpacked Size
36.24 kB
Size
11.10 kB
File Count
29
NPM Version
6.14.2
Node Version
13.8.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
11
Nodstarter is a starter application for Node.js designed to facilitate rapid RESTful API development. It provides pre-configured, secured routers, services, and models to streamline the creation of secure and scalable applications.
Nodstarter provides a framework for developing secure RESTful APIs quickly. It includes pre-configured routers, services, and models, allowing developers to focus on writing business logic rather than setup and configuration.
Nodstarter includes models for users
, posts
, and categories
, with predefined relationships:
These components are organized into routers, controllers, and models to provide a clear structure for API development.
├── index.js
├── package.json
├── scripts
│ └── post_install.js
└── server
├── api
│ ├── categories
│ │ ├── controller.js
│ │ ├── model.js
│ │ └── router.js
│ ├── index.js
│ ├── posts
│ │ ├── controller.js
│ │ ├── model.js
│ │ └── router.js
│ └── users
│ ├── controller.js
│ ├── model.js
│ └── router.js
├── auth
│ ├── controller.js
│ ├── index.js
│ └── routers.js
├── config
│ ├── development.js
│ ├── index.js
│ ├── production.js
│ └── testing.js
├── index.js
├── middleware
│ ├── err.js
│ └── index.js
└── util
├── createRouter.js
└── logger.js
This is the configuration to the JWT token to the user
1const expressJwt = require('express-jwt'); 2const config = require('../config'); 3const logger = require('../util/logger'); 4const jwt = require('jsonwebtoken'); 5const checkToken = expressJwt({ 6 secret: config.secrets.jwt 7}); 8const User = require('../api/users/model'); 9exports.decodeToken = () => { 10 return (req, res, next) => { 11 if (req.query && req.query.hasOwnProperty('access_token')) { 12 req.headers.authorization = 'Bearer ' + req.query.access_token; 13 } 14 checkToken(req, res, next); 15 }; 16}; 17 18exports.getFreshUser = () => { 19 return (req, res, next) => { 20 User.findById(req.user._id) 21 .then((user) => { 22 if (!user) { 23 res.status(400).send('Unanuthorized'); 24 } else { 25 req.user = user; 26 next(); 27 } 28 }, (err) => { 29 next(err); 30 }); 31 }; 32}; 33 34exports.verifyUser = () => { 35 return (req, res, next) => { 36 var username = req.body.username; 37 var password = req.body.password; 38 39 if (!username || !password) { 40 res.status(400).send('You need a username and password'); 41 return; 42 } 43 44 User.findOne({ 45 username: username 46 }) 47 .then((user) => { 48 logger.log('the selected user from DB: ' + user); 49 if (!user) { 50 logger.log('No user with the given username'); 51 res.status(401).send('Invalid username or password'); 52 } else if (!user.authenticate(password)) { 53 logger.log('Invalid password'); 54 res.status(401).send('Invalid username or password'); 55 } else { 56 req.user = user; 57 next(); 58 } 59 }, (err) => { 60 next(err); 61 }); 62 }; 63}; 64 65exports.signToken = (id) => { 66 logger.log("id is: " + id); 67 return jwt.sign({ 68 _id: id 69 }, config.secrets.jwt, { 70 expiresIn: config.expireTime 71 }); 72};
1curl --header "Content-Type: application/json" --request POST --data '{"username":"test_user_4","password":"12345"}' http://localhost:3000/auth/signin
, Output
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZTY2NjQwODYzMGE0NDE3MThiMjNhMzgiLCJpYXQiOjE1ODQ2Mzc4NDIsImV4cCI6MTU4NDY1MjI0Mn0.MODWP86ebc8XOMjDGyuvNCWWoKnQhpZpl81ynFGExG8"}
Nodstarter starts searching first for the following environment variables if found them will use them if not will use the default. The default values for NODE_ENV
is development, NODE_PORT
is 3000
and JWT
is Gambell
You can choose the environment for the NODE_ENV
variable from one of the following profiles (development
, production
, testing
)
NODE_ENV
NODE_PORT
JWT
1$ npm init
1$ npm install nodstarter
1$ npm start
, or use in one-line command:
1$ npm init; npm install nodstarter; npm start
Please make sure that the MongoDB daemon
is up and running
systemctl start mongodb
brew services run mongodb-community
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
If you have new ideas about the project please describe what you want to do and changes using an issue.
See CONTRIBUTING.md
See License
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/14 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
16 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
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