building my first api: what actually broke

28 April 2026 · 5 min read

i thought building an api would be straightforward. it wasn’t.

validation matters more than logic

most issues came from bad input, not complex code.

app.post('/api/link', async (req, res) => {
  const { url } = req.body;

  if (!url) {
    return res.status(400).json({ error: "url required" });
  }

  // create short link
});
      

simple checks like this saved hours later.

diagrambasic flow of request handling

database decisions matter early

i redesigned my schema twice because i didn’t think about queries.

simple systems scale better than clever ones.

closing

small project, but it changed how i think about backend systems.