Welcome to go-go-scope
go-go-scope is a TypeScript library that brings structured concurrency to your applications using the Explicit Resource Management proposal. Write concurrent code that automatically cleans up after itself.Why go-go-scope?
Traditional async/await code can leak resources when errors occur or operations timeout. go-go-scope ensures deterministic cleanup through structured concurrency patterns inspired by Go’s goroutines and channels.Automatic Cleanup
Resources disposed in LIFO order via
using/await using syntax. No more forgotten cleanup code.Cancellation Propagation
Parent scope cancels all child tasks automatically. No fire-and-forget tasks.
Resilience Built-in
Circuit breakers, retries, timeouts, and idempotency patterns included out of the box.
Worker Thread Support
Offload CPU-intensive tasks to worker threads with the same clean API.
Key Features
Structured Concurrency
All tasks are tracked and awaitable. Parent scopes control child task lifetimes:Go-style Channels
Communicate between concurrent tasks using channels with backpressure:Error Handling with Result Tuples
No try/catch needed - errors are returned as values:Framework Integration
go-go-scope integrates seamlessly with popular Node.js frameworks:Fastify
Request-scoped concurrency for Fastify apps
Express
Middleware for Express.js applications
NestJS
Native NestJS module with DI support
Hono
Lightweight middleware for Hono
Koa
Context-aware Koa middleware
Hapi
Plugin for Hapi.js servers
Persistence & Observability
Database Adapters
Distributed locks, circuit breaker state, and caching for your database:- Redis - High-performance distributed locks
- PostgreSQL - Advisory locks and table-based storage
- MySQL - Named locks with table storage
- MongoDB - Atomic operations with TTL indexes
- DynamoDB - Conditional writes and single-table design
- SQLite - Single-node deployments
Monitoring & Tracing
- OpenTelemetry - Distributed tracing for all tasks
- Prometheus - Metrics collection and export
- Profiling - Built-in performance analysis
- Deadlock Detection - Automatic detection of blocking cycles
Get Started
Installation
Install go-go-scope with your preferred package manager
Quick Start
Build your first concurrent application in 5 minutes
Core Concepts
Learn the principles behind structured concurrency
API Reference
Complete API documentation for all features
Community & Support
- GitHub: thelinuxlich/go-go-scope
- npm: go-go-scope
- Issues: Report bugs
- License: MIT