Skip to content
Learn Netverks
Company prep Darktrace
Mid-level (3–5 years) System design Medium

Design a URL shortening service

Reported in Darktrace European engineering loops. Foundational system design covering APIs, encoding, storage, and read-heavy scaling.

Role
SDE
Location
Paris, France

Context for Darktrace candidates:

Users submit long URLs and receive short links that redirect with low latency at scale.

Try answering aloud first

Cover trade-offs, structure, and a concrete example before revealing the baseline response.

Spoiler-free prep mode

How to frame this at Darktrace: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.

Requirements: create short URL, redirect, optional custom alias, analytics, high read:write ratio (often 100:1).

API: POST /v1/urls { longUrl, ttl? }{ shortCode }; GET /{code} → 301/302 redirect. Use idempotency keys for retries.

ID generation: base62 encode auto-increment ID (requires DB) or random 7-char strings with collision retry. Shard by hash of code for horizontal scale.

Storage: SQL for ownership and analytics; Redis cache for hot redirects (cache-aside). CDN at edge for global latency.

Deep dives: expiration, abuse/spam scanning, rate limits, custom domains, and read replica lag vs strong consistency for newly created links.

Comments (0)

Share how this question came up in your loop, or add tips for others preparing.

Log in to comment on this question.