Ratelimit based on billing tiers
Live Link: url-shortner-time-based-zia-unkey.vercel.app/
This project showcases a URL shortener service built with Next.js 15, leveraging the new App Router and the shadcn/ui component library. Additionally, it integrates with Unkey.com for enforcing rate limits and API key validation. It also provides tiered access to shortened URLs and introduces a time-based expiration feature, where URLs are automatically deleted one minute after creation.
Install project dependencies:
1npm install
or
1yarn install
or
1bun install
Configure environment variables:
Create a .env
file in the project root with the following content:
1NEXT_PUBLIC_BASE_URL=http://localhost:30002UNKEY_API_KEY=unkey_some_token3UNKEY_API_ID=api_some_id4REDIS_URL=https://some-redis-url.upstash.io5REDIS_TOKEN=some-redis-token
Set up Unkey:
.env
file.Set up Upstash:
.env
file.Launch the development server:
1npm run dev
or
1yarn dev
or
1bun dev
http://localhost:3000
and enter the URL you want to shorten.http://localhost:3000/{shortCode}
.Rate limiting can be configured differently for each tier in the code.
2500 verifications and 100K successful rate‑limited requests per month. No CC required.