Treblle for KoaJS

Learn how to get started with Treblle using our KoaJS package in less than 2 minutes on any new or existing API

Step 1

Install Treblle via NPM

Run command

npm install treblle

You can ⭐ our Github repo to stay up to date with new updates

View on Github

Go to Step 2
Step 2

Enable Treblle on your API

Add a few lines of code

const Koa = require("koa");
const KoaRouter = require("koa-router");
const KoaBody = require("koa-body");
const { koaTreblle } = require("treblle");
 
const app = new Koa();
const router = new KoaRouter();
 
app.use(
koaTreblle({
apiKey: "_YOUR_API_KEY_",
projectId: "_YOUR_PROJECT_ID_",
})
);

HEADS UP: You need to create an account to get your API KEY and PROJECT ID

Go to Step 3
Done

🎉 You're all set! 🎉

You and your team just got these amazing features:

  • Real-time API monitoring
  • Auto-generated API documenation
  • API analytics
  • Powerfull request search and filtering
  • 1-click API testing
  • Real-time problem detection
  • OpenAPI Specification support
  • Location based request tracking
  • Smart URL parameters detection
  • and many more..
Optional

Configuration params

Debug mode

 
const Koa = require("koa");
const KoaRouter = require("koa-router");
const KoaBody = require("koa-body");
const { koaTreblle } = require("treblle");
 
const app = new Koa();
const router = new KoaRouter();
 
app.use(
koaTreblle({
apiKey: "_YOUR_API_KEY_",
projectId: "_YOUR_PROJECT_ID_",
showErrors: false, // Set true to enable debug mode
})
);

A boolean that allows you to debug Treblle locally - false by default

Mask sensitive data

1const Koa = require("koa");
2const KoaRouter = require("koa-router");
3const KoaBody = require("koa-body");
4const { koaTreblle } = require("treblle");
5 
6const app = new Koa();
7const router = new KoaRouter();
8 
9app.use(
10 koaTreblle({
11 apiKey: "_YOUR_API_KEY_",
12 projectId: "_YOUR_PROJECT_ID_",
13 additionalFieldsToMask: ["secret", "private", "user_ssn"]
14 })
15);

PRO TIP: Data is masked before it even leaves your server

Monitor only specific environments

1const Koa = require("koa");
2const KoaRouter = require("koa-router");
3const KoaBody = require("koa-body");
4const { koaTreblle } = require("treblle");
5 
6const app = new Koa();
7const router = new KoaRouter();
8 
9// MONITOR ONLY the "production" ENVIROMENT
10if(process.env.NODE_ENV === "production") {
11 app.use(
12 koaTreblle({
13 apiKey: "_YOUR_API_KEY_",
14 projectId: "_YOUR_PROJECT_ID_"
15 })
16 );
17}

Need help getting started with Treblle on your API?

Book a meeting