DEV Community

Sourav
Sourav

Posted on

πŸš€ Meet Monpress: A Modern Framework Built on Top of Express.js

We all love Express.js for its simplicity and flexibility β€” but let’s face it, it's starting to feel... a bit manual. If you’ve ever wanted the developer experience of Next.js but with the power of Express, you're going to love this.

Introducing Monpress β€” a modern, lightweight framework for building APIs using Express.js and TypeScript.

Monpress keeps the raw power of Express, but brings in modern conventions like:

βœ… File-based routing

βœ… RESTful method exports

βœ… Optional & dynamic route parameters

βœ… Global middleware support

βœ… Built-in CLI for scaffolding and development


⚑ Why Monpress Is More Than Just a CLI

This isn’t just a helper script β€” Monpress is a full framework designed for backend developers who want speed and structure.

Think of it as:

  • The Next.js of Express
  • A faster way to build APIs without boilerplate
  • An expressive and scalable structure for real-world backends

🧱 Opinionated, but Flexible

Monpress gives you structure, but doesn't lock you in. Want to plug in a database, auth provider, or custom middleware? Go for it. You still have full access to the underlying Express app.


πŸ”§ Core Concepts

1. πŸ“ File-Based Routing

Your folder = your API.

routes/
β”œβ”€β”€ index.ts      β†’ GET /
β”œβ”€β”€ blog.ts       β†’ GET /blog
β”œβ”€β”€ blog/[id].ts  β†’ GET /blog/:id
Enter fullscreen mode Exit fullscreen mode

Want to make a route optional? Just add an underscore:

routes/user/[id_].ts β†’ /user/:id?
Enter fullscreen mode Exit fullscreen mode

2. 🧩 REST Method Exports

Instead of juggling app.get() and router.post(), just export methods like this:

// routes/hello.ts
import { httpRequest } from "monpress";

export const GET = httpRequest((req, res) => {
  res.json({ message: "Hello from GET" });
});

export const POST = httpRequest((req, res) => {
  res.json({ message: "Posted!" });
});
Enter fullscreen mode Exit fullscreen mode

3. πŸ” Global Middleware

Need auth, CORS, or logging across your app?

// middlewares/logger.ts
import { middleware } from "monpress";

export const logger = middleware((req, _res, next) => {
  console.log(`[${req.method}] ${req.path}`);
  next();
});
Enter fullscreen mode Exit fullscreen mode

Register it globally:

import { MonPress } from "monpress";
import routes from "./routes";

const mon = MonPress({
  routes,
  middleware: [logger],
});
Enter fullscreen mode Exit fullscreen mode

πŸš€ Quickstart

npm install -g monpress

monpress create
cd my-project
monpress dev
Enter fullscreen mode Exit fullscreen mode

Then drop a file in routes/ and start building!


πŸ’‘ Why Monpress?

Feature Monpress
Framework βœ…
Express under the hood βœ…
File-based routing βœ…
RESTful method exports βœ…
Global middleware βœ…
Dev CLI βœ…
TypeScript-first βœ…

If you're building modern APIs, Monpress gives you speed, structure, and simplicity β€” all powered by the Express engine you already know and love.


πŸ“¦ Try It Now

npm install -g monpress
Enter fullscreen mode Exit fullscreen mode

πŸ‘‰ Check it out on npm


πŸ™Œ Join the Journey

I built Monpress to simplify backend development and bring modern DX to Express. I’d love your feedback, ideas, or contributions.

Let’s build something awesome β€” together.


πŸ”— GitHub: https://github.com/souravbapari1/mon


monpress #nodejs #express #typescript #webdev #framework #api #backend #opensource #devtools

Top comments (0)