Page MenuHomePhabricator

RFC: Clean frontend - backend separation; make all frontends API consumers
Closed, DeclinedPublic

Description

A task to explore the advantages and disadvantages of separating all front-ends / skins from the data / API layer. For the purpose of this task, the frontend is the code that

  • adds the chrome around the content (language links, tool links, footer, user tools), and
  • renders special pages.

Advantages

  • Introduces a well-defined interface between frontend & backend
    • Improves testability
    • Reduces the amount of code front-end developers need to understand
  • Drives API improvements (performance and features), which in turn can make our front-end development more flexible
  • Can power single-page-app front-ends with server-side pre-rendering for first load
  • Enables faster testing of UIs and Frontends without using a backend (fixtures)
  • Enables and empowers non-web interfaces like native apps on iOS, Android, etc.

Disadvantages

  • Performance, if not done well
  • Migration cost

See also

Event Timeline

GWicke raised the priority of this task from to Needs Triage.
GWicke updated the task description. (Show Details)
GWicke subscribed.
GWicke set Security to None.
GWicke updated the task description. (Show Details)
GWicke renamed this task from Clean frontend - backend separation; make all frontends API consumers to RFC: Clean frontend - backend separation; make all frontends API consumers.Feb 2 2015, 6:47 PM
GWicke added a project: TechCom-RFC.
GWicke updated the task description. (Show Details)
GWicke removed a subscriber: Aklapper.
daniel moved this task from (unused 2) to Declined on the TechCom-RFC board.

Re-opened as the focus of RobLa's RFC (T89889) seems to be more on internal MW refactoring, and less on building front-ends on top of APIs that are also exposed to other services and clients.

Reading this, and more so reading comments by the author at the recent RFC meeting for T89889, I find this RFC unclear.

For example, MediaWiki PHP code implementing a frontend page should be calling the "API" provided by MediaWiki PHP "controller" classes. It should not be calling the "API" provided by ApiBase subclasses, or be calling ApiMain, or be using curl to hit api.php. On the other hand, using curl or something like it to hit api.php would be appropriate for code external to MediaWiki, since that code doesn't have direct access to call the PHP controller classes.

I'm not sure whether this RFC as currently written is ignoring that internal/external distinction or is assuming/advocating a complex Hurd-style architecture where effectively everything has to go through layers of IPC.

This RFC has been inactive for more than two years now. In the light the outcome of T169266: Clarify recommendations around using FauxRequest, it should probably be declined. The desire to have a clear separation between frontend (presentation) and backend (application logic and storage) has merit, but that is covered sufficiently by T89889: RFC: Service split along presentation vs data manipulation line.

Krinkle moved this task from Old to Declined on the TechCom-RFC board.

Like T89889, closing in favour of T111588: RFC: API-driven web front-end.

TechCom generally prefers smaller RFC as opposed to one very large RFC, such such merging may seem odd. But in this case, neither of the three related proposals is more or less specific, all three are broad and generic, and this should help consolidate the efforts. I imagine that T89889 will likely turn from an RFC into a tracking task with individual RFC being spawned from it as we go.