Skip to main content
The Rampart is a TypeScript library - it has no built-in HTTP server. The patterns on these pages show how to wrap SDK functions in Next.js API routes or Express endpoints to expose them over HTTP for frontends, bots, or external services.

Base URL

All examples in this section assume your deployment is at:
Replace this with your own domain or http://localhost:3000/api for local development.

Authentication

For production deployments, protect your endpoints with a Bearer token:

Response Format

All endpoints return a consistent envelope:
Errors always include an error string and return a 4xx or 5xx HTTP status code.

Quick Start: Next.js

Install the SDK:
Create an API route:

Quick Start: Express

Rate Limiting

The Monad public RPC (https://rpc.monad.xyz) imposes rate limits. To avoid 429 errors in production:
  • Cache responses in Redis or a KV store (prices for 10-30 s, TVL for 60 s)
  • Use a dedicated RPC endpoint from a node provider
  • Run multiple Vitest tests with singleFork to avoid parallel RPC saturation

Available Endpoints