mysociety / popit

DEPRECATED - Development on PopIt has stopped and it is no longer being maintained
https://goo.gl/Vvej4Q
Other
76 stars 33 forks source link

Decoupling the API and the UI #837

Open chrismytton opened 9 years ago

chrismytton commented 9 years ago

Problem

Currently the API and the UI are very tightly coupled. The logic for auth and instances lives in the UI (this repository), which makes it very tricky to provide things like a JSON list of instances (#777, #792) or allow instance creation over the API (#748). There are also two sets of popolo models which have slightly different behaviour, which has been the source of more than one bug in the past (#264).

Plan

The plan is to tease this repository and popit-api apart so that the main bulk of the logic sits in the API and the UI only interacts with the API using https requests. Once the logic for instance management and auth is in the API it makes it much easier to provide OAuth logins (#113) and the UI can essentially just be another OAuth client, probably using the Resource Owner Password Credentials Authorization Grant.

Steps

In order to achieve the above goals the following things will need to be tackled: