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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rohitnirban/create-mern-app

v1.0.1

Published

Scaffold production-ready MERN (MongoDB, Express, React, Node.js) projects

Downloads

181

Readme

create-mern-app

License: MIT

Scaffold production-ready MERN (MongoDB, Express, React, Node.js) projects with an interactive CLI. Open source and welcoming contributions.

Features

CLI options

  • Stack options: Fullstack, frontend-only, or backend-only
  • Language: TypeScript (recommended) or JavaScript
  • Package managers: npm, pnpm, yarn, or bun
  • Deployment: Optional Vercel config (vercel.json)
  • AWS S3 file upload: Multer + S3 for scalable file uploads (backend/fullstack only)
  • UI: Optional shadcn/ui components (Button, Card, Input, Dialog, etc.)

What’s included in generated apps

Security & auth

  • CSRF protectionX-CSRF-Token header validated against cookie on mutations (POST/PUT/PATCH/DELETE); axios interceptor auto-attaches token
  • JWT auth — access + refresh tokens in HTTP-only cookies; automatic token refresh on 401 with request queue
  • Rate limiting — login (10/15min), register (5/15min), refresh throttled; express-rate-limit
  • Request validation — Zod schemas on register, login, create post; validated before handlers
  • Role-based accessauthenticate + authorize middleware; roles: user, manager, admin
  • Helmet — secure HTTP headers
  • CORS — configurable origin, credentials supported

API & routes

  • Auth routesPOST /auth/register, POST /auth/login, POST /auth/logout, POST /auth/refresh, GET /auth/me
  • Post routesGET /posts (paginated), GET /posts/admin (admin-only, paginated), GET /posts/:id, POST /posts (manager/admin), POST /posts/seed (admin, sample data)
  • Health routesGET /health (liveness), GET /health/ready (readiness + MongoDB check)
  • Upload route (optional, when S3 enabled) — POST /api/v1/upload with Multer; authenticated + CSRF-protected
  • Consistent API shapeApiSuccessResponse<T>, ApiErrorResponse; successResponse() / errorResponse() helpers

AWS S3 file upload (optional)

  • Multer — memory storage, .single('file'), 10 MB limit
  • AWS S3@aws-sdk/client-s3; uploads to uploads/{userId}/{uuid}{ext}
  • Allowed types — images (jpeg, png, gif, webp), PDF
  • Scalable — no local disk; streams buffer to S3; works with any deployment (Vercel, etc.)
  • Env varsAWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_S3_BUCKET

Pagination & types (backend)

  • Paginated typesPaginatedData<T>, PaginationMeta (page, limit, totalItems, totalPages, hasNextPage, hasPrevPage)
  • Query helpersgetPaginationParams() for ?page=&limit= with defaults and maxLimit
  • Reusable — works for any resource (posts, users, etc.)

Frontend

  • Route protection — Next.js middleware guards /dashboard, /posts; redirects unauthenticated users to /login
  • Auth-aware routing — redirects logged-in users away from /login, /register
  • React Query (TanStack Query)useQuery, useMutation, useQueryClient; centralized queryKeys
  • Paginated data table — TanStack Table + usePaginatedQuery; server-side pagination, page size selector (10/20/50/100), manual pagination
  • Generic usePaginatedQuery — fetcher returns { items, pagination }; caches by (queryKeyPrefix + params) per page
  • Typed APIApiSuccessResponse, Post, User, PaginationMeta, PaginatedPostsResponse; shared types across app

Requirements

  • Node.js >= 18
  • npm / pnpm / yarn / bun (for installing dependencies in the generated project)

Quick start

# Using npx (no install)
npx @rohitnirban/create-mern-app my-app

# Or with npm create
npm create @rohitnirban/create-mern-app@latest my-app

You can omit the project name to be prompted. The CLI will ask for:

  • Project name (if not provided)
  • Stack (fullstack / frontend-only / backend-only)
  • Language (TypeScript / JavaScript)
  • Package manager(s)
  • Deployment (Vercel / custom)
  • AWS S3 file upload (yes/no, backend/fullstack only)
  • Shadcn/ui (yes/no and component selection for frontend)

Development

# Clone the repo (replace rohitnirban with your GitHub username)
git clone https://github.com/rohitnirban/create-mern-app.git
cd create-mern-app

# Install dependencies
npm install

# Build
npm run build

# Run the CLI locally (e.g. scaffold into a test folder)
node dist/index.js my-test-app

# Tests
npm test

Project structure (generated app)

  • Fullstack: Monorepo with backend/ (Express + MongoDB) and frontend/ (Next.js + React). Root package.json has dev, dev:backend, dev:frontend, and build scripts.
  • Frontend-only: Single frontend/ (Next.js + React).
  • Backend-only: Single backend/ (Express + MongoDB).

When S3 upload is enabled, backend gets src/config/s3.ts, src/routes/upload.routes.ts, src/services/upload.service.ts, src/middleware/multerUpload.ts, and POST /api/v1/upload (auth + CSRF required). Add AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_S3_BUCKET to .env.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines. By participating, you agree to our Code of Conduct.

License

MIT - see LICENSE for details.