elixir phoenix liveview

Elixir vs REST API: Do You Need an API at All?

Daniil Popov November 26, 2026

"Do we need to build the API first?" is a fair question when you start a product. The usual advice says yes: a backend with a REST API, and a React app on top. If you look at Elixir, you want to know if that changes.

It does, a bit. But first the search itself: "elixir vs rest api" compares two things that live on different levels. Elixir is a programming language. REST is a style for designing HTTP APIs. You can build a REST API in Elixir, and plenty of people do. The real question is whether your product needs one.

Building a REST API in Elixir

Phoenix, the Elixir web framework, has a whole guide on JSON APIs. You can create an API-only app by leaving out the HTML parts (the guide calls --no-html "the obvious one we want to use"), and then generate a full JSON resource with one command:

mix phx.gen.json Urls Url urls link:string title:string

That gives you the routes, the controller, the JSON views, the database schema and the tests. If you prefer GraphQL, Absinthe is the standard Elixir library for it.

So if you need an API, Elixir is a good place to build it. Lots of concurrent connections are what the BEAM does well.

Do you need one, though?

Here's where I disagree with the default advice.

A REST API makes sense when someone else consumes it: a mobile app, a partner, a public developer platform, another company's system. Then the API is the product, or part of it, and it deserves the care.

It makes much less sense as the glue between your own backend and your own web frontend. That glue costs a lot. Every feature needs an endpoint, a serializer, a client-side fetch, loading states, error states, and the same validation written twice. Two codebases, often two people, and a meeting about the JSON shape.

With Phoenix LiveView the web UI renders from the server. The state lives in Elixir data structures on the server, and a persistent connection pushes changes to the browser. There's no internal API to design, version or document. One engineer builds the feature from the database to the screen.

In our accounting SaaS migration the React frontend talked to a FastAPI backend over REST. After the move to LiveView, the frontend code went from 18,797 lines to 1,330. Part of what we deleted was that glue, the Redux store included.

A rule of thumb

  • Web app only, your team builds both sides: skip the internal API, use LiveView.
  • Web app now, mobile app later: start with LiveView, add a JSON API for the mobile app when it's real. Phoenix runs both in the same application, using the same business logic.
  • Partners or customers integrate with you: build a proper REST or GraphQL API, document it, version it.
  • Public API is the product: design the API first, everything else after.

The mistake I see most is building case two as if it were case four, years before the mobile app exists.

Side by side

Elixir REST
What it is Programming language on the BEAM Design style for HTTP APIs
Can you combine them? Yes, Phoenix builds REST APIs Yes
Alternatives Python, Ruby, Node.js, Go GraphQL, gRPC, server-rendered UI
When to use Real-time, concurrent, small team When others consume your data

Planning a new product?

If you're about to start an MVP and someone quoted you a separate backend, API and frontend, ask what the API is for. We build MVPs in Elixir as one codebase and add an API when a real consumer shows up. If you already run REST between your own services, the gRPC post covers the service-to-service side.

Share