{"id":25738645,"url":"https://github.com/xcenweb/lex_ddd","last_synced_at":"2025-11-19T23:03:10.078Z","repository":{"id":278870512,"uuid":"937035899","full_name":"xcenweb/Lex_DDD","owner":"xcenweb","description":"采用DDD架构的fastapi基础框架，Ai能读懂和理解的项目结构，可用于高标准的Ai项目快速开发","archived":false,"fork":false,"pushed_at":"2025-08-26T17:49:51.000Z","size":131,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-27T00:51:52.786Z","etag":null,"topics":["ai","ddd","fastapi","prompt","python3","sqlalchemy","trae","windsurf"],"latest_commit_sha":null,"homepage":"https://xcenweb.github.io/docs/lex-ddd/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xcenweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-22T07:10:58.000Z","updated_at":"2025-08-26T17:49:55.000Z","dependencies_parsed_at":"2025-02-22T08:26:17.849Z","dependency_job_id":"508288eb-a194-449d-8eac-975c04a61adc","html_url":"https://github.com/xcenweb/Lex_DDD","commit_stats":null,"previous_names":["xcenweb/lex_ddd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xcenweb/Lex_DDD","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcenweb%2FLex_DDD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcenweb%2FLex_DDD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcenweb%2FLex_DDD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcenweb%2FLex_DDD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xcenweb","download_url":"https://codeload.github.com/xcenweb/Lex_DDD/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcenweb%2FLex_DDD/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285342137,"owners_count":27155385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-19T02:00:05.673Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ddd","fastapi","prompt","python3","sqlalchemy","trae","windsurf"],"created_at":"2025-02-26T07:32:04.774Z","updated_at":"2025-11-19T23:03:10.062Z","avatar_url":"https://github.com/xcenweb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LexDDD - 词易Python基座\n\n[![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)](https://www.python.org/)\n[![FastAPI](https://img.shields.io/badge/FastAPI-0.115.8-green.svg)](https://fastapi.tiangolo.com/)\n[![Poetry](https://img.shields.io/badge/Poetry-Package%20Manager-blue)](https://python-poetry.org/)\n[![SQLAlchemy](https://img.shields.io/badge/SQLAlchemy-2.0.38-red)](https://www.sqlalchemy.org/)\n\n## 项目简介\n\n[Github仓库地址(更新最快)](https://github.com/xcenweb/Lex_DDD)\n\nLexDDD 是一个基于领域驱动设计（DDD）架构的后端开发基座。项目采用现代化的技术栈和架构设计，提供高性能、可维护和可扩展。\n\np.s. 其实是实际项目开发过程中，偶然发现这部分可以作为开发基座，所以就把它开源出来。\n\n文档见 [docs](./docs/README.md)\n\n- 遵循PEP 8编码规范\n- 使用类型注解\n- 保持领域层的纯粹性\n- 遵循DDD设计原则\n\n## 技术架构\n\n### 领域驱动设计 (DDD)\n\n项目严格遵循DDD架构原则，将系统分为以下核心层次：\n\n- **领域层 (Domain Layer)**\n  - 包含核心业务逻辑和实体\n  - 定义领域模型和业务规则\n  - 实现领域服务和值对象\n\n- **应用层 (Application Layer)**\n  - 协调领域对象以完成用例\n  - 处理事务管理\n  - 实现应用服务\n\n- **基础设施层 (Infrastructure Layer)**\n  - 提供技术实现\n  - 处理数据持久化\n  - 集成外部服务\n\n- **接口层 (Interface Layer)**\n  - 定义API接口\n  - 处理请求响应\n  - 实现路由管理\n\n### 技术栈\n\n- **Web框架**: FastAPI 0.115.8\n- **ORM**: SQLAlchemy 2.0.38\n- **数据库**: MySQL\n- **包管理**: Poetry\n- **API文档**: Swagger/OpenAPI\n\n## 项目结构\n\n```\nsrc/\n├── domain/          # 领域层：核心业务逻辑和实体\n├── application/     # 应用层：用例和业务流程编排\n├── infrastructure/  # 基础设施层：技术实现和外部服务集成\n└── interfaces/      # 接口层：API接口和路由定义\n```\n\n## 环境配置\n\n### 前置要求\n\n- Python 3.11+\n- Poetry\n- MySQL\n\n### 安装依赖\n\n```bash\n# 安装项目依赖\npoetry install\n\n# 更新依赖\npoetry update\n```\n\n### 环境变量配置\n\n创建 `.env` 文件并配置以下环境变量：\n\n```env\n# 调试模式\nLEX_DEBUG=True\n\n# 数据库设置\nLEX_DATABASE_URL=mysql+aiomysql://user:password@localhost:3306/lextrade\n```\n\n## 启动服务\n\n```bash\n# 启动开发服务器\nuvicorn main:app --reload\n```\n\n启动后可访问：\n- API文档：http://localhost:8000/docs\n- 交互式API文档：http://localhost:8000/redoc\n\n## 数据库模型\n\n使用 SQLAlchemy 生成数据库模型：\n\n```bash\nsqlacodegen --outfile ./src/domain/models.py mysql://user:password@localhost:3306/lextrade\n```\n\n## TODO\n\n未来想要支持的功能和改进：\n\n- [x] 单元测试\n- [x] logger日志\n- [x] 更完善的异常处理\n- [x] 更利于ai理解的 `file content prompt`\n\n## 许可证\n\n[Apache License 2.0](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcenweb%2Flex_ddd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxcenweb%2Flex_ddd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcenweb%2Flex_ddd/lists"}