Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orchard 2 as backend for a SPA #1004

Closed
gentledepp opened this issue Sep 16, 2017 · 5 comments
Closed

Orchard 2 as backend for a SPA #1004

gentledepp opened this issue Sep 16, 2017 · 5 comments

Comments

@gentledepp
Copy link

Hi there!

I am currently thinking about how we could use orchard as the backend of a single page application.

That is: Query content items, and the menu, and such, without doing complete postbacks.

In the end, it would be great to have a module, which makes Orchard SPA development as easy as it is with aspnet boilerplate: See their great documentation

Or have a look at this great article on code project: A Multi-Tenant (SaaS) Application With ASP.NET MVC, Angularjs, EntityFramework and ASP.NET Boilerplate

The strengths of Aspnet Boilerplate is the easy setup, and the SPA support.
What it lacks of in comparison with orchard is:

  1. a module system, so that we can easily adapt a system to customer needs
  2. a content management system, such that every modeled entity can be enhanced with content parts and content fields.
  3. the possibility to change the UI via an administration UI (again: tweak web app for customer needs)

So I am obviously searching for a way to combine both frameworks and create a SPA on top of it.

Are you guys having any ideas on how I could best do that?

(I am already struggeling on getting started with orchard 2, as there is no documentation yet and I am not an Orchard 1 pro... :-|)

@Gaulomatic
Copy link

Gaulomatic commented Sep 16, 2017

I would love a combination of both well! One year ago (or even longer) I experimented with an early alpha version of Orchard and put Angular 2 with Universal (server side rendering) into the mix. What I can tell from my memory is that it is possible in general - if you hack into both of them, but it was more or less pain in the ass. In Angular I needed to write some custom crap I don't know the term for anymore which basically creates new components on the fly at runtime for the content Orchard delivers. That annihilates the advantages of AoT, but hey - no perfect world. I got a demo website with a couple of pages running, but no advanced features.

At the end of the day I came to the conclusion that it might be easier to either wait for the release and look again or just write the CMS completely in Javascript (which would sucks much more... :)

If anyone with a better understanding of Orchard could give us some inside, I would appreciate it.

@infofromca
Copy link
Contributor

#793

@infofromca
Copy link
Contributor

1---in my view, I think what we can do web api easily right now is that we can still use current admin panel, but provide new rest api as the following developers need. the urgent is pulling in #849 and restructure the codes to just keep necessary code.

2--for content management system, I think current repository has a branch called XXXapi, (jsonapi?)

@gentledepp
Copy link
Author

gentledepp commented Sep 26, 2017

Hi!

I thought it would be good to clarify my thoughts about using Orchard 2:

Orchard 2 is still very much a content management system to build (semi-static) websites and blogs.

We would like to have something like AspNET Boilerplate application development flavor.
Why:

Because in our developer world, it would be great to create a web application for a customer and, thereby be able to combine existing modules, or enhance them.
What do I mean in particular?

  1. we create a task management for a customer, and the customer wants to have some additional fields for his/her tasks. With Orchard we could just add them in the admin panel
  2. for the same task management system, our customer needs a different workflow => again, simple with orchard
    ... we could even adapt the navigation and the like. So this would be perfect.
  3. also, Orchard is the only framework that allows us to compose ASP.NET based UI from muliple modules. So we could have a ready made task management module (including UI), and a ready made order solution (including UI) and just throw them together to a complete application (well... more or less of course. there's always plumbing to be done..)

However, there are two technical reasons that stop me using Orchard 2 for now, and these are all YesSql stuff:

  1. the identities are BigInts. There are two problems with this:
    a) As the Identity needs to be created by the database, you cannot apply proper CQRS. (well, not necessarily, as @sebastienros said in his talk, that the session reserves 20 ids or so - but that is cumbersome. what if we want to bulk-insert 200 rows?)
    b) In today's world, most application scenarios fall under the category of "ocasionally connected" - so there is some (or many) client application that needs to sync data to and from the server.
    In such a scenario, having integers as identity is out of the question.

  2. YesSql, for now, does not support complex indices - ones that span multiple documents.
    See [this issue] (Support complex indices sebastienros/yessql#71)
    For example, the following index, which spans 4 documents, would not work:

public CustomerIndex()
{
    AddMap(customers => from customer in customers
        let region = LoadDocument(customer.RegionId)
        let country = LoadDocument(region.CountryId)
        let orders = LoadDocument(customer.OrderIds)
        select new
        {
            Id = customer.Id,
            CustomerName = customer.Name,
            RegionName = region.Name,
            CountryName = country.Name,
            OrdersProcessed = orders.Count(o => o.IsProcessed),
            ProductIds = orders.Select(o => o.ProductId)
        });
    StoreAllFields(FieldStorage.Yes);
}

Apart from that, there is still much to be done to support our usage scenarios:

  1. for now, Orchard 2 supports (will support) dynamic forms to enter content,
    however those forms are intended to be used in the admin UI only, and we need them to be available for our logged-on users. (please correct me if I am wrong)
  2. we need a way to define how a form can look like, based on the state of the underlying document (e.g. a task cannot be assigned another user once it has already been started by the current assignee)
    or the task that the user is aiming to accompish (task-based UI)
    To be honest: I do not have any idea how task-based UIs fit into Orchard 2 anyways, because they are about collecting data which is then used to perform some task, but not to be stored as some document. (e.g.: a dialog to assign multiple tasks to a single user)
  3. in an ideal world, we would like to let our customers do some modifications on their content types. That, however, requires us to make sure they cannot break anything doing that.
    So we would like to version our content types (so content items, which are already in the database, are not changed, so no data is lost, when e.g. a user removes some content filed)
    That, however is hard, as all content type definitions are stored in a single document at the moment. (so this won't scale well ;-))

Sorry for spanning this issue, I just hope that someone reads this and understands our dev-lifes a little bit better. :-)

@sebastienros
Copy link
Member

Moved to #234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants