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

create-mern-mz

v0.1.0

Published

CLI scaffolding tool for MERN monorepo applications with Express, React, MongoDB, Turborepo, and OpenAPI

Readme

create-mern-mz

Scaffold a full-stack MERN monorepo in seconds.

npm create mern-mz my-project

What You Get

A production-ready TypeScript monorepo powered by Turborepo with:

Backend — Express 5, Mongoose, Zod validation, OpenAPI spec generation, modular architecture (controller → service → repository)

Frontend — React 19, Vite, styled-components, React Query, i18next, OpenAPI client generation, Error Boundary

Infrastructure — Docker Compose (MongoDB), pnpm workspaces, shared ESLint + Prettier config

Prerequisites

  • Node.js >= 20
  • pnpm
  • Docker (for MongoDB)

Usage

# Interactive
npm create mern-mz

# With project name
npm create mern-mz my-project

Then:

cd my-project
pnpm db:up       # Start MongoDB
pnpm dev         # Start backend + frontend

Project Structure

my-project/
├── apps/
│   ├── backend/
│   │   └── src/
│   │       ├── core/          # server, app, database, export-openapi
│   │       ├── shared/        # config, constants, middleware, utils
│   │       └── modules/       # feature modules (e.g. weather)
│   └── frontend/
│       └── src/
│           ├── core/          # main, app, routes
│           ├── shared/        # components, config, constants, hooks, i18n, utils
│           └── modules/       # feature modules (e.g. weather)
├── docker-compose.yml
├── turbo.json
├── tsconfig.base.json
├── pnpm-workspace.yaml
├── .eslintrc.cjs
└── .prettierrc

Single-Source Schema Pattern

Each backend module uses Zod as the single source of truth. Define your schema once — types, validation, and OpenAPI spec are all derived from it:

weather.schema.ts (you change this)
       │
       ├──► TypeScript types     (z.infer)
       ├──► Request validation   (.safeParse in controller)
       ├──► OpenAPI spec         (zod-to-openapi in export-openapi)
       └──► Frontend types/hooks (auto-generated via @hey-api/openapi-ts)

weather.model.ts
       └──► WeatherDocument interface (proper Mongoose types: ObjectId, Date)

Change a field in the Zod schema → TypeScript catches every downstream mismatch at compile time → run pnpm generate:api to regenerate the frontend client.

Adding a New Module

Backend — create a module folder with these files:

modules/your-module/
  your-module.schema.ts       ← Zod schema (single source of truth)
  your-module.model.ts        ← Mongoose model + document interface
  your-module.repository.ts   ← Database queries
  your-module.service.ts      ← Business logic
  your-module.controller.ts   ← Request handlers (Zod validation)
  your-module.routes.ts       ← Express router
  your-module.constants.ts    ← Error messages

Then wire it up:

  1. Add route path in shared/constants/routes.constants.ts
  2. Mount routes in core/app.ts
  3. Register OpenAPI paths in core/export-openapi.ts

Frontend — run pnpm generate:api to get typed hooks, then build your components:

modules/your-module/
  your-module.page.tsx        ← Module entry point (the page)
  your-module.page.styles.ts  ← Page styles
  components/                 ← Sub-components
  hooks/                      ← Custom hooks (if needed beyond generated ones)
  index.ts                    ← Barrel export (exports the page)

Add a route in core/routes.tsx and you're done.

Available Scripts

| Script | Description | |--------|-------------| | pnpm dev | Start all apps in development mode | | pnpm build | Build all apps | | pnpm test | Run tests across all apps | | pnpm lint | Lint all apps | | pnpm format | Format with Prettier | | pnpm db:up | Start MongoDB via Docker | | pnpm db:down | Stop MongoDB | | pnpm quality | Run lint + format check + tests | | pnpm generate:api | Generate frontend API client from backend OpenAPI spec |

Architecture

Each app follows a core/ → shared/ → modules/ convention:

  • core/ — App bootstrap, entry points, routing
  • shared/ — Cross-cutting: config, constants, utils, middleware, components
  • modules/ — Feature slices, each with its own controller/service/repository (backend) or components/hooks/services (frontend)

A sample weather module is included in both apps as a reference implementation.

License

MIT