furong-saascore
多租户 SaaS 内核。装上它,后台、产品前台、API、登录注册、计费、支付、任务流、通知、制品发布、文件存储都是现成的,业务代码只写自己的模块。
- 依赖:Python >= 3.13、Django >= 5.2
- 定位:一个可复用的基座包,不是可直接运行的成品系统
架构
saascore/ 基座(冻结,不改)
apps/ 业务模块(你写这里,模块之间互不依赖)
contracts/ 契约包(唯一"谁都能 import"的地方)
四条约束:
- 业务模块之间不许互相 import,只许 import 基座与契约包
- 跨模块只存 ID,不建外键、不做跨模块 JOIN;要数据走契约
get(<Reader>)拿 DTO - 只写自己的表,别人的数据变了由他发领域事件
- 业务模块不知道流程顺序,顺序归编排层
业务模型继承 TenantModel 即自动带租户隔离与时间戳。接线的唯一入口是
AppConfig.ready():任务类型、配置项、事件、契约实现都在这里注册。
结构约束(租户隔离、跨模块依赖、事件在册、契约只读等)由 saascore-gate
在 manage.py check 阶段机器校验,不靠文档提醒。
使用
安装
从 PyPI 安装:
pip install furong-saascore==0.1.2
或在离线 / 内网环境直接装 whl 文件:
pip install furong_saascore-0.1.2-py3-none-any.whl
数据库驱动按需单独装:pip install "furong-saascore[mysql]" 或
pip install "furong-saascore[postgres]"。默认不装任何驱动,避免环境缺少编译工具时安装失败。
创建并启动项目
saascore startproject mysite
cd mysite
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
startproject 生成 manage.py、settings / urls / wsgi、.env(随机密钥)、契约包骨架与全套文档。
启动后:产品前台 /app/、运营后台 /admin/、运维动作台 /ops/、API 文档 /api/docs、
就绪探针 /healthz 全部由基座提供,不需要自己写路由。
没有 saascore 命令的环境可用等价入口 python -m saascore startproject mysite。
加业务模块
saascore startapp orders
把 "orders" 追加到 settings.py 的 INSTALLED_APPS 末尾(必须排在 "saascore" 之后),
然后 python manage.py makemigrations orders && python manage.py migrate。
from django.db import models
from saascore.models import TenantModel
class Order(TenantModel): # 自动获得 tenant / created_at / updated_at
title = models.CharField("标题", max_length=100, default="")
class Meta:
db_table = "orders_order" # 自己声明,上线后永不改
文档与门禁
startproject 生成的项目里只有两份文档:docs/kernel/架构说明.md 与
docs/kernel/使用说明.md;AGENTS.md 是 AI 协作与门禁的入口。
saascore-gate --fast --settings <项目>.settings # 秒级:ruff / 迁移 / check
saascore-gate --full --settings <项目>.settings # 提交前必跑
python -m saascore.facts --settings <项目>.settings # 从代码生成 ai/facts/ 事实清单
上生产前
.env里DJANGO_DEBUG=0.env里DJANGO_ALLOWED_HOSTS写真实域名DB_ENGINE换成mysql或postgres(sqlite 扛不住多进程写)- 备份
KERNEL_FIELD_KEY—— 丢了它,已加密的历史数据永久读不出来
兼容性
| 项 | 值 |
|---|---|
| Python | >= 3.13 |
| Django | >= 5.2, < 5.3 |
| 许可 | Apache-2.0 |
| 主页 | https://furongit.cn |
Metadata
Release files for furong-saascore 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| furong_saascore-0.1.2.tar.gz | 446.3 kB | Without provenance | Details for furong_saascore-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| furong_saascore-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for furong_saascore-0.1.2-py3-none-any.whl |
Total release size: 1.0 MB
Release files / furong_saascore-0.1.2.tar.gz
| Download URL | furong_saascore-0.1.2.tar.gz |
|---|---|
| Size | 446.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18d795b985fbad4be3f5e3e16c35124fc99c6afe7b1a8423c5c66a4f45b3f9de
|
|
BLAKE2b-256 checksum How to use checksums |
8e7f621f00c05fbe8ced0f6a93470a82906af922ed886970a0916e728714c20a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|
Release files / furong_saascore-0.1.2-py3-none-any.whl
| Download URL | furong_saascore-0.1.2-py3-none-any.whl |
|---|---|
| Size | 581.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a51730fb3bf429376c4d73e2eb0688573e8c7017c69831791a254bdafd53618
|
|
BLAKE2b-256 checksum How to use checksums |
be669df556948f8de4371586bdc4e9176b3b3b2142806fdebb10913de89c9a46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|
Security for furong-saascore 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.