Finish API/UI separation
Overview
For now we're on our way to separate API and UI. In this issue I'll describe:
- current status
- further steps
- optional steps
Current status
- we have all frontend related things inside the
frontendfolder:- index.html (with jinja2 injection tags inside)
- components
- styles
- images
- fonts
- we have some flask endpoints already rebased on returning only data approach (API):
- /api
- /api/job/(id)
- /api/job [POST]
- /api/job
- /github/api/sync_account
- /github/api/repo
- /github/api/repo/(id)
- /github/api/repo/(id)/activate
- /github/api/repo/(id)/deactivate
- /s3/api/bucket
- /s3/api/bucket [POST]
- /s3/api/bucket/(id)
- /s3/api/bucket/(id) [DELETE]
- /s3/api/bucket/(id)/activate
- /s3/api/bucket/(id)/deactivate
- we have some classical flask endpoints returning html. In cases when frontend component should be returned from one of this endpoints it uses jinja2 template included in
index.htmlto inject proper component (WEB):- /
- /dashboard
- /jobs
- /jobs/(id)
- /user
- /user/login/(provider)
- /user/login/(provider)/authorized
- /user/logout
- /github
- /github/repo/(org)
- /github/repo/(org)/(repo)
- /github/settings
- /github/hook
- /s3
- /s3/settings
- /s3/hooks
Further steps
- review how our API works (main + integrations) in terms of consistency (unified paths, methods, codes, error handling etc)
- move to API the endpoints not returning html:
- /user/login/(provider)
- /user/login/(provider)/authorized
- /user/logout
- /github/hook
- /s3/hooks
- rebase on centrilized frontend state management if needed (
vuex) - update frontend components to work with login/logout endpoints
Optional steps
- move to API the endpoints returning html (should be refactored to proper API endpoints, split per entity etc):
- /
- /dashboard
- /jobs
- /jobs/(id)
- /user
- /github
- /github/repo/(org)
- /github/repo/(org)/(repo)
- /github/settings
- /s3
- /s3/settings
- rebase on frontend router (
vue-router) - rebase frontend dev on true live reloading/hot-module-replacement
- split repo on backend/frontend repos or rename
goodtablesiofolder tobackend(should be extracted to another issue for further discussion)
@pwalsh @amercader I've added a full description to the first post
Hey @roll this is a great writeup, thanks. I think, in order to get to estimable units, the info in here needs to be broken down into different locations. For example:
- All the API endpoint info - as a doc page
- All the non-api data provision routes - as a distinct issue to convert them
- All work on getting remaining stuff out of jinja and into vue - as a distinct issue
- Update frontend components to work with login/logout - sounds like it is hiding a problem, so might need a distinct issue, otherwise, with the above point in that issue
Then there are other points that are not really that important, and should go to the backlog:
- frontend state management and routing - backlog issue
- frontend dev setup (live reloading etc.) - I honestly do not think it warrants an issue, it is just part of setting up for frontend development, but, if we need to track it as an issue - on the backlog
- split repo to front/back - backlog issue
@pwalsh Yes definitely should be broken before next iteration. We'll catch with @amercader on it when it will be actual.
PS. About login/logout - to clarify - there is no problem with it in current state of the app. And will not be after rebase on API. So I've just presented is as ordered steps:
- first we move login/logout logic to API
- second we have to sync frontend with this changes (query
api/loginorapi/logoutinstead of getting props from the server) - third we probably need some global data store because different component have to know login/logout status (now all getting it as prop from the server)
So it could be a prototype for an issue we will extract from this one.
question, will the split between API and UI mean a change on how the authentication works? ie would it still be cookie based as now or we need to migrate to something else (JWT?)