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

オープン
#44 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, sqlite

調査の方向性

この issue では、/shop や /edit-product などの SvelteKit ルート、EW API/Remote functions、および ew-content.sqlite3 ファイルが挙げられています。まず、これらのエントリーポイントをアプリケーションのルートおよび認証とどのように共存させるべきかを整理してください。完了条件は、ルート処理、分離されたデータストア、認可フックを対象とする統合設計について合意できていることです。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
1.8k
フォーク
148
平均マージ
2時間 47分
マージ済み PR(30日)
13

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

michael/editable のほかの issue

michael/editable の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。