惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
V2EX - 技术
V2EX - 技术
P
Privacy & Cybersecurity Law Blog
T
The Exploit Database - CXSecurity.com
美团技术团队
WordPress大学
WordPress大学
博客园 - 司徒正美
S
Securelist
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
Attack and Defense Labs
Attack and Defense Labs
Security Latest
Security Latest
L
LINUX DO - 最新话题
NISL@THU
NISL@THU
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Y
Y Combinator Blog
The Hacker News
The Hacker News
Security Archives - TechRepublic
Security Archives - TechRepublic
IT之家
IT之家
T
Threatpost
Hugging Face - Blog
Hugging Face - Blog
Scott Helme
Scott Helme
S
SegmentFault 最新的问题
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
小众软件
小众软件
V
Vulnerabilities – Threatpost
J
Java Code Geeks
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
S
Security @ Cisco Blogs
雷峰网
雷峰网
Help Net Security
Help Net Security
The Last Watchdog
The Last Watchdog
Recent Announcements
Recent Announcements
G
Google Developers Blog
C
CERT Recently Published Vulnerability Notes
T
Troy Hunt's Blog
MyScale Blog
MyScale Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Before You Write a Single Line: How to Plan Your API Like a Senior Engineer
Wongsaphat Nakmuang · 2026-06-08 · via DEV Community

In my second week at work, I watched a senior engineer spend 3 days refactoring an API that took 1 day to build.

The endpoint worked. The logic was correct. The code was clean.

But halfway through integration, the frontend team came back with a list of questions:

  • "Why does this return a nested object here but a flat array there?"
  • "Where's the pagination? We assumed it would be paginated."
  • "What does error code 14 mean?"

Nobody planned it. Everyone assumed. And three days of refactoring followed.

That week I learned something more valuable than any syntax or framework:

The most expensive code to write is the code you have to rewrite.


Why Most Developers Skip Planning

It's not laziness. Nobody taught us this part.

Tutorials teach us how to build an API. They show us frameworks, authentication patterns, database queries. But they almost never show us what happens in the 30 minutes before the first line of code — the thinking, the questioning, the scoping.

So we do what feels natural: we open VS Code and start.

The result is usually the same. We build fast, hit unexpected problems, patch things, and ship something that technically works but is painful to maintain, extend, or explain to anyone else.

Here's the process I've been learning — 5 steps that happen before a single endpoint is written.


Step 1: Define "What Is This API?" in One Sentence

Before anything else, you need to answer three questions. If you can't answer all three clearly, you're not ready to start.

Who will call this API?

  • A frontend web app?
  • A mobile client?
  • Another backend service?
  • A third-party developer?

The answer changes everything — response structure, authentication method, error detail level.

What does it do?

  • Can you explain it in one sentence to someone who isn't a developer?
  • If your answer is longer than two sentences, the scope is probably too broad.

Why does it need to exist?

  • Does something similar already exist in the codebase?
  • Are you solving a real, confirmed need — or building something "that might be useful"?

💡 My rule: If I can't explain this API to my mom in 30 seconds, I don't understand it well enough to build it yet.


Step 2: Draw the Scope Before Writing Endpoints

Get a piece of paper. Or open a blank Markdown file. Or use Miro. The tool doesn't matter.

Draw the resources your API will manage and how they relate to each other.

Example — a simple task management API:

Resources:
- User
- Project  
- Task
- Comment

Relationships:
- User has many Projects
- Project has many Tasks
- Task has many Comments
- Task belongs to one User (assignee)

Then for each resource, define what operations are actually needed right now:

Task:
  ✅ GET    /tasks          → list tasks (with filters)
  ✅ POST   /tasks          → create task
  ✅ GET    /tasks/:id      → get single task
  ✅ PATCH  /tasks/:id      → update task
  ✅ DELETE /tasks/:id      → delete task

  ❌ GET    /tasks/archive  → not needed yet, skip
  ❌ POST   /tasks/bulk     → not needed yet, skip

The most important discipline here is cutting scope ruthlessly.

Every "nice to have" endpoint you add now is technical debt you'll maintain forever. Build what's confirmed needed. Add the rest later when there's actual demand.

💡 The question that saves hours: "Is this needed for the first release, or is it something we think might be useful someday?"


Step 3: Identify the Risks Before You Estimate

This is the step that most junior developers skip — and it's why our estimates are almost always wrong.

Before you write a single line, spend 15 minutes asking: "What don't I know yet?"

Go through this checklist:

Authentication & Authorization

  • Does this API require authentication? What kind? (JWT, API Key, OAuth?)
  • Are there different user roles with different permissions?
  • Which endpoints are public? Which are protected?

Data

  • Where does the data come from? An existing database? A new one?
  • What does the current schema look like? Any constraints?
  • Are there existing APIs that touch the same data?

Scale

  • How many requests per day is realistic?
  • Does any endpoint need pagination?
  • Are there operations that could be slow? (File uploads, external API calls, heavy queries)

Dependencies

  • Does this API call any external services? (Payment gateway, email, SMS)
  • What happens if those services are down?

Every risk you find now is a problem you won't have to solve at 11pm the night before the deadline.

💡 Real talk: When I got my first API task, I estimated 2 days. I hadn't asked about authentication, pagination, or the fact that the data came from a legacy system with an unusual schema. It took 5 days. The 30 minutes of risk identification would have saved me 3 days of surprises.


Step 4: Write the Contract Before the Code

A contract is not code. It's a simple document — can be Markdown, a Notion page, a whiteboard photo — that describes what each endpoint will accept and return.

Here's what a contract looks like for one endpoint:

POST /tasks

Description:
  Create a new task and assign it to a project

Request Body:
  {
    "title": string (required, max 200 chars)
    "description": string (optional)
    "projectId": uuid (required)
    "assigneeId": uuid (optional)
    "dueDate": ISO date string (optional)
  }

Success Response (201):
  {
    "status": "success",
    "data": {
      "id": uuid,
      "title": string,
      "status": "todo",
      "createdAt": timestamp
    }
  }

Error Cases:
  400  missing required fields
  404  projectId not found
  403  user doesn't have access to this project

Writing this takes about 10 minutes per endpoint.

The benefit is immediate: your frontend teammate can start building mock responses the same day — without waiting for you to finish the backend. You're no longer a blocker.

And when you sit down to write the actual code, you already know exactly what you're building. No decision fatigue. No ambiguity. Just execution.

💡 Pro tip: Show this contract to your frontend dev before you start coding. If they have questions or "that's not quite what I need" feedback — far better to discover that now than after you've shipped.


Step 5: Consult and Align With Your Team

This is the step most tutorials never mention. And it's the one that separates developers who work well in teams from those who don't.

Before you write the first line of code, take your contract and your scope document and show them to someone.

Questions to ask:

To your senior engineer or tech lead:

  • "Does this approach make sense? Is there anything I'm missing?"
  • "Are there patterns in this codebase I should follow?"
  • "Do you see any risk I haven't thought of?"

To your frontend developer (if there is one):

  • "Does this response structure work for what you're building?"
  • "Is there anything you need that isn't here?"

To yourself (seriously — write it down):

  • "Can I explain this to someone in 2 minutes?"
  • "If I was sick tomorrow, could someone else pick this up?"

Asking "am I thinking about this the right way?" before writing code is not a sign of weakness. It's a sign of someone who understands that software is built by teams, not individuals.

I used to think asking questions made me look junior. Now I think the most senior thing you can do is make sure everyone is aligned before anyone starts building.


Putting It All Together

Here's the full process in a quick reference:

Step Action Time
1. Define Answer Who, What, Why 15 min
2. Scope Draw resources + cut ruthlessly 20 min
3. Risk Find the unknowns before they find you 15 min
4. Contract Write what each endpoint accepts + returns 10 min/endpoint
5. Align Show it to someone before coding 15 min

Total: roughly 1–2 hours depending on complexity.

That 1–2 hours will save you many times that in rework, confusion, and late-night debugging.


This Connects Back to Article 1

In my first article, I wrote about designing APIs with consistent error responses, proper status codes, and clean naming.

Those principles matter. But they only work if the foundation is right.

Planning is that foundation.

You can't consistently design good error responses if you didn't think through what errors were possible in the first place. You can't name things clearly if the scope isn't clear. You can't build something maintainable if no one agreed on what it should do.

Plan first. Then design. Then build.


What I'm Still Learning

Honestly — I'm still figuring out how much planning is "enough."

Too little and you're building the wrong thing. Too much and you're in planning paralysis, never shipping anything.

I don't have the answer yet. But I think the right amount of planning is: enough that your whole team can start without blocking each other.

What does your planning process look like? Do you have a system, or do you figure it out as you go? Drop it in the comments — I'm genuinely curious how more experienced engineers approach this. 🙏


Also

If you want a ready-made checklist to run through before building your next API, I put one together on GitHub:

👉 API Design Checklist — github.com/Bee34949/api-design-checklist

It's a living document — I update it as I learn. Contributions welcome.


Following along? I post about Backend Engineering and API Design — in both English 🇬🇧 and Thai 🇹🇭. See you in the next one. 🌱