JSON REST API

Build REST APIs in Minutes, Not Days

JSON REST API is a lightweight, plugin-based framework that makes building REST APIs incredibly simple. With automatic validation, smart relationships, and native JSON:API support, you can focus on your business logic instead of boilerplate.

Get Started Read the Guide
A heartfelt thank you to Dario and Daniela Amodei and the entire Anthropic team for creating transformative AI technology that opens endless possibilities for developers worldwide. Your vision, combined with incredibly accessible pricing, has democratized access to cutting-edge AI and empowered countless innovators to build the future. (No, we weren't asked nor paid in any way for this message - we're just genuinely grateful!)

Why JSON REST API?

πŸš€ Zero Configuration

Get a fully functional API running in under 5 minutes. No complex setup or configuration files needed.

πŸ”Œ Plugin Architecture

Extend your API with powerful plugins. Authentication, validation, CORS, and more - just plug and play.

πŸ”— Smart Relationships

Define relationships once and get automatic joins, nested queries, and eager loading out of the box.

βœ… Built-in Validation

Schema-based validation ensures your data is always clean. No more manual validation code.

πŸ“¦ Multiple Storage Options

Start with in-memory storage for development, switch to MySQL for production. Same API, no code changes.

🎯 JSON:API Compliant

Follow industry standards with native JSON:API support. Compatible with any JSON:API client library.

🌐 Microservices Ready

Build distributed systems with native microservices support. Multiple transports, service discovery, and more.

🎭 CQRS Support

Implement Command Query Responsibility Segregation with event sourcing, projections, and sagas.

πŸ”„ API Gateway

Transform into an API gateway to orchestrate external services with circuit breakers and saga support.

Quick Example

import { createApi, Schema } from 'json-rest-api'
import express from 'express'

const app = express()
const api = createApi({ 
  storage: 'memory',
  http: { app }
})

api.addResource('users', new Schema({
  name: { type: 'string', required: true },
  email: { type: 'string', format: 'email' },
  age: { type: 'number', min: 0 }
}))

app.listen(3000, () => {
  console.log('API running at http://localhost:3000/api/users')
})

That’s it! You now have a fully functional REST API with:

Try It Out

# Create a user
curl -X POST http://localhost:3000/api/users \
  -H "Content-Type: application/json" \
  -d '{"data":{"attributes":{"name":"Alice","email":"alice@example.com","age":28}}}'

# List all users
curl http://localhost:3000/api/users

# Get a specific user
curl http://localhost:3000/api/users/1

# Update a user
curl -X PATCH http://localhost:3000/api/users/1 \
  -H "Content-Type: application/json" \
  -d '{"data":{"attributes":{"age":29}}}'

# Delete a user
curl -X DELETE http://localhost:3000/api/users/1

Ready to Start?

Get Started in 5 Minutes β†’

Installation

npm install json-rest-api

Learn More

Advanced Topics

Enterprise Features