DEV Community

Sourav
Sourav

Posted on

1

🚀 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

Redis image

Short-term memory for faster
AI agents 🤖💨

AI agents struggle with latency and context switching. Redis fixes it with a fast, in-memory layer for short-term context—plus native support for vectors and semi-structured data to keep real-time workflows on track.

Start building

Top comments (0)

Build gen AI apps that run anywhere with MongoDB Atlas

Build gen AI apps that run anywhere with MongoDB Atlas

MongoDB Atlas bundles vector search and a flexible document model so developers can build, scale, and run gen AI apps without juggling multiple databases. From LLM to semantic search, Atlas streamlines AI architecture. Start free today.

Start Free

👋 Kindness is contagious

Explore this compelling article, highly praised by the collaborative DEV Community. All developers, whether just starting out or already experienced, are invited to share insights and grow our collective expertise.

A quick “thank you” can lift someone’s spirits—drop your kudos in the comments!

On DEV, sharing experiences sparks innovation and strengthens our connections. If this post resonated with you, a brief note of appreciation goes a long way.

Get Started