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

@mahjongg/mern-mvc

v1.4.0

Published

A CLI that will build a MERN stack application using create-react-app

Downloads

67

Readme

Instructions:

This package relies on Yarn, so be sure that you have it installed globally.

npm install yarn -g

Next, install this package,

npm install -g @mahjongg/mern-mvc

Navigate to the desired location for your new project and run:

mern-mvc create <project-name>

mern-mvc will create a new folder for you with the name specified. This name will also be used in your package.json, so it must follow some naming conventions as required by npm. Only lowercase letters, numbers, or the "-" symbol are allowed.

What's Included?

mern-mvc creates an application that uses the following on the backend:

"dependencies": {
    "express",
    "express-session",
    "mongoose",
    "passport",
    "passport-local",
    "passport-local-mongoose"
  },
  "devDependencies": {
    "concurrently",
    "jest",
    "nodemon"
  }

All packages are installed at their most recent versions. It includes fully set-up user authentication, with the option for more fields to be added with ease.

You can opt out of passport set-up by using the flag --no-passport (aliased as -x).

A react application will be created using create-react-app, in a folder called 'client'. The dev dependencies concurrently and nodemon are used to allow both the react server and api server to be run in parallel when using yarn start. The react-app utilizes react-router-dom for routing, and axios for AJAX calls.

The React app has some very basic authentication forms included, but you are free to implement authentication however you like.

Route builder:

mern-mvc now includes a command for building a simple route file!

mern-mvc route <name> --options

The <name> parameter is used to determine the folder name to put the new route file in. You will still need to include that file somewhere and attach it to a specific path. Options include: --no-passport (-p): This will leave passport out of the function argument on your new route file. --no-functionBased (-f): This will create your route file so that it exports the Router object directly, rather than exporting a function that returns the Router. --routes (-r): This allows you to include a list of paths you want in your route. For simplicity, they are all created as GET routes, although it is simple enough to change them to some other method. The value provided to the --routes option should be include in double quotes and separated by a comma and a space. For example: mern-mvc route users --routes "signIn, signUp, signOut"

Will produce this file: users/index.js

module.exports = function(passport) {
	const router = require('express').Router();

	router.get("/signIn",function(req,res){

	});

	router.get("/signUp",function(req,res){

	});

	router.get("/signOut",function(req,res){

	});

    return router;
};

TODO:

other options to add to create command...

  • -r | no-react (for when the user has a premade react app)
  • -s | simple-routes (routes files are created as simple exports, rather than functions)
  • -n | no-npm (skips npm install, for quicker creation on slow connections. Still writes to package.json)