Skip to main content

Installation

go-go-scope requires Node.js 24+ or Bun 1.2+ and TypeScript 5.2+ for Explicit Resource Management support.

Core Library

Install the main package using your preferred package manager:
npm install go-go-scope

TypeScript Configuration

go-go-scope uses the using and await using syntax from the Explicit Resource Management proposal. Configure your tsconfig.json:
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "lib": ["ES2022", "ESNext.Disposable"],
    "strict": true
  }
}
The ESNext.Disposable lib is required for Symbol.dispose and Symbol.asyncDispose types.

Package.json Configuration

Ensure your package uses ESM modules:
package.json
{
  "type": "module",
  "engines": {
    "node": ">=24.0.0"
  }
}

Additional Packages

Job Scheduler

For distributed job scheduling with cron support:
npm install @go-go-scope/scheduler

Stream Processing

For lazy async stream operations:
npm install @go-go-scope/stream

Testing Utilities

For mock scopes and test helpers:
npm install --save-dev @go-go-scope/testing

Framework Adapters

Integrate go-go-scope with your favorite Node.js framework:

Fastify

npm install @go-go-scope/adapter-fastify

Express

npm install @go-go-scope/adapter-express

NestJS

npm install @go-go-scope/adapter-nestjs

Hono

npm install @go-go-scope/adapter-hono

Other Frameworks

Koa

npm install @go-go-scope/adapter-koa

Hapi

npm install @go-go-scope/adapter-hapi

Elysia

npm install @go-go-scope/adapter-elysia

Next.js

npm install @go-go-scope/adapter-nextjs

Persistence Adapters

Add distributed locks and circuit breaker persistence:

Redis

npm install @go-go-scope/persistence-redis ioredis

PostgreSQL

npm install @go-go-scope/persistence-postgres pg

MySQL

npm install @go-go-scope/persistence-mysql mysql2

MongoDB

npm install @go-go-scope/persistence-mongodb mongodb

DynamoDB

npm install @go-go-scope/persistence-dynamodb @aws-sdk/client-dynamodb

SQLite

For Node.js:
npm install @go-go-scope/persistence-sqlite sqlite3
For Bun (uses native SQLite):
bun add @go-go-scope/persistence-sqlite-bun

Observability Plugins

OpenTelemetry

Distributed tracing for all scope operations:
npm install @go-go-scope/plugin-opentelemetry @opentelemetry/api

Metrics Collection

Prometheus and JSON metrics export:
npm install @go-go-scope/plugin-metrics

Performance Profiling

Task performance analysis:
npm install @go-go-scope/plugin-profiler

Deadlock Detection

Automatic detection of blocking cycles:
npm install @go-go-scope/plugin-deadlock-detector

Verify Installation

Create a simple test file to verify everything works:
test.ts
import { scope } from "go-go-scope";

await using s = scope();

const [err, result] = await s.task(async () => {
  return "Hello, go-go-scope!";
});

if (err) {
  console.error("Error:", err);
} else {
  console.log("Result:", result);
}
Run the test:
node test.ts
# or with tsx for TypeScript
npx tsx test.ts
Use tsx for running TypeScript directly during development:
npm install --save-dev tsx

Runtime Requirements

Node.js

  • Minimum version: 24.0.0
  • Required features: Native fetch, AbortSignal.timeout(), using syntax support
  • Recommended: Latest LTS version

Bun

  • Minimum version: 1.2.0
  • Native features: Built-in SQLite support, faster startup
  • Compatibility: Fully tested and supported

Deno

Deno support is experimental. Some features may require polyfills or configuration changes.

Next Steps

Quick Start

Build your first concurrent application

Core Concepts

Understand structured concurrency principles

API Reference

Explore the complete API

Examples

See real-world usage patterns

Build docs developers (and LLMs) love