Simple Pastebin
Build a simple pastebin website with Laravel: paste a piece of text or code, choose how long it should stay (10 minutes, 1 day, 1 week or forever) and whether it's public, and get a short link to share. Anyone with the link can view the paste with line numbers and a raw text version; pastes can be deleted by their creator with a secret delete link, and expired pastes disappear automatically through a scheduled task. It's a great first Laravel project: you'll learn routes, controllers, Blade templates, Eloquent models and migrations, form validation, generating unguessable ids, escaping user content, scheduled commands, and feature tests.
- Estimate
- ~8h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
Laravel · Composer
Project roadmap
- 01
Plan the pages and data
~1hCreate a Laravel project. Write README.md describing the pages (a form to create a paste, the paste page, the raw view and a list of recent public pastes) and the data: a paste has a random public id, the content, an optional title, a language for display, visibility, an expiry time and a hashed delete token. Done when: the app runs, and README.md describes the pages and data.
- 02
Create the model
~1hCreate a Paste model and migration with the fields above and an index on the expiry time. Generate public ids with Str::random (for example 10 characters) so they can't be guessed, retrying on the rare collision. Done when: pastes can be created in Tinker with random ids.
- 03
Create and show pastes
~2hBuild the create form with validation (content required and at most 100 KB, title up to 100 characters, and an expiry from the allowed options) and a controller that saves the paste and redirects to its page, showing the secret delete link once. Show the paste with line numbers and its title, always escaped with Blade's {{ }} so pasted HTML is shown as text. Add a raw view returning text/plain. Done when: pastes can be created, viewed and viewed raw, and pasted HTML never runs.
- 04
Handle expiry and deletion
~1.5hReturn 404 for expired pastes even before they're cleaned up. Add a delete route that checks the secret token (comparing hashes) and deletes the paste. Create an artisan command that deletes expired pastes, and schedule it to run every hour. Done when: expired pastes are no longer shown, and the scheduled command deletes them.
- 05
List public pastes and limit abuse
~1hShow the 20 most recent public, unexpired pastes on the home page. Add Laravel's rate limiting to the create route (for example 10 pastes per minute per IP). Done when: the list shows only public, live pastes, and rapid creation is limited.
- 06
Test it
~1.5hWrite feature tests: creating valid and invalid pastes, viewing and raw view, HTML being escaped, expired pastes returning 404, deleting with the right and a wrong token, private pastes missing from the list, and the cleanup command. Done when: php artisan test passes.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack