[GTPS][WEB] Backend, Server, and API

Backend, Server, and API

As the GTPS web stack grows in complexity, it becomes important to clarify fundamental terms: backend, server, and API. During internal architecture planning, a few core questions came up — and answering them helped build a clearer mental model.


Is “API” the same as “backend”?

Not quite.

API is the part of the backend that is exposed to the client.

In GTPS, the backend (e.g., Flask) contains all the business logic, DB access, and auth layers. The API is just the interface part — like GET /api/games or POST /api/login — that the frontend (or mobile app) uses to interact with that logic.

So "backend" is broader; "API" is the outward-facing surface.


Backend vs Server

These are often used interchangeably, but here’s a useful way to think about it:

Backend is like a class. Server is like an instance of that class.

  • Backend: The logic, routes, functions, and models (code)

  • Server: The running process (e.g., Flask dev server, Gunicorn, Uvicorn) that actually handles client requests

In deployment, the server is the unit being scaled, monitored, or containerized — while the backend is the logic it's running.


Pure API backend

Currently, GTPS uses Flask to both:

  • Render index.html (frontend)

  • Serve data as JSON (backend)

This means the backend isn’t a “pure API” yet — it also handles HTML templates.

A pure API backend:

Only responds to client requests with JSON or similar data formats.
No rendering. No templates. Just logic and data.

This is the direction GTPS is heading, especially as frontend and backend separate into independent services.


Why use the /api/ prefix?

Even if the frontend and backend are separate apps or deployed on different servers, using a prefix like /api/ is considered good practice.

Reasons:

  • Clean and predictable routing

  • Easy to configure proxies or CORS rules

  • Prevents route collisions (e.g., /login vs /api/login)

  • Improves code clarity when multiple services are involved

So instead of:

GET /games

Prefer:

GET /api/games

It’s conventional, not required — but makes everything easier to manage and scale.


Server API vs Client API

  • Server API: The backend’s public endpoints (typically HTTP/REST)

  • Client API: JS modules or wrappers used in the frontend to interact with the server (e.g., fetch('/api/games'))

So GTPS may end up having a client API layer (in JavaScript or Flutter) that talks to the server API via well-structured calls.


Comments