Decouple frontend to simplify onboarding for frontend developers #7181
Replies: 14 comments
-
Hello @anuveyatsu ! How are you? How do you envision a decoupling frontend for CKAN and what are the next steps you suggest for it? Current CKAN Architecture can be defined as a 3-Tier architecture and it provides a rich logic layer and API to access all the important business logic. This means that in theory, regardless of CKAN shipping with a built-in front end other decoupled systems can be designed and developed. CKAN API is well documented and quite stable so they can be mocked to work on a decoupled front end. Now, I'm conscious that our layers are not truly independent and there are some business in the model and model in the business that might become pain points for other decoupled frontends so that's why it would be nice if you can expand your initial thoughts. I know that there are some current efforts to build a decoupled front end like https://github.com/datopian/portal.js so I'm wondering what are your thoughts on what do you envision in the practice as a decoupled CKAN. Would you like to do a presentation in the Dev Meeting with all the work you are doing so we can explore better your ideas? Another question that pops in my mind: What thing of the current CKAN implementation does not allow to build a decoupled front-end? If someone wants to build a decoupled one, what can we do different to support that effort? Looking forward to keep the discussion! |
Beta Was this translation helpful? Give feedback.
-
Hey @pdelboca thanks for the detailed feedback 🙏🏼
I think I'd start with this question - nothing stops people building decoupled frontends. Probably, what hesitates teams to do so is the fact that CKAN is shipped with frontend built-in which means if there are changes in frontend (e.g., new features added or bugs fixed), they wouldn't get it via upgrade but would need to make extra effort to re-build it themselves etc. To summarize, it creates uncertainty about how it is going to be managed in the future. I agree that in theory anyone could use their preferred framework and build their desired frontends that works for their team's tech stack. We've seen number of examples using React, Next, Vue, Wordpress etc. I believe some of them have built great UI/UX for both publishers and consumers of the datasets. But I still think that major part of developers building on CKAN had the following experiences (this is based on my personal experience working with different clients / our own developers at Datopian etc.):
This needs discussion but my first thoughts would be:
Roughly:
The frontend app would use something common/popular today. I think we could have it as a test for next steps and see what would be number of contributors from the community, e.g., those who never did a contribution to the To sum up, I think we could simply start a new
Yes, I wouldn't mind doing so, if people are interested in exploring more in this direction. |
Beta Was this translation helpful? Give feedback.
-
Interesting thoughts @anuveyatsu and definitely worth exploring for upcoming CKAN versions. Some follow up thoughts... Given two repositories
Basically, current workflow of CKAN work is the following:
One of the key features of CKAN is the plugin and extensions ecosystem. How do you envision the interaction of plugins ecosystem with a new decoupled schema? |
Beta Was this translation helpful? Give feedback.
-
I think that a quick MVP pilot to simulate how CKAN workflow would be under the new decoupled schema is key to analyze the viability of the solution. I'm thinking on simulating a scenario that:
It doesn't need to be fancy, just to provide an insight on how the architecture and the interaction between plugins would be. Do you think the current ecosystem of decoupled frontends is mature enough to do it? If not, do you think you can provide a quick pilot simulation? |
Beta Was this translation helpful? Give feedback.
-
Again, great comments 👍🏼 @pdelboca appreciate these questions and you raised important points from the maintenance and development perspectives. First, note that in the frontend app, there might be different approach for extending, not exactly how we do it for CKAN app. Generally, what we are discussing here is making CKAN a headless tool. We can compare this against how CMS softwares are approaching it. For example, a headless CMS's main goal is to provide content and expose it via API so that you can use any frontend technology. In CKAN, we could take similar approach which would mean publisher and consumer (regular user) UIs are separated (more about it below). In CKAN, we have 2 main groups of users - Data Publishers and Users:
So the main questions to me:
Option A: both UIs in the single decoupled frontend appThis option would mean we would need to have all UI in the single app including the extensions, e.g., Option B: UIs are separated, publisher UI remains in the python appThis is the easiest and quickest way to go right now. E.g., the main CKAN app doesn't change and we simply create frontends (e.g., templates and it can be in multiple popular frameworks). Users then can build on top of these templates. Option C: UIs are separated, publisher UI is also decoupledThis option probably is the next step following Option B. Since user UI is decoupled, there is no need to have home page, search page etc in the Publisher UI and it can be focused on things like inventory, dataset management, user management etc. Could be another decoupled app which would focus on specific thing - Publisher or Admin UX. |
Beta Was this translation helpful? Give feedback.
-
Helllo @anuveyatsu ! One thing that worries me about the decoupled architecture is the extensibility and re-usability of the tools. CKAN is not a data portal, but a framework to build ones. CKAN is to Data Portals what Flask/Django are for websites. Said that, The goal is to provide a core that allows other partners to build on it and share. IMHO, the modular and extensibility is a key feature of CKAN that needs to be maintained. ExampleLet's look at
How would you approach a development of such extension in a decoupled ecosystem that also allows a "plug-and-play" into other implementations? |
Beta Was this translation helpful? Give feedback.
-
The suggestion is to replace jinja2 with "React/Angular/Vue/etc." and @pdelboca has highlighted the most important questions about this change. Jinja2 is not perfect. Our jinja2 templates create a very large interface that is difficult to change without breaking backwards compatibility, and our custom tags like However, jinja2 template have proven themselves in allowing multiple plugins to extend all parts of the UI, along with complete site theme changes. They've done this while allowing broad compatibility across plugin and ckan versions too. Jinja2 intentionally has limited "programming" features to encourage writing mostly plain HTML so it's easy to understand, extend or override. Is the same approach available in React/Angular/Vue or is JS code freely mixed with bits of HTML requiring a JS developer for any change? Having separate repos for ckan and its frontend would mean tightly linking the versions of those repos. Any change affecting both would need PRs on both repos that would need to be considered together and merged near-simultaneously. That makes tracking issues with The benefit to outweigh this new friction is to "simplify onboarding for frontend developers" i.e. JS developers. This assumes we have lots of people with JS programming backgrounds that want to contribute to ckan, but the opposite has been true. I would like to see better APIs to enable responsive front ends for ckan. This could be something like graphql, new endpoints that return all the information required for rendering a page in a single call, or something like htmx returning bits of rendered HTML to replace parts of pages on the fly. Any of these would enable core front end improvements and custom front ends, allowing those with JS expertise to build the amazing targeted front ends they like, while core UI remains comprehensive. |
Beta Was this translation helpful? Give feedback.
-
Hi @anuveyatsu! We're currently involved with a project where they have a hybrid setup - where they built a React-based CKAN frontend loosely coupled using ckanext-sso with "CKAN Classic"'s built-in UI, themed using conventional jinja2 templating techniques to look like their custom front-end, where they implemented their unique custom data ingestion workflows. Custom data ingestion workflows like PII screening; super-secure S3 storage instead of using CKAN's File Store via ckanext-cloudstorage; loading and downloading resources from the cloud - i.e. dropbox, sharepoint, etc. These workflows called for a custom UI/UX with all kinds of business rules implemented using Lambda and Javascript and UI controls that was ill-suited for scheming, or even a custom IDatasetForm implementation. For the most part, it works, and they were able to delegate things like the solr-powered faceted search interface to the themed "CKAN Classic" built-in UI, and were able to use several CKAN extensions as is. Even though they implemented their data ingestion/entry using their custom front-end, they still used scheming and took advantage of its ability to quickly customize the package/resource metadata schema, and primarily used it for editing metadata, as they liked how they can use the classic UI for viewing the Activity Stream. They actually quite liked scheming and how it made extending/customizing the metadata schema much easier, but they needed more flexibility with the data ingestion process. Another client even supported the development of form-pages in scheming 3.0 that @wardi recently released, because they also liked how scheming made it easy to customize metadata - non-trivial capabilities that will be hard to implement on a decoupled front-end. As @pdelboca pointed out, "CKAN is to Data Portals what Flask/Django is for websites." Perhaps, we should embrace this and even encourage it! Embrace this "hybrid" approach showcasing CKAN as a framework - where core stuff that's hard and non-trivial like faceted search; editing datasets with customizable metadata schema replete with form pages and validators; having the ability for plugins like ckanext-spatial extend the UI/DB/API remains in the CKAN DMS framework. So having the current scheme becomes a feature of the framework, not a bug. Perhaps, instead of decoupling the front-end, we instead create a repo where we embrace and enable front-end developers who wish to create custom front-ends with several reference implementations using popular front-end technologies/frameworks? My 2 cents, |
Beta Was this translation helpful? Give feedback.
-
Hi @pdelboca @wardi @jqnatividad you've shared great points and I totally understand your concerns. If I can summarize this is what we're discussing:
If we could find an approach that could satisfy both of these points, I think we could move further. Let me know if that's true so I can think about proposals here! |
Beta Was this translation helpful? Give feedback.
-
Hi @anuveyatsu ! Yes, that's kinda what are we discussing. I could rephrase your points like:
I prefer using extend frontend instead of change. On the ground, saying "we are going to change our frontend from X to Y" will trigger the question:
Also, if CKAN is really decoupled, then having a default Jinja solution shouldn't affect the development of other frontends so I don't see any harm on keeping it. One could argue that it's more maintenance, but the idea of decoupling also implies that multiple frontends can be developed with independent communities. If "decoupling" means that we should change our current template system that means that we are decoupling it wrong. That's why my initial question was: What thing of the current CKAN implementation does not allow to build a decoupled front-end? To which you answer:
But that doesn't make too much sense for a couple of reasons:
So, long story short: Your proposals are welcome @anuveyatsu and I know you have lots of experience with decoupling CKAN, so as long as we keep it extensible and reusable we can move forward on improving the ecosystem! :) **Note: ** I'm not the official voice of the CKAN community so on each of my points reader should prepend a: IMO. |
Beta Was this translation helpful? Give feedback.
-
Hi, everybody. It's already quite an insightful post. @anuveyatsu thank you for starting the conversation.
A brilliant explanation 👏 @pdelboca
I like this idea. It does lead to anticipated improvement with less risk. It's not a radical though.
Sounds like a nice thing to do, to capture work that can be reusable. The downside is that we don't have that many frontenders to contribute, for now.
@anuveyatsu do you have an idea of how to de-risk the change so that we're moving to simplification of developer experience? Cool topic 👍 Thanks, |
Beta Was this translation helpful? Give feedback.
-
@pdelboca @thegostev thanks for more comments! Initial proposal for having a separate repo was for sort of PoC and if everyone is happy about it only then we would consider getting this into @pdelboca regarding backwards compatibility, CKAN is using semantic versioning and with major version release they should expect some incompatible changes 🤔 but obviously it must be straightforward to upgrade with a clean instructions. Nevertheless, I think this discussion is out of scope for now. |
Beta Was this translation helpful? Give feedback.
-
I'm late to the discussion so I don't want to add much noise to it, but here are some of my thoughts. First of all, I believe all these statements are True at the same time, and probably pretty uncontroversial:
The following I also believe to be True, but are more based on my personal opinion and experience with the CKAN community:
And the following are purely personal opinions (neither true or false :) )
Based on all these, here's what I think could be a good approach
Sorry that ended up being more noise than I expected but hopefully there's some path forward there Footnotes |
Beta Was this translation helpful? Give feedback.
-
Gonna close this discussion since it seems that a kind of agreement has been made around using HTMX for the new frontend: #7524 |
Beta Was this translation helpful? Give feedback.
-
I'd like to see what people think about decoupling the frontend application for the following reasons:
Beta Was this translation helpful? Give feedback.
All reactions