Skip to content

akshitkrnagpal/open-placeholder

Repository files navigation

Open Placeholder

Open Placeholder

A fast, simple, and customizable placeholder image service

Live Demo β€’ Features β€’ Usage β€’ API Reference β€’ Deployment


Open Placeholder is a high-performance placeholder image generator built with Next.js and Edge Runtime. It provides dynamic image generation with custom dimensions and text, perfect for mockups, prototypes, and development.

✨ Features

  • πŸš€ Edge Runtime - Lightning-fast image generation at the edge
  • πŸ“ Flexible Sizing - Support for any dimensions up to 4000x4000 pixels
  • πŸ“ Custom Text - Display custom text instead of dimensions
  • πŸ’Ύ Smart Caching - Optimized with CDN cache headers for performance
  • 🎨 Clean Design - Minimalist aesthetic with Geist font
  • πŸ”§ Zero Configuration - Works out of the box with sensible defaults
  • 🌍 Self-Hostable - Deploy your own instance in seconds

πŸš€ Quick Start

Basic Usage

Generate a 600x400 placeholder image:

https://openplaceholder.com/600x400

Square Images

Create a 256x256 square image with a single dimension:

https://openplaceholder.com/256

Custom Text

Display custom text instead of dimensions:

https://openplaceholder.com/600x300/Hello%20World

πŸ“– API Reference

URL Format

https://openplaceholder.com/[width]x[height]/[text]

Parameters

Parameter Type Description Example
width number Image width in pixels (1-4000) 600
height number Image height in pixels (1-4000) 400
text string Optional custom text (URL encoded) Hello%20World

Examples

Rectangle (600x400)

<img src="https://openplaceholder.com/600x400" alt="Placeholder">

Square (512x512)

<img src="https://openplaceholder.com/512" alt="Square placeholder">

Custom Text

<img src="https://openplaceholder.com/800x200/Coming%20Soon" alt="Coming Soon">

Banner with Text

<img src="https://openplaceholder.com/1200x400/Hero%20Banner" alt="Hero Banner">

πŸ› οΈ Built With

πŸš€ Deployment

Deploy to Vercel (Recommended)

Deploy your own instance with one click:

Deploy with Vercel

Self-Hosting

  1. Clone the repository:
git clone https://github.com/akshitkrnagpal/open-placeholder.git
cd open-placeholder
  1. Install dependencies:
npm install
# or
pnpm install
  1. Run the development server:
npm run dev
# or
pnpm dev
  1. Build for production:
npm run build
npm run start

Environment Variables

No environment variables are required for basic functionality. The app works out of the box!

πŸ—οΈ Development

Prerequisites

  • Node.js 18+
  • npm, yarn, or pnpm

Local Development

# Clone the repo
git clone https://github.com/akshitkrnagpal/open-placeholder.git
cd open-placeholder

# Install dependencies
pnpm install

# Start development server
pnpm dev

# Build for production
pnpm build

# Run production build
pnpm start

# Run linter
pnpm lint

Project Structure

open-placeholder/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ [...filename]/     # Catch-all route for image generation
β”‚   β”‚   └── route.tsx      # Image generation endpoint
β”‚   β”œβ”€β”€ layout.tsx         # Root layout
β”‚   └── page.tsx           # Landing page
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ parser.ts          # URL parameter parsing
β”‚   └── data.ts            # GitHub data fetching
β”œβ”€β”€ fonts/
β”‚   └── geist/             # Local font files for image generation
└── public/                # Static assets

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

πŸ“„ License

This project is open source and available under the MIT License.

πŸ™ Acknowledgments

πŸ“Š Stats

GitHub stars GitHub forks


Made with ❀️ by Akshit Kr Nagpal

About

Self Hosted Placeholder Image Generator

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Contributors