Portfolio
← Projects
Lankan Urban Dictionary logo
Web · 2024

Lankan Urban Dictionary

A crowdsourced dictionary of Sri Lankan slang that gets about 4,000 clicks a month from Google.

SvelteKitMongoDBGoogle Cloud RunDocker
Screenshot of Lankan Urban Dictionary

Lankan Urban Dictionary is Urban Dictionary for Sri Lankan slang. Most of the words are Sinhala slang you hear every day but almost never see written down. I started it as a weekend project, and it now gets about 4,000 clicks a month from Google search.

What it does

  • Look up a word, with its meaning, examples and votes from other people.
  • Add new words and vote on the best definitions.

Making it fast

The first version took over a second to load on a cold visit. Most visitors come from search, so I worked through the stack and got the first load under 400 ms:

  • Indexes. I rewrote the most common MongoDB queries (word lookup and recent submissions) to use compound indexes instead of scanning the whole collection.
  • Transactions. Upvotes and submissions write to several places at once. I moved them into MongoDB transactions, which stopped half-finished writes.
  • Server routes. I moved the API into SvelteKit server routes, which cut the cold start time of the old setup.

SEO

People search for the same words and examples the site has, so I set up the SEO basics: semantic HTML, meta tags, canonical URLs and structured data for each entry.

How it’s built

  • SvelteKit for the site and the API.
  • MongoDB for the words, examples and votes.
  • Docker on Google Cloud Run, which scales to zero when it’s quiet and scales up when traffic spikes.