/

Make Your Own URL Shortener

A URL shortener is a classic backend project that reinforces routing, database design, and CRUD operations. It’s similar to services like Bit.ly or TinyURL.

Stack suggestion:

  • Backend: Node.js + Express or Python + Flask
  • Database: MongoDB or PostgreSQL
  • Frontend: Basic HTML/CSS or React

Core features:

  1. Form to input a long URL.
  2. Generate a short ID (e.g., using nanoid or base62 hash).
  3. Store long URL and short ID in the database.
  4. Redirect endpoint: Accessing /abc123 redirects to the original URL.
  5. Analytics (optional): Track click counts and timestamps.

Example Express route:

jsКопироватьРедактироватьapp.get('/:shortId', async (req, res) => {
  const originalUrl = await db.find({ short: req.params.shortId });
  if (originalUrl) res.redirect(originalUrl);
  else res.status(404).send("Not found");
});

Bonus features:

  • Expiration dates.
  • Admin dashboard.
  • QR code generation.

Hosting it on Heroku, Vercel, or Render makes for a strong portfolio project that demonstrates full-stack capability.

Post Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest Post

Categories

June 2025
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30