Skip to content

How can Editable Website be integrated with new and existing SvelteKit apps? #44

@michael

Description

@michael

This is an early exploration as I was taking a closer look at https://remult.dev/ after chatting with @jycouet and @ermincelikovic the other day.

The fundamental question is how does Svedit+Editable Website fit into a larger picture of SvelteKit apps, which may use other databases, ORM mappers, etc, and roll their own authentication.

So here's some questions :

Should I maybe build the editable website data storage layer on top of Remult rather than using SQLite directly?

I don't have enough information to be certain, but my feeling is that Editable Website, of which all data structures are content-only (no number crunching!) is fundamentally different (also much more minimal) to full-fledged apps, like an e-commerce store. I actually want to be prescriptive to use SQLite for editable website content, because other databases that have a network-layer in between would simply not be a good choice. But I want an app to combine it with other data stores to implement their app-data-layer, for which they might want to use Postgres or something for good reasons. Still they should be able to utilize the content-data-layer that editable website provides.

How can you write an app (e.g. an ecommerce store) that uses EW for making marketing pages, but also include the app-related routes (/shop) to work with whatever the app developer chooses (e.g. a full stack framework like remult to model the shop).

Basically this would work out of the box, all routes that are not defined explicitly would be handled by editable website and access the content in an sqlite file for EW. This is how we built https://app.patch-work.co/book for instance.

However in such a situation, the app will probably come with an authentication and authorization system. And you'd not want two separate logins, like one for editable website and one for the managing the storefront.

So that means we need some way that editable website can hook into an existing arbitrary authentication system. So I'd want to provide a hook that you can override, to check if you can add/edit pages with the session you are currently logged in.

What is important here is that I don't want to introduce any permission layer for EW. If you need an approval process to create or update new pages, you should use a CMS that supports that. The promise of EW, is that things are really simple. So no approval workflows etc. Consequentially, your authorization system must just model an admin role, that allows you to change content in an ew-content.sqlite3 file using the EW API's / Remote functions.

But wouldn't it be cool, if I could edit product descriptions in-place just like the editable website pages?

I'm very certain now that this would be the wrong direction. I want editable website to do one thing well, which is managing and presenting content (aka pages). We did mix this for a website/catalog/store once, and I think it would have been better to do the product catalog traditionally, e.g. with a shopify backend and rendering the entries in Svelte, while doing the marketing pages with EW. One tool for the job.

However, you could always utilize Svedit directly, and make a custom route /edit-product or something where you craft an in-place editing experience and on save this hits your custom database (e.g. via remult). However, just be aware that this comes with significant development costs. In most cases it will be simpler to do the product catalog separately with tools designed for that, and use Svelte just for rendering.


NOTE: This is just a brain dump. I'm looking forward to test integrating EW into larger projects, and all this reasoning might change as time passes and EWv2 gets closer to launch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions