Elegant terminal spinner
ora is a focused terminal spinner library for Node.js applications, particularly command-line tools that need to indicate progress during long-running operations. With over 53 million weekly downloads, it's become the de facto standard for adding visual feedback to CLI tasks like API calls, file processing, or build operations.
The package provides a clean API for managing spinner lifecycle through methods like start(), stop(), succeed(), and fail(). Beyond basic spinning animations, ora supports dynamic text updates, color changes, and multiple built-in spinner styles. It integrates naturally with promises and async functions through its oraPromise wrapper, automatically transitioning to success or failure states based on operation outcomes.
Developers building CLI tools—from small utility scripts to complex frameworks like the shadcn-ui CLI—rely on ora for its simplicity and reliability. The library handles cross-platform terminal quirks and provides consistent behavior across different environments. At version 9.3.0, it maintains active development with ESM-first architecture while remaining lightweight enough for most use cases.
While ora excels at non-interactive progress indication, it's specifically designed for visual feedback rather than user input. It occupies the middle ground between raw spinner frame libraries and full-featured CLI frameworks, offering just enough functionality without unnecessary complexity.
import ora from 'ora';
// Basic spinner with state transitions
const spinner = ora('Fetching user data').start();
setTimeout(() => {
spinner.color = 'yellow';
spinner.text = 'Processing results';
}, 1000);
setTimeout(() => {
spinner.succeed('User data loaded successfully');
}, 2000);
// Promise integration with custom messages
async function deployApplication() {
const result = await oraPromise(
async (spinner) => {
const response = await fetch('https://api.example.com/deploy');
spinner.text = 'Waiting for deployment to finish';
await new Promise(resolve => setTimeout(resolve, 2000));
return response.json();
},
{
text: 'Starting deployment',
successText: (data) => `Deployed to ${data.url}`,
failText: 'Deployment failed'
}
);
return result;
}
// Multiple sequential operations
async function buildProject() {
const compile = ora('Compiling TypeScript').start();
await new Promise(resolve => setTimeout(resolve, 1500));
compile.succeed('TypeScript compiled');
const bundle = ora('Bundling assets').start();
try {
await new Promise((resolve, reject) =>
Math.random() > 0.5 ? resolve() : reject(new Error('Bundle error'))
);
bundle.succeed('Assets bundled');
} catch (error) {
bundle.fail('Bundle failed: ' + error.message);
}
}Package installation feedback: Display spinners during npm/yarn package downloads and installations, updating text to show which dependency is currently being fetched. Tools like package managers and scaffolding CLIs use this extensively.
API request indication: Show loading state while making HTTP requests in CLI applications, automatically transitioning to success with response summaries or failure with error messages when requests complete.
File system operations: Indicate progress during bulk file processing, directory traversals, or large file uploads/downloads where exact progress percentages aren't available but users need confirmation the tool is working.
Build and compilation tasks: Provide feedback during code transpilation, bundling, or asset optimization steps in custom build tools, updating spinner text to reflect the current compilation stage.
Database migrations and seeding: Show activity during long-running database operations in CLI migration tools, transitioning between multiple sequential spinners for different migration files or seed operations.
npm install orapnpm add orabun add ora