DEV Community

Yass1n
Yass1n

Posted on

Got roasted by senior engineers for my framework's security, so I completely rebuilt the core engine

When I first launched bro.js, a zero-boilerplate Node.js backend engine, the goal was simple: bring Next.js-style file-based routing to pure backend API development.

The community response was insane. But as developers started using it to spin up APIs, a few senior engineers took a look under the hood and gave me some incredibly sharp feedback on scaling, security, and edge-case bugs.

Instead of ignoring it, I took it back to the lab. Today, I'm releasing bro.js v2.2.0, transitioning the framework from a fast prototyping tool into a production-hardened engine.

Here is what we leveled up:

1. Bulletproof Zod Validation Parity

Previously, the framework read nested Zod schemas to generate beautiful OpenAPI docs, but didn't strictly enforce them all at runtime. Now, we have 100% parity. If it's in your route's schema, it is ruthlessly validated before it ever hits your handler.

2. The "Fail-Closed" Security Model

It's too easy to accidentally deploy a dev environment JWT secret to production. bro.js now actively detects known fallback secrets on boot. If NODE_ENV=production and you haven't supplied a strong cryptographic key, the server intentionally crashes on startup to protect your application.

3. Graceful Lifecycle & Task Management

Scaling means clean deployments. I wired up a full SIGTERM/SIGINT shutdown handler. Now, when your container spins down, bro.js cleanly drains HTTP requests, gracefully closes Socket.io connections, and halts scheduled background cron tasks.

4. SDK Smart Quoting

The bro sdk command parses your backend routes and generates a strictly typed frontend client instantly. We overhauled the generator to safely encode complex URL paths and use "Smart Quoting," giving you beautiful dot-notation (api.users.get()) for standard routes without breaking on hyphenated dynamic segments.

If you are tired of writing Express middleware and want an API that just works out of the box, give the new engine a spin:

npx create-bro-framework@latest my-api
Enter fullscreen mode Exit fullscreen mode

I'd love for you to try breaking it again. Check out the Docs or drop a star on GitHub.

Top comments (0)