Why We Built Newgate: The Problem with Multi-Format APIs

In 2025, APIs aren't just JSON anymore. Legacy systems speak XML, data pipelines stream CSV, and mobile apps upload binary. Here's why Node.js needed a unified solution.

By Newgate Team • December 12, 2025

If you've been building APIs in Node.js for the last decade, your app.js probably looks something like this:

const express = require('express');
const bodyParser = require('body-parser');
const xmlparser = require('express-xml-bodyparser');
const csv = require('csv-parser');
const multer = require('multer');

const app = express();

app.use(bodyParser.json());
app.use(xmlparser());
// ... configuration hell

Every time you need to handle a new format, you npm install another package, configure another middleware, and hope they don't conflict.

The Fragmentation Problem

Node.js is famous for its "small modules" philosophy. While great for libraries, it creates friction for frameworks. When you just want to build a webhook receiver that accepts both JSON (from Stripe) and XML (from a legacy bank), you spend more time setting up parsers than writing business logic.

We built Newgate to solve this specific fragmentation.

One Framework, Any Format

Newgate is opinionated about one thing: Types of Data.

Instead of treating JSON as the default and everything else as an edge case, Newgate treats all content types as first-class citizens.

Code Comparison

Here is how you handle a multi-format endpoint in Express:

// Express
app.post('/data', 
  bodyParser.json(), 
  xmlparser(), 
  (req, res) => {
    if (req.is('xml')) {
       // logic for xml structure
    } else {
       // logic for json structure
    }
});

And here is Newgate:

// Newgate
app.post('/data', (req, res) => {
  // ⚡️ Automatically parsed based on Content-Type
  // XML -> Object
  // JSON -> Object
  // CSV -> Array of Objects
  const data = req.body; 
  
  return res.json({ received: true });
});

Performance First

Newgate isn't just a wrapper. It uses zero-copy parsing where possible and streams large payloads (like CSVs) by default, protecting your memory usage.

What's Next?

We're just getting started. In the coming weeks, we'll be releasing benchmarks showing how Newgate compares to Fastify and Hono for mixed-payload throughput.

Get Started with the Docs