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

推荐订阅源

月光博客
月光博客
J
Java Code Geeks
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
U
Unit 42
B
Blog
宝玉的分享
宝玉的分享
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - Franky
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
The GitHub Blog
The GitHub 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
Stop Writing Endpoints. Start Defining Systems.
Drew Marshal · 2026-05-08 · via DEV Community

For a long time, I thought building APIs meant writing endpoints.

You know the pattern:

  • Define a route
  • Validate input
  • Query the database
  • Transform the result
  • Send a response

Do that over and over again.

Different routes. Same structure.


The Illusion of Control

Writing endpoints feels productive.

You’re in control of everything:

  • The logic
  • The validation
  • The data flow

But after a while, something becomes obvious:

You’re not building systems.

You’re repeating patterns.


The Real Problem

Most APIs look like this:

app.get('/users/:id', async (req, res) => {
  const id = req.params.id;

  if (!id) {
    return res.status(400).json({ error: 'Missing id' });
  }

  const user = await db.users.findById(id);

  if (!user) {
    return res.status(404).json({ error: 'Not found' });
  }

  return res.json(user);
});

Enter fullscreen mode Exit fullscreen mode

Now multiply that by:

  • Dozens of endpoints
  • Multiple resources
  • Different validation rules
  • Slight variations in logic

You end up with:

  • Repeated code
  • Inconsistent patterns
  • Hard-to-maintain systems

You’re Not Writing Logic. You’re Rewriting Structure.

Look closer at most endpoints.

They follow the same shape:

  1. Extract input
  2. Validate input
  3. Execute query
  4. Handle errors
  5. Return response

The structure doesn’t change.

Only the details do.

So why are we rewriting the structure every time?


The Shift: Define, Don’t Rewrite

Instead of writing endpoints…

Define them.

What if your API looked like this instead?

get:
  user:
    GetUserById:
      input:
        id: number
      where:
        id: $param.id
      response:
        id: number
        name: string
        email: string

Enter fullscreen mode Exit fullscreen mode

No route handler.

No repeated boilerplate.

Just a definition.


What This Changes

When you define systems instead of writing endpoints:

  • Structure becomes consistent
  • Validation becomes automatic
  • Queries become predictable
  • Behavior becomes visible

You’re no longer guessing how something works.

You can read it directly.


From Endpoints to Systems

Traditional approach:

  • Every endpoint is custom
  • Logic is scattered
  • Behavior is implicit

System-driven approach:

  • Endpoints follow a pattern
  • Logic is structured
  • Behavior is explicit

You move from “code-first” to “contract-first.”


Where the Code Goes

This doesn’t eliminate code.

It moves it.

Instead of writing endpoint logic repeatedly…

You write:

  • A compiler that reads definitions
  • A pipeline that executes them
  • A system that enforces rules

Code becomes the engine.

Not the repetition.


Example Flow

With a system-driven approach, a request might flow like this:

Request → Parse Definition → Validate → Build Query → Execute → Format Response

Enter fullscreen mode Exit fullscreen mode

The difference is:

  • The flow is constant
  • The behavior is defined in configuration

Why This Matters

Without this approach:

  • Every developer writes endpoints differently
  • Bugs are repeated across routes
  • Refactoring becomes painful

With this approach:

  • Patterns are enforced
  • Behavior is predictable
  • Systems scale cleanly

“Isn’t This Less Flexible?”

Yes.

And that’s the point.

Unlimited flexibility leads to:

  • Inconsistency
  • Complexity
  • Fragile systems

Constraints lead to:

  • Clarity
  • Stability
  • Speed

Where This Fits

This kind of system works best when:

  • You have repeated CRUD patterns
  • You want consistent APIs
  • You care about long-term maintainability

It doesn’t replace every use case.

But it replaces most of the boring, repetitive ones.


The Bigger Idea

This isn’t just about APIs.

It’s about how we build software.

Instead of:

  • Writing everything manually
  • Repeating patterns
  • Hoping for consistency

We can:

  • Define systems
  • Enforce structure
  • Let the engine handle execution

Final Thought

Writing endpoints feels like control.

But it’s often just repetition.

Defining systems feels restrictive at first.

But it leads to something better:

Clarity.

Consistency.

Scalability.

That’s why I stopped writing endpoints…

…and started defining systems.