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
Want to make a route optional? Just add an underscore:
routes/user/[id_].ts β /user/:id?
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!" });
});
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();
});
Register it globally:
import { MonPress } from "monpress";
import routes from "./routes";
const mon = MonPress({
routes,
middleware: [logger],
});
π Quickstart
npm install -g monpress
monpress create
cd my-project
monpress dev
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
π 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
Top comments (0)