Skip to content

kayaman/parrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

79 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🦜 Parrot

CI Release License Container

A modern, production-ready HTTP echo server that parrots back comprehensive request information. Perfect for debugging webhooks, testing HTTP clients, monitoring network requests, and understanding API interactions.

✨ Features

  • ⚑ Lightning Fast - Built on Bun runtime and Elysia framework for maximum performance
  • πŸ”’ Secure by Default - Distroless container, non-root user, sensitive data redaction
  • πŸ“Š Comprehensive Echo - Captures method, headers, query params, body, and server metadata
  • πŸš€ Production Ready - Kubernetes health probes, Helm charts, horizontal pod autoscaling
  • πŸ“š Auto-Generated Docs - Interactive OpenAPI/Swagger documentation
  • πŸ§ͺ Fully Tested - Comprehensive unit, integration, and e2e test suite

πŸš€ Quick Start

Docker

docker run -p 9999:9999 ghcr.io/kayaman/parrot:latest

Kubernetes (Helm)

helm repo add parrot https://kayaman.github.io/parrot
helm install my-parrot parrot/parrot

Test It

curl -X POST http://localhost:9999/api/test \
  -H "Content-Type: application/json" \
  -d '{"hello": "world"}'

πŸ“– Documentation

🎯 Use Cases

  • Webhook Debugging - Test and debug webhook integrations
  • API Client Testing - Validate HTTP client implementations
  • Network Monitoring - Inspect request details in real-time
  • Load Testing - Lightweight echo server for performance testing
  • Learning & Education - Understand HTTP requests and responses

πŸ”§ Development

Prerequisites

  • Bun v1.0.0 or higher
  • Docker (for container builds)
  • Kubernetes + Helm (for deployment testing)

Local Development

# Clone the repository
git clone https://github.com/kayaman/parrot.git
cd parrot

# Install dependencies
bun install

# Run in development mode
bun run dev

# Run tests
bun test

# Run linter
bun run check

# Build for production
bun run build

Project Structure

parrot/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # Application entry point
β”‚   β”œβ”€β”€ app.ts                # Elysia app configuration
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ health.ts         # Health check endpoints
β”‚   β”‚   └── parrot.ts         # Echo handler
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ metadata.ts       # Request metadata extraction
β”‚   β”‚   └── response.ts       # Response builder
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── index.ts          # TypeScript interfaces
β”‚   └── config/
β”‚       └── server.ts         # Server configuration
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/                 # Unit tests
β”‚   β”œβ”€β”€ integration/          # Integration tests
β”‚   └── e2e/                  # End-to-end tests
β”œβ”€β”€ charts/parrot/            # Helm chart
└── docs/                     # GitHub Pages site

πŸ“¦ API Reference

Health Endpoints

GET /health/live

Liveness probe for Kubernetes. Returns 200 if the application is running.

GET /health/ready

Readiness probe for Kubernetes. Returns 200 when ready to accept traffic.

Echo Endpoint

ANY /*

Accepts any HTTP method and path. Returns comprehensive request information.

Example Response:

{
  "message": "Request echoed successfully",
  "timestamp": "2025-12-19T10:30:00.000Z",
  "request": {
    "method": "POST",
    "path": "/api/test",
    "query": { "foo": "bar" },
    "headers": { "content-type": "application/json" },
    "body": { "hello": "world" },
    "clientIp": "192.168.1.1",
    "userAgent": "curl/8.0.1"
  },
  "server": {
    "hostname": "parrot-pod-abc123",
    "platform": "linux",
    "uptime": 3600,
    "memory": { "heapUsed": 25165824 }
  }
}

Security Features

Sensitive headers are automatically redacted:

  • authorization
  • cookie
  • x-api-key
  • x-auth-token

🐳 Container

The container image is built using a multi-stage distroless approach:

  • Base: gcr.io/distroless/base-debian12:nonroot
  • Size: ~60MB
  • User: Non-root (UID 65532)
  • Health Check: Built-in container health check
  • Architectures: linux/amd64, linux/arm64
# Pull the latest image
docker pull ghcr.io/kayaman/parrot:latest

# Run with custom port
docker run -p 8080:9999 -e PORT=9999 ghcr.io/kayaman/parrot:latest

⎈ Kubernetes Deployment

Basic Installation

helm repo add parrot https://kayaman.github.io/parrot
helm install my-parrot parrot/parrot

Production Configuration

helm install parrot-prod parrot/parrot \
  --set replicaCount=3 \
  --set resources.limits.cpu=500m \
  --set resources.limits.memory=512Mi \
  --set autoscaling.enabled=true \
  --set autoscaling.minReplicas=3 \
  --set autoscaling.maxReplicas=20

With Ingress

helm install my-parrot parrot/parrot \
  --set ingress.enabled=true \
  --set ingress.className=nginx \
  --set ingress.hosts[0].host=parrot.example.com \
  --set ingress.hosts[0].paths[0].path=/

πŸ§ͺ Testing

# Run all tests
bun test

# Run specific test suites
bun run test:unit
bun run test:integration
bun run test:e2e

# Run with coverage
bun run test:coverage

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

Built with:

  • Elysia - Fast and ergonomic TypeScript framework
  • Bun - Fast all-in-one JavaScript runtime
  • Biome - Fast linter and formatter

πŸ“¬ Contact


Made with ❀️ by kayaman

About

Parrots mimic and repeat human speech and sounds.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •