Separating the forum software into API and static website

AI-generated summary

In the “Dev” category, seekerOfPeace proposes separating the Discourse forum into two distinct modules: a REST API hosted on cloud services (e.g., AWS) and a static website hosted on free platforms like GitHub Pages. The user argues this architecture would facilitate mobile app development, reduce server load and data transfer, lower hosting costs, and simplify customization for those familiar with frontend technologies but not Ruby. Falco counters that this approach is unnecessary, noting that nginx serves static assets with minimal load and that existing CDN support already provides the cited benefits. Falco also clarifies that mobile apps can already connect directly to the existing API. Tom_Newsom reinforces this, labeling the idea a “non-starter” because the static content in a Discourse session is dwarfed by dynamic content; the client-side JavaScript app is transferred once, with subsequent interactions handled via the fully featured API. Tom_Newsom notes that while building a dedicated iOS/Android app is feasible, it remains a large project. Finally, mcwumbly adds context by citing eviltrout regarding the migration to ES6 modules and the move to ember-cli, suggesting the codebase is evolving in ways that might impact such architectural discussions.

Hi,

This is my first post. And i am new to this forum. Not sure if this question is asked before. My apologies if this question is repeated.

I was wondering if technically it is possible. That the Discourse forum could be separated into two components / Modules the REST API and the website.

Such that the API part can be hosted separately on cloud hosting services like Digital Ocean , AWS.
And the other part the website can be hosted separately on other hosting platforms which provide static website hosting.

gh-pages a hosting platform by github is a wonderful platform for hosting static websites. It is also free of cost.

This approach can have various Advantages.

  1. We can develop a mobile app like an Android app and a i-os app which could directly connect with the api.

  2. Reduced load and data transfer on cloud API server -

When the website part is hosted separately the server doesnt need to transfer the html and web pages. This could considerably reduce the data-transfer load on the api server.

  1. Reduction in overall Cost of Hosting and operating cost :

When the html/ javascript part is hosted on free hosting platforms like gh-pages. The data transfer through the api would be much less. Therefore it would enable us to host the forum on cloud server with lower memory and processing capacity.

  1. Easy to customise the forum - Most of the people doesnt know ruby and server side coding, But they might still know html / css and javascript. Therefore , by seperating the api and the website. It would make it much easier to customise the forum.

Right now also it is easy to customise the forum. but separation would make it more easier.

Anyway,

Any — Thoughts ? Inputs ? and suggestion.

You are severely overestimating the load nginx uses to serve static assets. It’s minimal. And using a CDN provides most benefits you list above, and is already supported.

You can do this already, just connect to the same api the website uses.

I’m only lightly familiar with the innards of Discourse, but I can say with some confidence that this idea is a non-starter. The static content in a discourse session is dwafed by the dynamic content. The client-side JS app is transferred once and from then on everything is done through the API.

That API is already completely fully featured so an iOS/Android app is perfectly feasible. It’s just a very big project so nobody’s done it yet.

Related:

And now this: