https://github.com/treblle/treblle-koa
The official Treblle SDK for Koa framework. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.
https://github.com/treblle/treblle-koa
api api-monitoring api-observability backend developer-tool koa koa-framework logging nodejs rest-api restful-api sdk treblle treblle-sdk
Last synced: 26 days ago
JSON representation
The official Treblle SDK for Koa framework. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.
- Host: GitHub
- URL: https://github.com/treblle/treblle-koa
- Owner: Treblle
- License: mit
- Created: 2023-03-20T16:42:05.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2025-08-14T06:48:17.000Z (2 months ago)
- Last Synced: 2025-08-14T08:46:10.168Z (2 months ago)
- Topics: api, api-monitoring, api-observability, backend, developer-tool, koa, koa-framework, logging, nodejs, rest-api, restful-api, sdk, treblle, treblle-sdk
- Language: JavaScript
- Homepage: https://www.treblle.com/
- Size: 112 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⚠️ DEPRECATED PACKAGE**This SDK has been deprecated in favor of the new unified [Treblle Node.js SDK v2.0](https://www.npmjs.com/package/treblle)**
[](https://www.npmjs.com/package/treblle)
---
# ⚠️ DEPRECATED - Use New Treblle Node.js SDK v2.0
> **This package is deprecated and no longer maintained. Please migrate to the new unified [Treblle Node.js SDK v2.0](https://www.npmjs.com/package/treblle).**
## 🚀 Migration to New SDK
The new Treblle Node.js SDK v2.0 provides better performance, more features, and unified support for all Node.js frameworks including Koa.
### Quick Migration
**Old SDK:**
```javascript
const treblle = require('@treblle/koa')
app.use(treblle())
```**New SDK v2.0:**
```javascript
const { koaTreblle } = require('treblle')
app.use(koaTreblle({
sdkToken: "your-sdk-token",
apiKey: "your-api-key"
}))
```### Benefits of New SDK
- 🚀 **40-60% faster** API calls with optimized networking
- 🧠 **50-70% reduction** in memory usage
- ⚡ **80-90% faster** field masking
- 🔧 **Koa 2.x & 3.x support**
- 🛡️ **Enhanced security** with comprehensive field masking
- 📊 **Better debugging** and error handling
- 🎯 **Advanced path blocking** with RegExp support### Installation
```bash
npm install treblle@^2.0.0
```## 📖 Documentation
- [New SDK Documentation](https://docs.treblle.com/integrations/javascript/node/)
- [npm Package](https://www.npmjs.com/package/treblle)---
**This repository will be archived soon. Please update your projects to use the new SDK.**
![]()
API Intelligence Platform. 🚀
Treblle is a lightweight SDK that helps Engineering and Product teams build, ship & maintain REST-based APIs faster.
## Features
![]()
- [API Intelligance](https://treblle.com/product/api-intelligence)
- [Auto-generated API Docs](https://treblle.com/product/api-documentation)
- [API analytics](https://treblle.com/product/api-analytics)
- [Treblle API Governance](https://treblle.com/product/api-governance)
- [API Security](https://treblle.com/product/api-security)
- [API Testing](https://treblle.com/product/aspen)
- [API Assistant](https://treblle.com/product/alfred)## How Treblle Works
Once you've integrated a Treblle SDK in your codebase, this SDK will send requests and response data to your Treblle Dashboard.In your Treblle Dashboard you get to see real-time requests to your API, auto-generated API docs, API analytics like how fast the response was for an endpoint, the load size of the response, etc.
Treblle also uses the requests sent to your Dashboard to calculate your API score which is a quality score that's calculated based on the performance, quality, and security best practices for your API.
> Visit [https://docs.treblle.com](http://docs.treblle.com) for the complete documentation.
## Security
### Masking fields
Masking fields ensure certain sensitive data are removed before being sent to Treblle.To make sure masking is done before any data leaves your server [we built it into all our SDKs](https://docs.treblle.com/treblle/data-masking/#default-masked-fields).
This means data masking is super fast and happens on a programming level before the API request is sent to Treblle. You can customize exactly which fields are masked when you're integrating the SDK.
> Visit the [Masked fields](https://docs.treblle.com/treblle/data-masking/) section of the docs for the complete documentation.
## Get Started
1. Sign in to [Treblle](https://platform.treblle.com).
2. Create [Workspace and your API](https://docs.treblle.com/guides/getting-started/).
3. [Setup the SDK](https://docs.treblle.com/integrations/) for your platform.### Install the SDK
```sh
npm i treblle --save
````treblle` expects your Treblle [API key](https://docs.treblle.com/en/dashboard#accessing-your-api-key) and [project ID](https://docs.treblle.com/en/dashboard/projects#project-id) to be set as environment varibles in a `.env` file or in your production environment.
Below are the environment variable that will be checked by `treblle`:
- `TREBLLE_API_KEY`
- `TREBLLE_PROJECT_ID````js
const Koa = require('koa')
const { koaTreblle } = require('treblle')
const app = new Koa()app.use(koaTreblle({
sdkToken: process.env.TREBLLE_SDK_TOKEN,
apiKey: process.env.TREBLLE_API_KEY
}))
```## Available SDKs
Treblle provides [open-source SDKs](https://docs.treblle.com/en/integrations) that let you seamlessly integrate Treblle with your REST-based APIs.
- [`treblle-laravel`](https://github.com/Treblle/treblle-laravel): SDK for Laravel
- [`treblle-php`](https://github.com/Treblle/treblle-php): SDK for PHP
- [`treblle-symfony`](https://github.com/Treblle/treblle-symfony): SDK for Symfony
- [`treblle-lumen`](https://github.com/Treblle/treblle-lumen): SDK for Lumen
- [`treblle-sails`](https://github.com/Treblle/treblle-sails): SDK for Sails
- [`treblle-adonisjs`](https://github.com/Treblle/treblle-adonisjs): SDK for AdonisJS
- [`treblle-fastify`](https://github.com/Treblle/treblle-fastify): SDK for Fastify
- [`treblle-directus`](https://github.com/Treblle/treblle-directus): SDK for Directus
- [`treblle-strapi`](https://github.com/Treblle/treblle-strapi): SDK for Strapi
- [`treblle-express`](https://github.com/Treblle/treblle-express): SDK for Express
- [`treblle-koa`](https://github.com/Treblle/treblle-koa): SDK for Koa
- [`treblle-go`](https://github.com/Treblle/treblle-go): SDK for Go
- [`treblle-ruby`](https://github.com/Treblle/treblle-ruby): SDK for Ruby on Rails
- [`treblle-python`](https://github.com/Treblle/treblle-python): SDK for Python/Django> See the [docs](https://docs.treblle.com/en/integrations) for more on SDKs and Integrations.
## Other Packages
Besides the SDKs, we also provide helpers and configuration used for SDK
development. If you're thinking about contributing to or creating a SDK, have a look at the resources
below:- [`treblle-utils`](https://github.com/Treblle/treblle-utils): A set of helpers and
utility functions useful for the JavaScript SDKs.
- [`php-utils`](https://github.com/Treblle/php-utils): A set of helpers and
utility functions useful for the PHP SDKs.## Community 💙
First and foremost: **Star and watch this repository** to stay up-to-date.
Also, follow our [Blog](https://blog.treblle.com), and on [Twitter](https://twitter.com/treblleapi).
Follow our tutorials and other video material at [YouTube](https://youtube.com/@treblle).
[](https://youtube.com/@treblle)
[](https://twitter.com/treblleapi)
### How to contribute
Here are some ways of contributing to making Treblle better:
- **[Try out Treblle](https://docs.treblle.com/en/introduction#getting-started)**, and let us know ways to make Treblle better for you.
- Send a pull request to any of our [open source repositories](https://github.com/Treblle) on Github. Check the contribution guide on the repo you want to contribute to for more details about how to contribute. We're looking forward to your contribution!### Contributors