← Back to all frameworks MERN + API

REST + GraphQL

Schema-first APIs — REST for simplicity, GraphQL for typed contracts

What it is

Two API styles, picked per use case. REST for public APIs and webhooks; GraphQL for typed internal contracts where the frontend wants to ask for exactly what it needs.

How Vaaani uses it

  • REST endpoints for partner integrations and webhooks
  • GraphQL with Apollo for React frontends with deep nested data
  • OpenAPI specs auto-generated for SDK clients
  • Persisted queries for production GraphQL safety

Why it makes the cut

REST is forgiving and universally understood. GraphQL kills overfetching. The right choice depends on who's consuming your API.

Sample code

type Query {
  chat(id: ID!): Chat
  chats(userId: ID!): [Chat!]!
}

type Chat {
  id: ID!
  messages: [Message!]!
  agent: Agent!
}

Related in the Vaaani stack

Have a project that needs REST?

30-min discovery call. You describe the busywork; I map it to an AI worker and a budget.