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

未关闭
#44 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript, sqlite

调研方向

该 issue 提到了 /shop 和 /edit-product 等 SvelteKit 路由、EW API/Remote functions 以及 ew-content.sqlite3 文件;先梳理这些入口应如何与应用路由和身份验证共存。完成的标准是形成一份已达成共识的集成设计,涵盖路由处理、独立的数据存储以及授权 hook。

由索引模型根据 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 分钟
30 天内合并 PR
13

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

michael/editable 的其他 Issue

查看 michael/editable 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。