👋🏻 I’m built on xpander, let’s chat!
Chat

The API Contract Without the Server

APIs were designed around a simple deal: the frontend calls an endpoint, the backend returns data in a specific format. For decades, "backend" meant servers running business logic against databases. That assumption is breaking.

David Twizer

CEO xpander.ai

Nov, 2025

The Traditional Recipe

Build a recipe app the normal way and you need five layers. Frontend with grids and filters. API contract defining request and response shapes. Server implementing that contract. Database storing recipes and images. Migration scripts managing schema changes.

The API contract serves as the boundary:

{
  "recipes": [
    {
      "id": "string",
      "title": "string",
      "ingredients": ["string"],
      "prepTime": "number",
      "category": "string"
    }
  ]
}

Call GET /recipes?category=dinner and you get JSON matching this schema. The backend queries SQL, applies filters, formats data. The contract stays stable even if you swap databases or rewrite the server. This determinism is why modern software works.

What if your deterministic API returns the data from AI instead of the server?

Modern language models support "structured output" (e.g., OpenAIAnthropic, and even the AI Frameworks Agno, LangChain, etc.).

This feature configures the AI to return the schema 100% of the time, regardless of the input; it physically cannot output anything else. It's not that "it tries really hard." It is structurally impossible for the model to violate the constraint.

🧠 This means your API contract can be the schema you give the AI


The architecture collapses from Frontend → API → Server → Database to Frontend → AI.

The frontend still calls the same endpoint. It still receives the same JSON structure. What changed is everything behind that call.

What Happens Behind the Endpoint

Traditional server: parse request, run SELECT * FROM recipes WHERE category = 'dinner', transform rows to JSON, return response.

AI-backed server: receive request, reason about dinner recipes from training data and provided context, emit JSON matching the schema.

You can still wire the AI to actual data sources. It can call a search index, query a vector store, or hit a key-value cache. But from the contract's perspective, it is a single component that always returns valid structured data.

The difference becomes obvious when you add a new recipe. Traditional way: define schema migration, implement admin form, validate fields, handle image uploads, deploy changes. AI way: tell it "Add Spicy Lemon Chicken with these ingredients, tag it as quick and high protein, use this image." Next time the frontend calls for dinner recipes, the new recipe appears, properly formatted.

You are no longer forcing your thinking into normalized tables. You describe what you want and the system handles the structured representation.

The Memory Question

Traditional applications use databases as the source of truth. Servers are stateless and rebuild from database queries. This enables horizontal scaling.

AI-backed applications need three layers of memory. Transactional data like payments and compliance records still belongs in traditional databases with ACID guarantees. Application memory like catalogs and preferences can live in vector stores, document stores, or the AI platform's memory system. The context window contains the subset of information passed to the model for each request.

The trade is "design normalized schemas and write insertion logic" for "design what the AI remembers and how you retrieve relevant context." A recipe in a database is a row. A recipe in AI memory is something the system can describe, compare, modify, and reformat depending on the query.

Development Flow

Define the contract first, exactly as before. Configure the AI to only return data validating against that schema. Feed it domain knowledge through sample recipes and categorization rules. This replaces your business logic layer.

Test with golden cases and edge conditions. Update behavior by changing instructions rather than code. Want healthier recipes prioritized? Adjust the instructions. Want shorter descriptions? Change the style rules. The frontend keeps calling the same endpoint.

Your content management tool can be a chat where editors describe changes in natural language. The AI handles normalization automatically.

Microservices as Configured Instances

Each microservice becomes an API contract plus a configured AI instance plus minimal storage. Recipe Service AI knows about meals and dietary preferences. Image Service AI knows about storage and variants. Community Service AI knows about comments and moderation.

They communicate through the same contracts you would design traditionally. Business logic becomes configured behavior instead of conditional code. You still need infrastructure for hosting, authentication, and storage. The imperative business logic largely disappears.

When This Works

This pattern fits when your data is content or knowledge rather than financial transactions. When the UI needs flexible exploration instead of strict CRUD. When requirements change often and you want to modify behavior without redeployments. When teams are small and need to ship fast.

It fits poorly when you need transactional guarantees, heavy regulation, tightly controlled costs at extreme scale, or debugging that maps to exact code paths.

The Shift

Keep the API contract as your stable interface. What fulfills it changes from handwritten business logic querying a database to an AI constrained by your schema and powered by your tools.

From the frontend perspective, nothing changed. From the architecture perspective, you removed an entire layer and replaced it with a configurable engine that still behaves like an API. The backend is no longer code you write. It is behavior you configure.

Autonomous agents run
reliably on xpander.ai

Everything you need to build, deploy, and scale your AI agents

© xpander.ai 2025. All rights reserved.

Autonomous agents run
reliably on xpander.ai

Everything you need to build, deploy,
and scale your AI agents

© xpander.ai 2025. All rights reserved.

Autonomous agents run reliably on xpander.ai

Everything you need to build, deploy, and scale your AI agents

© xpander.ai 2025. All rights reserved.