Skip to content
Glog ME
All posts

One origin for the site, the dashboard and the API

Why the marketing site, the web app and the API are all served from the same address, and what that makes simpler.

Published:

Many products split themselves across several addresses: one for the marketing site, one for the app and one for the API. It works, but each boundary adds something to configure and something that can go wrong.

Here, a single address serves all three:

  • / is the marketing site you are reading now
  • /app is the dashboard people use after signing in
  • /api is the API that the dashboard and the mobile app talk to

What gets simpler

Sign-in just works. Session cookies belong to one origin, so there are no cross-site cookie rules to fight and no tokens to pass between subdomains.

No CORS configuration. The browser treats every request as same-origin. A whole category of confusing errors never appears.

One deploy. The site, the dashboard and the API ship together, so they can never be out of step with each other.

What stays separate

The marketing site is still its own small project. It is built as plain HTML ahead of time, so search engines and link previews see complete pages, and visitors get them almost instantly.

The dashboard is an application, and it behaves like one: it loads once and then talks to the API. Keeping the two apart lets each be good at its own job.