Quick Start
Get APIForge running in your application in under 5 minutes.
Node.js — Express.js
Requirements
- Node.js 22.5 or higher (uses the built-in
node:sqlitemodule) - An Express.js application (v4 or v5)
Installation
bash
npm install apiforgejsAdd the middleware
js
const express = require('express')
const { apiforge } = require('apiforgejs')
const app = express()
app.use(apiforge())
app.get('/users/:id', (req, res) => {
res.json({ id: req.params.id })
})
app.listen(3000)
// Dashboard → http://localhost:4242js
const express = require('express')
const { apiforge } = require('apiforgejs')
const app = express()
app.use(apiforge({
cloudUrl: 'https://api.apiforge.fr',
apiKey: process.env.APIFORGE_API_KEY,
service: 'my-api',
}))
app.listen(3000)ESM projects
js
import { apiforge } from 'apiforgejs'Python — FastAPI / Starlette
Requirements
- Python 3.11 or higher
- A FastAPI or Starlette application
Installation
bash
pip install apiforgepyAdd the middleware
python
from fastapi import FastAPI
from apiforgepy import ApiForgeMiddleware
app = FastAPI()
app.add_middleware(ApiForgeMiddleware)
@app.get("/users/{user_id}")
def get_user(user_id: int):
return {"id": user_id}
# Dashboard → http://localhost:4242python
import os
from fastapi import FastAPI
from apiforgepy import ApiForgeMiddleware
app = FastAPI()
app.add_middleware(
ApiForgeMiddleware,
cloud_url=os.environ["APIFORGE_CLOUD_URL"],
api_key=os.environ["APIFORGE_API_KEY"],
service="my-api",
)PHP — Laravel
Requirements
- PHP 8.2 or higher
- Laravel 10 or higher
pdo_sqliteextension (apt install php8.x-sqlite3on Debian/Ubuntu)
Installation
bash
composer require apiforge/apiforgephpAdd the middleware
The service provider is auto-discovered. Register the middleware in bootstrap/app.php (Laravel 11+) or app/Http/Kernel.php (Laravel 10):
php
// bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
$middleware->append(\ApiForge\Laravel\ApiForgeMiddleware::class);
})
// Dashboard → http://localhost:8000/_apiforgephp
// app/Http/Kernel.php
protected $middleware = [
// ...
\ApiForge\Laravel\ApiForgeMiddleware::class,
];
// Dashboard → http://localhost:8000/_apiforgephp
// .env
// APIFORGE_CLOUD_URL=https://api.apiforge.fr
// APIFORGE_API_KEY=af_...
// bootstrap/app.php — same registration, mode is detected from env vars
->withMiddleware(function (Middleware $middleware) {
$middleware->append(\ApiForge\Laravel\ApiForgeMiddleware::class);
})PHP dashboard location
In PHP/Laravel, the local dashboard is served at /_apiforge on your app's port — no separate HTTP server is started.
Open the local dashboard
Once your server receives its first requests, open:
txt
http://localhost:4242txt
http://localhost:8000/_apiforgeYou'll see:
- Health Score — a 0–100 score summarizing your API's health
- Latency per endpoint — P50, P90, P99 in real time
- Error rate by route — 2xx / 4xx / 5xx breakdown
- Automatic insights — plain-language alerts, no configuration needed
First metrics
The dashboard aggregates data every 60 seconds by default. Send a few requests to your API, wait one minute, and refresh — your first metrics will appear.
Cloud mode
In cloud mode the local dashboard is not started. Metrics are sent to the APIForge SaaS and displayed in the cloud dashboard. See Cloud Mode.
What's next
- Configuration — customize the dashboard port, flush interval, sampling rate and more
- Local Dashboard — understand what each panel shows
- Cloud Mode — send metrics to the APIForge SaaS
- Automatic Insights — what APIForge detects and how to act on it