zhangtao b3882559de fix(storage): 修复类型检查暴露的三处缺陷(含 OSS 上传运行时 bug)
basedpyright 报出的三处,逐条定位后发现都不是「标注问题」:

1) oss_adapter.py:70 —— 真运行时 bug
   SDK 里 `Client.uploader` 是**方法**(`def uploader(self, **kwargs) -> Uploader`),
   原写法 `self.client.uploader.upload_file(...)` 是在绑定方法上取属性,运行时必抛
   AttributeError —— 即 OSS 上传链路从未成功过(生产未配 OSS 源,故未暴露)。
   已改为 `self.client.uploader().upload_file(...)`,并按 SDK 签名核对
   `upload_file(request, filepath, part_size=..., parallel_num=...)` 参数正确。

2) sftp_adapter.py:45 —— 缺主机校验
   `config.host` 为 `str | None`(对象存储可不填),却直接传给 paramiko
   `connect(hostname: str)`。已把 host 并入既有的用户名/密码守卫,
   缺主机时返回业务异常 400「SFTP 存储源必须配置主机、用户名与密码」。

3) ftp_ftps_adapter.py:58 —— 同上
   `_new_client()` 增加主机守卫(400「FTP 存储源必须配置主机地址」,并补 CustomException 导入);
   顺带修复同文件 `_ImplicitFTP_TLS.connect` 覆写签名与 ftplib.FTP 不兼容
   (timeout: float、source_address: tuple[str, int] | None),消除该文件最后一条 error。

验证:basedpyright 这三个文件 0 errors(修复前 4 条);ruff 全绿;pytest 97 passed;
      运行时探针:缺主机 → 拦截为 400 业务异常;配主机 → 守卫放行并进入真实连接(ConnectionRefused 如期)。
2026-10-04 05:49:27 +08:00

logo

FastApiAdmin v3.0.0

🚀 Exceptional Code Quality, Production-Ready Admin Dashboard in 5 Minutes

Full-stack rapid development platform powered by FastAPI + Vue3 + TypeScript. Web, H5, and Mini Program — all in one project.

Gitee Stars GitHub Stars GitHub Forks
License Commit Activity

English | 简体中文

🖥️ Screenshots

Web

Dashboard

Mobile (H5 / Mini Program / App from one codebase)

💡 Why FastapiAdmin?

You Need FastapiAdmin Django Admin Frontend-Only
🎯 Ready-to-use admin system ✅ ⚠️ Limited ❌ UI only
⚡ FastAPI async high-performance backend ✅ ❌ Sync-first ❌ No backend
🔐 RBAC menu/button/data level permissions ✅ ❌ Basic ❌
🤖 Code generator (table → full CRUD) ✅ ❌ ❌
📱 Mobile (H5 + Mini Program) included ✅ ❌ ❌
🐳 Docker one-click deploy (Nginx + SSL) ✅ ❌ ❌

👉 Full comparison: Why FastapiAdmin?

🍪 Live Demo

URL Account
💻 Web service.fastapiadmin.com/web admin / 123456
📱 Mobile service.fastapiadmin.com/app admin / 123456
📖 Official Docs service.fastapiadmin.com No login

🚀 5-Minute Quick Start

# 1. Clone
git clone https://github.com/fastapiadmin/FastapiAdmin.git

# 2. Configure environments
cp backend/env/.env.example backend/env/.env.dev
cp frontend/web/.env.development.example frontend/web/.env.development

# 3. Start backend (auto-creates tables + seed data on first run)
cd backend && uv sync && uv run main.py run --env=dev

# 4. Start frontend
cd ../frontend/web && pnpm install && pnpm run dev

# ✅ Open http://127.0.0.1:5173, login with admin/123456
Requirements
Python ≥ 3.12 Node.js ≥ 20 + pnpm
MySQL 8.0+ / PostgreSQL 14+ Redis 6.x / 7.x

🐳 Or: One-Command Docker Deployment

cp docker/.env.example docker/.env    # Fill in MySQL / Redis passwords
./deploy.sh                           # Build images and start the full stack (Nginx + SSL included)

For ports, SSL certificates and frontend builds, see the Docker deployment guide.

📦 Structure

FastapiAdmin/            # Monorepo full-stack project
├─ backend/              # FastAPI backend (Pydantic 2.0 + SQLAlchemy + Alembic)
├─ frontend/
│   ├── web/             # Vue3 Web (Element Plus + TypeScript)
│   ├── app/             # UniApp Mobile (H5 + Mini Program + App)
│   └── docs/            # VitePress documentation
├─ docker/               # Docker Compose deploy (Nginx + SSL)
├─ deploy.sh             # One-click deploy script
└─ LICENSE               # MIT

📌 Built-in Features

200+ REST endpoints · MySQL / PostgreSQL / SQLite · SFTP / S3 / OSS / COS / OBS storage adapters · Trim modules with a single ENABLED_MODULES entry

Core Modules (always enabled, cannot be removed)

Module Capabilities
📊 Dashboard Workbench, Analytics
⚙️ System Management Users, Roles, Menus, Departments, Positions, Dicts, Config, Notices, Tickets, Versions
👀 Monitoring Online users, Server monitoring, Cache monitoring
📝 Logs Operation audit
🧰 Dev Tools API Docs

Extension Modules (enabled by default, trim via ENABLED_MODULES)

Module Capabilities Toggle
🧩 Task Management Scheduled tasks + visual workflow orchestration (built-in business nodes) task
🔧 Code Generator Table → full frontend/backend code generator
📁 Storage Unified file / object storage (SFTP / S3 / OSS / COS / OBS) storage
🤖 AI Chat Agno-powered agent conversations ai
💬 Internal Chat Text-only private / group chat between users (WebSocket real-time push + unread badge) chat

🔧 Module Toggling

Extension modules can be enabled/disabled on demand via ENABLED_MODULES in backend/app/config/setting.py — just remove an item from the list; no code or menu deletion needed. The corresponding REST endpoints, WebSocket endpoints and initialization logic will not be loaded automatically:

# e.g. Disable internal chat and AI assistant, keep the rest
ENABLED_MODULES = ["generator", "task", "storage"]

🚦 Deployment Notes

  • Chat scope: Internal chat is positioned as lightweight internal communication — text-only messages. No file transfer, recall, read receipts, or multi-device sync (IM features). For strong IM needs, integrate mature products such as WeCom / DingTalk / Feishu. It can be disabled anytime by removing chat from ENABLED_MODULES.
  • Single-instance deployment: Real-time features (internal chat WebSocket, scheduled task scheduler) rely on in-memory connections and local scheduling within a single instance — please deploy as a single instance. For horizontal scaling, integrate Redis Pub/Sub or a message queue yourself.
  • Key security: Configure all third-party keys (AI, cloud storage, etc.) in the backend/env/.env.* environment variables. Never commit them to the repository or store them in the database.
  • Database migrations: Manage schema changes with Alembic migrations in production (uv run alembic upgrade head); create_all is only a fallback for first-time initialization.

📷 More Screenshots

Login Code Generator AI Assistant
Login Code Generator AI

📖 Documentation

🤝 Contributing

Issues and PRs are welcome! See Contributing Guide.

👥 Community

⭐ Star History

Star History Chart

👥 Contributors

Thank you to all contributors who have contributed code to FastapiAdmin.

🙏 Acknowledgments

If you find this project useful, please give it a ⭐️ Star!

S
Description
基于 FastAPI + Vue3 + TypeScript 的全栈快速开发平台,Web / H5 / 小程序一站式交付
Readme MIT
157 MiB
Languages
Vue 33.5%
JavaScript 26%
Python 23.2%
TypeScript 13.8%
SCSS 1.2%
Other 2.2%