Skip to main content

Prerequisites

  • An AIKO project with your project key and secret key
  • A web application using one of our supported frameworks:
    • Next.js
    • Express
    • FastAPI
    • Flask
    • Actix Web
    • Your framework is missing? Let us know what we should add next!
If you missed copying your keys from the onboarding step when creating a project, you can find them again in Settings → Projects:

Quick Setup with Wizard

The fastest way to get started is with our setup wizard—it handles authentication, project setup, and configuration in one go. Just run this from your project root:
npx aiko-monitor-wizard
Once setup is complete, you will need to send a test request to your API and wait about 30 seconds for events to show up in the dashboard.
If you have multiple customer-facing products, it’s best to install AIKO Monitor on them all and group them in one project.This makes it possible to track users across their entire journey (e.g. from visiting your landing page to signing up for your product).

Manual Installation

If you’d prefer manual steps (or if the wizard doesn’t fit your setup), you can follow the steps below for your framework.
  • Next.js
  • Express
  • FastAPI
  • Flask
  • Actix Web
1

Install the package

Install AIKO Monitor via npm:
npm install aiko-monitor
2

Create .env file

Create a .env file in your project root with your AIKO credentials:
# .env
AIKO_PROJECT_KEY="<project_key>"
AIKO_SECRET_KEY="<secret_key>"
3

Initialize in your app

Create an instrumentation.ts file in your project root and initialize AIKO Monitor:
// instrumentation.ts
export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    const aiko = await import("aiko-monitor");

    const monitor = aiko.default.init({
      projectKey: process.env.AIKO_PROJECT_KEY,
      secretKey: process.env.AIKO_SECRET_KEY,
    });

    monitor.instrumentNextJs();
  }
}
Then create your API routes as usual:
// app/api/users/route.ts
export async function GET() {
  const users = [{ id: 1, name: "John Doe" }];
  return Response.json({users});
}

Next steps