🦜 1. When Someone Tells You to Type curl parrot.live
When a friend tells you to type
curl parrot.live
in your terminal, you might not expect much. Maybe some text? A joke?
But then, this happens:
Yes, that’s a parrot — dancing in your terminal.
This article will demystify how it works, explain how text and color animations can be streamed through nothing but an HTTP connection, and walk you through building your very own streaming ASCII parrot — deployed for free on Cloudflare Workers, running at the edge and ready for the world to curl.
👉 Full source code: https://github.com/bugparty/cloudflare_worker_parrot
2. What Is parrot.live
?
parrot.live
is a delightful web service that brings the animated Party Parrot meme directly to your terminal. By simply executing:
curl parrot.live
in your terminal, you can enjoy a colorful, dancing ASCII art parrot right in your command line interface.
This project was created by Hugo Müller-Downing and is open-source, with its code available on GitHub. It utilizes frames from the terminal-parrot project to deliver the animated parrot experience.
The service works by streaming a sequence of ASCII frames over an HTTP connection, which, when rendered sequentially in the terminal, creates the illusion of a dancing parrot. This is achieved through the use of ANSI escape codes to control cursor movement and screen clearing, allowing for smooth animation within the terminal environment.
For those interested in exploring similar terminal-based animations, ascii.live
is another project by Hugo that hosts a variety of curl-based animations, extending the concept introduced by parrot.live
.
In the following sections, we’ll delve deeper into how parrot.live
functions and guide you through creating your own terminal-based animation service using Cloudflare Workers.
3. How Does It Work?
At first glance, parrot.live
might look like some kind of black magic. You type curl parrot.live
and suddenly a dancing parrot appears in your terminal, frame by frame, with color and movement — but what’s actually going on?
🧼 It’s Just Text. Really.
The magic lies in streamed plain text. When you run:
curl parrot.live
you’re just making a simple HTTP GET request to a server. That server responds with a continuous stream of ASCII characters, not unlike what you’d see in a .txt
file — except it’s using something special…
🎨 ANSI Escape Codes
The server includes ANSI escape sequences, which are special characters used to control how the terminal displays text. A few of the most important ones:
\x1b[2J
— Clear the screen\x1b[H
— Move the cursor to the top-left\x1b[35m
— Set the text color to magenta\x1b[39m
— Reset the text color
So what the server is doing is:
- Sending one frame of the ASCII parrot
- Using escape codes to clear and redraw the screen
- Waiting ~100ms
- Repeating
That’s it! The animation is really just a loop of text frames, piped through the network, and displayed in a terminal that understands how to interpret it.
🔄 curl Just Displays It
curl
doesn’t run code or do anything fancy — it just prints whatever the server sends. Your terminal does the rest, interpreting the colors, positions, and frame updates using the escape sequences.
🧵 It’s a Stream, Not a File
Unlike most HTTP responses that send a single file and close, parrot.live
keeps the connection open, streaming frame after frame over time — just like Netflix does for video.
4. Let’s Build Our Own with Cloudflare Workers
Now that you understand how parrot.live
works — it’s really just a stream of text — let’s build our own dancing ASCII parrot using Cloudflare Workers. This lets us:
- Serve animated text to terminals via
curl
- Run the code on Cloudflare’s edge network (super fast, globally distributed)
- Deploy for free (yes, really)
- Have fun doing it 🕺
🎉 Already want to jump into code? Here’s the repo:
https://github.com/bugparty/cloudflare_worker_parrot
🛠️ What Are Cloudflare Workers?
Cloudflare Workers are serverless functions that run on Cloudflare’s global edge network. Think of them as lightweight mini-servers that can:
- Handle HTTP requests
- Modify responses
- Serve content really close to your users
Perfect for a fun terminal toy like our own parrot streamer.
5. Step-by-Step: Write the Worker
Now let’s put the dancing parrot into code and stream it over HTTP using Cloudflare Workers.
📦 Step 1: Define the Frames
Create a file named parrot_frames.js
. This will contain the ASCII art frames. Here’s a super short example (you can replace this with the full animated parrot in this GitHub file):
export const frames = [
`\x1b[2J\x1b[H\x1b[35m
(•◡•) /
<) )╯
/ \\
\x1b[39m`,
`\x1b[2J\x1b[H\x1b[35m
(•◡•) /
<) )>
/ \\
\x1b[39m`,
];
🧠 Step 2: Create the Worker Script
Create or edit index.js
. You can refer to the full version here:
👉 index.js on GitHub
import { frames } from './parrot_frames.js';
export default {
async fetch(request, env, ctx) {
const encoder = new TextEncoder();
const stream = new ReadableStream({
async start(controller) {
let i = 0;
while (true) {
const frame = frames[i % frames.length];
controller.enqueue(encoder.encode(frame));
await new Promise((r) => setTimeout(r, 120));
i++;
}
}
});
return new Response(stream, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
"Cache-Control": "no-cache"
}
});
}
};
🚀 Step 3: Run It Locally
wrangler dev
Now try it out:
curl http://localhost:8787
🎉 Your terminal parrot should be dancing!
6. Deploy to the World 🌍
Let’s go global.
☁️ Step 1: Check wrangler.toml
Just ensure it points to your index.js
, and your project is ready to publish.
🚀 Step 2: Publish
wrangler publish
You’ll get a link like:
https://my-parrot.your-username.workers.dev
Try it:
curl https://my-parrot.your-username.workers.dev
That’s your parrot — live on the internet, streamed from the edge!
7. Conclusion: You Now Own a Cloud Parrot 🦜✨
Congratulations! You’ve built a globally distributed, real-time animated parrot using nothing but:
- ANSI art
- JavaScript
- Serverless infrastructure
- And your curiosity
Your terminal parrot is:
- Streamed live using Cloudflare Workers
- Fully customizable
- Hosted on the edge — and completely free
🔗 Want to fork the code or show some love? It’s on GitHub:
https://github.com/bugparty/cloudflare_worker_parrot
🧠 Go Further
- Add speed controls (
?speed=100
) - Switch parrots or colors
- Let the internet curl your creativity
Happy hacking, and may your parrots always dance smoothly. 🕺🌍