Relationship between frontend and backend #9025
Replies: 2 comments 1 reply
-
Thanks @jardakotesovec. Of your three options, I would choose the third: leverage intertia.js or similar to keep the routing and controllers server-side, and use a REST API to fetch key data on the page. Here is a little more about why I've come to that view.
Our long-term goal is that someone who doesn't know PHP/Vue can build their own app that interacts directly with our API. Some use cases would be: using a static-site generator to build the frontend; integrating third-party typesetting, review, or editorial tools and services; indexing publishing material in third-party services; creating high-level dashboards that aggregate data from several journals. Although we haven't seen much of this done by our community so far, it is important in order to serve more of the high-profile (and well-funded) publications currently captured by the major publishers.
With a distributed deployment like ours -- where everyone runs their own instance of the software -- performance is really, really hard to achieve throughout the community. This is one place where PKP suffers a lot in comparison to our competitors.
|
Beta Was this translation helpful? Give feedback.
-
@NateWr Thank you for additional context and any follow-up thoughts are also very much appreciated :-). After spending some time on the code base and learning more context, there are still two relatively nuanced options where to aim with architecture. And would really appreciate team feedback on that. I will use submission listing as example, as thats currently what I am most familiar with, but same principles could apply for others as well. Note that I intend to process query params on the /index.php/publicknowledge/submissions to be able bookmark/share any state of submission listing (certain filter selected, certain view selected). Option1
Option2
Options2 would basically result in leveraging Inertia.js, which allows for partial reloads, so we would be fetching submissions from the /submissions the whole time, just changing query params. And query params would be handled on PHP side. The difference is really just initial load difference on very slow connections and where the query params will be handled. Personally I would be inclined towards option1 for following reasons:
|
Beta Was this translation helpful? Give feedback.
-
If we think about where we would like to be in ~3 years with the admin interface from frontend & backend relationship point of view. Goal I assume is probably to frontend be (for admin) just Vue.js, without additional templates that are server side rendered.
In terms of backend&frontend interaction, I think its either going to be:
Comparison is quite well captured https://laravel.com/docs/10.x/frontend#using-vue-react .
Since new submission interface is the first use case I am looking into - let use that as example what it could mean in practice.
For this submission listing, there is quite a lot of data needed.
To get all the data to the page we could take following routes:
Create dedicated API endpoints, for all these different kind of data.
Expose data via graphql
you get convinience of one request from client.. this becomes harder on api side of things.
Use Inertia.js and collect all the data in controller needed for submission list + potentially some individual endpoints for some data.
All these approaches are quite reasonable, so its not straightforward to pick one. I think one of the determining factors is how much public API actually would be useful. There are certainly cases which should to be covered via public API, but not sure how many.
Beta Was this translation helpful? Give feedback.
All reactions