@effect/platform-node package provides Node.js-specific implementations of Effect’s platform abstractions, enabling you to build robust server-side applications with file system access, HTTP servers, child processes, and more.
Installation
When to Use
Use@effect/platform-node when:
- Building server-side applications with Node.js
- You need access to file system, HTTP servers, or child processes
- You want to leverage Node.js-specific features like clustering, Redis, or worker threads
- Building CLI tools with terminal interaction and stdio handling
Core Features
Runtime
TheNodeRuntime module provides the entry point for running Effect programs in Node.js:
- Automatic error handling and logging
- Signal management (handles Ctrl+C gracefully)
- Exit code handling based on success/failure
- Optional custom teardown logic
HTTP Server
Create HTTP servers with theNodeHttpServer module:
HTTP Client
Make HTTP requests using theNodeHttpClient module (built on Undici):
File System
Access the file system with theNodeFileSystem module:
Child Processes
Spawn and manage child processes:Socket Servers
Create TCP/WebSocket servers:Available Modules
| Module | Description |
|---|---|
NodeRuntime | Run Effect programs as Node.js applications |
NodeHttpServer | Create HTTP/HTTPS servers |
NodeHttpClient | Make HTTP requests (Undici-based) |
NodeFileSystem | File system operations |
NodeChildProcessSpawner | Spawn and manage child processes |
NodeSocket | TCP socket client |
NodeSocketServer | TCP socket server |
NodeWorker | Worker thread management |
NodeWorkerRunner | Worker runner for parallel processing |
NodePath | Path manipulation |
NodeStdio | Standard input/output/error streams |
NodeTerminal | Terminal interaction |
NodeRedis | Redis client (requires ioredis) |
NodeClusterHttp | HTTP server clustering |
NodeClusterSocket | Socket server clustering |
NodeMultipart | Multipart form data handling |
NodeStream | Node.js stream integration |
NodeSink | Stream sinks for Node.js |
Mime | MIME type utilities |
Undici | Direct access to Undici client |
Platform Services
TheNodeServices module provides a convenient layer that includes all common Node.js services:
Testing
The package includes test layers for HTTP servers:Dependencies
The package has minimal external dependencies:- mime: MIME type detection
- undici: Fast HTTP/1.1 client (Node.js standard)
- ioredis (peer): Optional Redis client support
Related Packages
- @effect/platform - Core platform abstractions
- @effect/platform-bun - Bun runtime implementations
- @effect/platform-browser - Browser implementations
