Bun Is a Toolkit, Not Just a Runtime
Bun packs a runtime, package manager, bundler, and test runner into one binary. Here is how those four parts fit together and where the seams still show.
Loading…
Topic
42 posts about Node.js. Every summary links to the original.
See the idea
Bun packs a runtime, package manager, bundler, and test runner into one binary. Here is how those four parts fit together and where the seams still show.
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
Newest first
This tutorial walks through connecting a Node.js script to a MongoDB database, listing the cluster’s databases, and printing the results to the console. It begins with prerequisites: a supported Node.js version, the MongoDB Node.js Driver installed via npm, and a free MongoDB Atlas cluster loaded with sample data. The Atlas connection wizard adds the current IP address, creates a MongoDB user, and supplies a connection string for Node.js driver version 3.6 or later. The script imports MongoClient, defines an asynchronous main function, creates a client with the connection URI, and awaits client.connect(). Database calls sit inside try/catch, with a finally block closing the connection, and a listDatabases function retrieves and prints the database names before the script runs with node connection.js.
The tutorial shows how to connect Rime’s Prism speech-to-speech model to Twilio’s voice infrastructure using Twilio Media Streams, Node.js, and Rime’s Node SDK. It covers setting up a Node.js project with Fastify, installing dependencies, and writing audio conversion code to handle the format mismatch between Twilio’s 8 kHz G.711 μ-law and Prism’s 16/24 kHz PCM16. The server manages WebSocket connections, converts incoming μ-law audio to PCM16 for Prism, and converts Prism’s 24 kHz output back to 8 kHz μ-law for Twilio using a low-pass filter and decimation. Additional features include interruption handling, tool calling, persisting customer details with Twilio’s Conversation Memory, and analyzing transcripts with Conversation Intelligence. The tutorial concludes with troubleshooting tips and next steps for further exploration.
Twilio’s Conversation Relay enables real-time voice applications with AI LLMs over a WebSocket connection. This tutorial demonstrates integrating Claude, Anthropic’s AI model, with Twilio Voice using Conversation Relay. The setup uses a Node.js server with Fastify, the Anthropic SDK, and a system prompt that instructs the model to spell out numbers and avoid special characters for better text-to-speech. The server exposes two endpoints: /twiml for TwiML instructions and /ws for the WebSocket relay. The tutorial tests the integration with Claude Sonnet 5.5 and Haiku 5.5 at low effort, both handling real-time voice well. The result is a functioning voice assistant that can be called via a Twilio phone number.
This tutorial extends a basic Twilio Conversation Relay voice assistant that uses Anthropic Claude in Node.js by adding token streaming and interruption-aware conversation tracking. The author replaces the aiResponse() function with aiResponseStream(), which uses anthropic.messages.stream() to receive content_block_delta text chunks and forwards each token to Conversation Relay with last: false before sending an empty final token with last: true. The prompt handler now awaits the streamed response and pushes the assistant role and content into local session storage. To handle interruptions, the app listens for Conversation Relay interrupt messages and uses utteranceUntilInterrupt to find the last assistant message containing the heard text, truncating that message and removing later assistant turns so the model knows how far the caller heard. Testing requires an ngrok tunnel, a Twilio number configured with a /twiml webhook, and a phone call to verify the changes.
Paicku is a command-line tool and Node.js library that wraps the Pack CLI to containerize applications using Cloud Native Buildpacks. It can be installed globally via npm install -g paicku or run with npx. It downloads and configures Pack for the host OS and container runtime, eliminating manual setup. Users build images with npx paicku build, defaulting to builder paketobuildpacks/builder-ubi8-base, and can list available builders with the suggest command. The Node.js librarys createPaicku function provides a build method returning an image object with run and stop for integration tests; an example test builds an app, starts the container, and asserts HTTP 200. Paicku detects Docker or Podman and supports any language a builder supports, such as Node.js and Java, by only changing the application path.
Twilio Conversation Intelligence, Conversation Orchestrator, and Conversation Memory together analyze voice calls for a Node.js voice agent built with Conversation Relay. After a call, Twilio sends a webhook to /intelligence-results containing a call summary, sentiment analysis, and script adherence for categories like introduction with the required phrase “Thanks for calling Owl Air! I’m Hoot.” The developer creates a Memory Store and Conversation Configuration, then an Intelligence rule selecting Sentiment, Summary, and Script-Adherence operators triggered at conversation end. A Node.js handler extracts the data and persists it to a SQLite database using tables for intelligence_results, operators, and operator_script_adherence_categories. Testing involves calling the Twilio number and verifying the summary, sentiment, and script adherence records in the database.
Rich Communication Services (RCS) upgrades SMS with branded conversations, images, carousels, and read receipts delivered through the default messaging app. Twilio Programmable Messaging supports RCS as a first-class channel, reusing the same API as SMS. This tutorial covers building an RCS campaign in Node.js, including RCS Sender registration (a manual review process with test device support), creating a twilio/card content template with dynamic variables, and broadcasting personalized messages from a JSON list. Delivery status is tracked through a status callback webhook exposed via ngrok, and replies are captured through an inbound webhook when users tap suggested reply buttons. The guide also includes troubleshooting for common issues such as messages falling back to SMS, error codes 30001 and 63001, and webhook configuration errors.
This tutorial demonstrates building a voice AI agent with Twilio Conversation Relay, Node.js, and the OpenAI API, then testing and fixing its prompts using Cekura automated platform, a Twilio Startup Searchlight award winner. Conversation Relay manages real-time voice tasks like speech-to-text, text-to-speech, interruption detection, and turn management over WebSockets, while developers control business logic, tools, and AI integration. Cekura defines evaluation metrics, generates test conversations with realistic caller scenarios—interruptions, topic changes, and unexpected requests—and runs baseline tests to uncover prompt gaps. After analyzing failure reports, developers update the system prompt and re-run tests; fixing a fee-waiver bug raised the pass rate from below 70% to the 90-95% target in one refinement. The tutorial emphasizes that prompts are source code requiring version control and automated testing for reliable voice AI agent behavior.
Voice agents can converse, but they need external APIs to retrieve live information or take actions such as checking inventory or booking appointments. This tutorial builds a Node.js voice agent with Twilio Conversation Relay, Express, WebSockets, and the OpenAI Node.js SDK. A Conversation Relay WebSocket handler collects voice prompts, maintains conversation messages, streams model output back to the call, and defines a get_cat_fact tool that fetches JSON from the unauthenticated Cat Facts REST API. The service returns the fetched fact or an error message, while TwiML connects Twilio's voice-capable number to the WebSocket endpoint. Testing uses Node.js 18+, an OpenAI API key, ngrok, and a POST /voice webhook; the stated result is that callers can ask for a cat fact and hear the API response.
Disconnected voice calls can force callers to repeat information, creating friction for AI phone agents. It builds a Node.js Express service that preserves caller context, preferences, and action history across separate inbound calls using Twilio Conversation Memory. The implementation uses Express and express-ws for HTTP and WebSocket handling, the OpenAI SDK with gpt-4o-mini for streamed responses and summaries, and axios for Twilio’s Conversation Memory REST API; a memory store ID and other credentials are configured through environment variables. The sample application connects Twilio’s Conversation Relay to an auto-repair assistant, retrieves prior context for recognized callers, and logs a summary when a call ends. Testing involves two calls from the same phone number to verify that the second call recalls details from the first.
The post introduces a Twilio Agent Connect integration for building production-ready voice AI experiences with OpenAI’s GPT-Live-1 speech-to-speech model. It addresses the gap between real-time speech intelligence and customer-facing communications by connecting GPT-Live-1 to Twilio Voice and Conversations while preserving context across channels and supporting reliable scale. The SDK supplies a native GPTLiveProvider that links Twilio Voice Media Streams directly to the OpenAI API without custom WebSocket plumbing, and handles turn-taking, audio streaming, interruption handling, and tool delegation. Tutorials, documentation, and example repositories cover inbound and outbound agents implemented with Python and Node.js, giving developers materials to build, test, and deploy voice applications.
This tutorial shows how to build an AI voice assistant that answers phone calls using Twilio Programmable Voice, Twilio Media Streams, OpenAI's GPT-Live-1, and Node.js. GPT-Live-1 acts as the speech-to-speech model for listening, talking, and handling interruptions, while the delegated gpt-5.6-terra model handles deeper reasoning and tool use. The implementation uses a Fastify server with WebSocket support, dotenv configuration, a marin voice, and separate prompts for the voice and backend roles. Callers can request a city's top headline through the custom get_top_headline function or ask factual questions through OpenAI's hosted web_search tool. The guide exposes port 5050 with ngrok, points a Twilio number at an /incoming-call webhook, and concludes that the working example fits in under 200 lines.
This tutorial shows how to build an outbound AI voice agent that uses Twilio Programmable Voice and Media Streams to call a permitted phone number, rather than waiting for inbound calls. It connects the call to GPT-Live-1 in the OpenAI API through a Node.js server, with Fastify, ws, dotenv, and the Twilio helper library handling the application and relay. The implementation reads the destination from a --call flag, validates E.164 formatting, exposes the server through a public tunnel, and uses environment variables for credentials and the calling number. Owlie identifies itself as an AI assistant, retrieves a callback note with get_callback_reason, delegates factual questions to hosted web_search, and can be interrupted during speech. The completed demo rings the chosen number, explains why it is calling, and can return random callback notes or web-searched answers, while the tutorial stresses verified numbers, model access, and outbound-calling compliance.
Cloudflare has rebuilt the module registry in workerd, the open-source core of the Workers runtime, to improve speed, standards compliance, and alignment with Node.js. The change addresses compatibility beyond runtime APIs by making module resolution, loading, and caching behave more like Node.js across ESM, CommonJS, and WebAssembly. The new registry uses URLs as specifiers, supports import.meta.url, import.meta.main, and import.meta.resolve(), distinguishes modules by query strings and fragments, validates import attributes, follows require(esm) rules, and compiles modules lazily while sharing caches across isolates. It also supports WebAssembly source phase imports and consistent loading errors; the existing registry remains in place, and the new implementation must be enabled with the new_module_registry compatibility flag.
Twilio's ConversationRelay connects phone calls to an AI stack while handling speech-to-text, text-to-speech, and the WebSocket session, leaving application code focused on the LLM and conversation logic. This tutorial updates a Node.js ConversationRelay application to use Deepgram Flux, which combines transcription and turn detection and is described as reducing response latency by up to 200–600 milliseconds and false interruptions by around 30 percent. It walks through cloning a Fastify demo, exposing it with ngrok, configuring environment variables, and adding Flux settings to the ConversationRelay TwiML, including eotThreshold, speechTimeout, and ignoreBackchannel. The supplied configuration uses an end-of-turn threshold of 0.8, a 3,000-millisecond speech timeout, and enabled backchannel ignoring, while the tutorial also explains partial prompts, smart formatting, and recognition hints.
The post presents a real-time market-data application that ingests trade and quote ticks from Massive and stores them in ClickHouse for low-latency querying and visualization. It distinguishes quotes, which contain bid and ask prices and sizes, from trades, which record executed price, size, timestamps, and related fields. The implementation uses an authenticated Massive WebSocket subscription, Node.js ingestion, separate ClickHouse MergeTree tables ordered by symbol and one-minute timestamp buckets, and React charts. It also describes materialized-view aggregation for visualization and supplies a runnable repository with setup, build, start, admin, and synthetic-seed paths; the conclusion recommends durable delivery, replay, authentication, and workload-specific tuning before production use.
This tutorial builds an Express API for creating and managing Twilio Programmable Video rooms with Node.js and TypeScript. It sets up a project with Express, TypeScript 5, ts-node, node-dev, dotenv, and the Twilio Node.js helper library, while requiring Node.js 20 or 22 LTS. Twilio account credentials are stored in environment variables loaded from .env, which is excluded through .gitignore. The TypeScript configuration compiles strict CommonJS source from src into build and targets ES5; routes call the Rooms API to create rooms and complete them by changing status to completed, disconnecting connected participants. The result is a server-side room-management foundation, with access-token issuance identified as the next step for browser or mobile participants.
Fake accounts and signup fraud can undermine onboarding, so the tutorial builds a Node.js flow that collects a user's name and phone number. It combines Twilio Lookup and Verify through four progressively intense checks: line type, line status, identity match, and SMS OTP possession. The implementation blocks landline, nonfixed VoIP, toll-free, and pager numbers, checks submitted first and last names against authoritative sources using exact_match or high_partial_match, and sends an OTP only after the lookup steps pass. Line status is optional in the example because access is in Private Beta, while the project uses Express, EJS, and environment variables for its Node.js setup. It also demonstrates expected outcomes for mobile, blocked, and mismatched inputs, then notes that pricing varies by country.
The tutorial addresses wasted patient time in telehealth waiting rooms by adding an AI voice assistant to a Twilio Video room for intake collection. It combines Twilio Programmable Video, Conversation Relay, and an LLM, with the assistant joining as an audio-only participant and handling questions about visit reasons, symptoms, and medications. A two-leg Voice call bridges the room to Conversation Relay: one leg participates in the room, while the other sends transcribed audio to a WebSocket server and returns spoken LLM responses. The tutorial uses Node.js, Express, the Twilio helper library, OpenAI, ws, dotenv, and ngrok, and explains setup, browser interaction, and troubleshooting. Its stated result is a working application in which a patient converses naturally with the AI before a provider joins, with GPT-4o-mini processing speech.
This workshop extends a React and Express.js Todo application’s SCIM-based user provisioning to include entitlements such as roles, licensing, and permissions for enterprise B2B SaaS use. Starting from completed SCIM workshop code, it adds a /Roles endpoint, database-backed roles, SCIM schemas and resource types, and TypeScript implementations that conform to SCIM responses and user resources. The walkthrough connects the API to an Okta SCIM application, discovers schemas and characteristics, and demonstrates synchronizing existing entitlements and assigning a custom is_tall characteristic to a user. It also discusses multi-tenant designs, where organization-specific roles can be addressed through an API key in the Authorization header, while recommending OAuth for production.
The best engineering reads, once a week.