A web application that generates random placeholder images for your projects. It fetches images from a Supabase storage bucket and allows users to shuffle through random images and copy the image URL to their clipboard.
- Fetch a random placeholder image from a Supabase bucket.
- Copy the image URL to your clipboard with a single click.
- Shadcn UI components for a clean and responsive design.
- Skeleton loader while fetching the images.
- Automatically fetches a random image on page load.
The app provides a simple API endpoint to fetch a random image URL:
/api/random-image
Use this endpoint in your own projects to retrieve a random placeholder image.
Before you begin, ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/zhenfon/random-placeholder.git cd random-placeholder
-
Install dependencies:
npm install
-
Create a
.env.local
file and add your Supabase environment variables:NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
-
Configure your Supabase domain in
next.config.js
:module.exports = { images: { domains: ['your_supabase_domain.supabase.co'], }, };
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser to view the application.
-
Fetching a Random Image:
- A random image is fetched automatically when the page loads.
- Click the Shuffle button to fetch a new random image.
-
Copying the Image URL:
- The image URL is displayed in an input field.
- Click the Copy button to copy the image URL to your clipboard.
The app is configured to be deployed to Vercel. Follow these steps to deploy:
- Push your repository to GitHub (if not already pushed).
- Log in to Vercel, connect your GitHub repository, and deploy.
Alternatively, if you're deploying to another platform, ensure the environment variables for Supabase are properly set.
Make sure to set these environment variables in your deployment platform:
NEXT_PUBLIC_SUPABASE_URL
: Your Supabase project URL.NEXT_PUBLIC_SUPABASE_ANON_KEY
: Your Supabase anon key.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.