REST API for URL Shortener
Build a URL-shortening REST API with Dancer2 that generates short codes, redirects to original URLs, and tracks click counts, persisting data via DBI to SQLite. Learners practice building JSON REST APIs and database-backed redirect logic in Perl.
- Estimate
- ~7h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
Dancer2 · DBI · SQLite
Project roadmap
- 01
Set up the Dancer2 app
~1hScaffold a Dancer2 application with JSON serialization configured.
- 02
Design the URL table
~1hCreate a database table mapping short codes to original URLs and click counts.
- 03
Implement shorten and redirect endpoints
~2hAdd a POST endpoint to create short codes and a GET route that redirects and increments clicks.
- 04
Add code generation logic
~1.5hImplement a base62 short-code generator that avoids collisions.
- 05
Add stats endpoint and tests
~1.5hExpose a stats endpoint returning click counts and write tests for all routes.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack