Skip to content

Conversation

@web3gaoyutang
Copy link
Contributor

feat(structure): reorganize project structure and enhance documentation

📝 Description | 描述

English: This PR introduces a major project structure reorganization, separating backend and frontend code into dedicated directories, updating configuration files, and adding comprehensive documentation. The changes improve project maintainability, organization, and developer experience.

中文: 本次PR引入了重大的项目结构重组,将后端和前端代码分离到专用目录,更新配置文件,并添加了全面的文档。这些变更提高了项目的可维护性、组织性和开发体验。


🎯 Type of Change | 变更类型

  • 🐛 Bug fix | 修复 Bug
  • ✨ New feature | 新功能
  • 💥 Breaking change | 破坏性变更
  • 📝 Documentation update | 文档更新
  • 🎨 Code style update | 代码样式更新
  • ♻️ Refactoring | 重构
  • ⚡ Performance improvement | 性能优化
  • ✅ Test update | 测试更新
  • 🔧 Build/config change | 构建/配置变更
  • 🔒 Security fix | 安全修复

🔗 Related Issues | 相关 Issue

  • Related to # | 相关 # (项目结构优化需求)

📋 Changes Made | 具体变更

English:

  • Project Structure Reorganization:

    • Moved all Go backend code to backend/ directory with proper internal package structure
    • Moved frontend code from web/ to frontend/ directory
    • Reorganized configuration files into configs/ directory
    • Moved all scripts to scripts/ directory
    • Consolidated Docker files into docker/ directory
  • Documentation:

    • Added STRUCTURE.md detailing the new project structure and Docker configuration
    • Created PR_DESCRIPTION.md and PR_READY_TO_COPY.md for PR management
    • Updated import paths and references throughout the codebase
  • Configuration Updates:

    • Updated start.sh to create database in the correct directory (configs/)
    • Updated Docker Compose configuration with new directory paths
    • Updated Dockerfile paths for backend and frontend
    • Updated script paths in various deployment scripts
  • Code Organization:

    • Backend: All Go modules now under backend/internal/ with proper package structure
    • Frontend: Maintained existing React/TypeScript structure in new location
    • Updated all import paths to reflect new structure
  • File Cleanup:

    • Removed obsolete .dockerignore, .prettierignore, .prettierrc.json from old frontend location
    • Removed .husky/pre-commit hook from old location

中文:

  • 项目结构重组:

    • 将所有Go后端代码移至 backend/ 目录,采用规范的内部包结构
    • 将前端代码从 web/ 移至 frontend/ 目录
    • 将配置文件重组到 configs/ 目录
    • 将所有脚本移至 scripts/ 目录
    • 将Docker相关文件整合到 docker/ 目录
  • 文档:

    • 添加 STRUCTURE.md,详细说明新的项目结构和Docker配置
    • 创建 PR_DESCRIPTION.mdPR_READY_TO_COPY.md 用于PR管理
    • 更新整个代码库中的导入路径和引用
  • 配置更新:

    • 更新 start.sh 以在正确的目录(configs/)中创建数据库
    • 使用新目录路径更新Docker Compose配置
    • 更新后端和前端的Dockerfile路径
    • 更新各种部署脚本中的脚本路径
  • 代码组织:

    • 后端:所有Go模块现在位于 backend/internal/ 下,具有规范的包结构
    • 前端:在新位置保持现有的React/TypeScript结构
    • 更新所有导入路径以反映新结构
  • 文件清理:

    • 从旧的前端位置删除过时的 .dockerignore.prettierignore.prettierrc.json
    • 从旧位置删除 .husky/pre-commit 钩子

📊 Statistics | 统计信息

  • Files Changed: 130 files
  • Lines Added: +440
  • Lines Deleted: -169
  • Net Change: +271 lines
  • Size Category: 🔶 Large PR (结构重组)

🧪 Testing | 测试

Test Environment | 测试环境

  • OS | 操作系统: Linux
  • Go Version | Go 版本: (请填写)
  • Node Version | Node 版本: (请填写)
  • Docker Version | Docker 版本: (请填写)

Manual Testing | 手动测试

  • Backend builds successfully | 后端构建成功
  • Frontend builds successfully | 前端构建成功
  • Docker Compose starts correctly | Docker Compose 启动正确
  • Database created in correct location | 数据库在正确位置创建
  • All import paths resolved | 所有导入路径已解析
  • Configuration files loaded correctly | 配置文件加载正确
  • Verified no existing functionality broke | 确认没有破坏现有功能

Testing Steps | 测试步骤:

  1. Run ./start.sh to verify database creation in configs/ directory
  2. Build backend: cd backend && go build ./cmd/server
  3. Build frontend: cd frontend && npm install && npm run build
  4. Test Docker deployment: cd docker && docker compose up
  5. Verify all services start correctly
  6. Test API endpoints and frontend routes

🔄 Migration Guide | 迁移指南

For Developers | 开发者迁移指南:

  1. Update Import Paths | 更新导入路径:

    • Old: import "nofx/api"
    • New: import "nofx/backend/internal/api"
  2. Update Script References | 更新脚本引用:

    • All scripts are now in scripts/ directory
    • Update any hardcoded paths in your local setup
  3. Update Configuration Paths | 更新配置路径:

    • Config files are now in configs/ directory
    • Update config.json references if needed
  4. Docker Setup | Docker 设置:

    • Docker files are now in docker/ directory
    • Use cd docker && docker compose up to start services

✅ Checklist | 检查清单

Code Quality | 代码质量

  • Code follows project style | 代码遵循项目风格
  • Self-review completed | 已完成代码自查
  • Comments added for complex logic | 已添加必要注释
  • All import paths updated | 所有导入路径已更新

Documentation | 文档

  • Updated relevant documentation | 已更新相关文档
  • Added STRUCTURE.md | 已添加 STRUCTURE.md
  • Added PR templates | 已添加PR模板

Build & Configuration | 构建和配置

  • Updated Docker configurations | 已更新Docker配置
  • Updated build scripts | 已更新构建脚本
  • Updated deployment scripts | 已更新部署脚本

Git

  • Commits follow conventional format | 提交遵循 Conventional Commits 格式
  • Rebased on latest dev branch | 已 rebase 到最新 dev 分支
  • No merge conflicts | 无合并冲突

📚 Additional Notes | 补充说明

English:
This is a significant structural refactoring that improves project organization and maintainability. The separation of backend and frontend into dedicated directories makes the codebase more scalable and easier to navigate. All functionality remains the same, only the organization has changed.

Key Benefits:

  • Clear separation of concerns (backend/frontend/configs/scripts)
  • Better alignment with Go project structure best practices
  • Improved Docker organization
  • Enhanced documentation for onboarding new developers

Breaking Changes:

  • Import paths have changed for Go modules
  • Script and config file locations have changed
  • Docker compose file location has changed

中文:
这是一次重大的结构重构,提高了项目的组织性和可维护性。将后端和前端分离到专用目录使代码库更具可扩展性且更易于导航。所有功能保持不变,只是组织结构发生了变化。

主要优势:

  • 清晰的关注点分离(后端/前端/配置/脚本)
  • 更好地符合Go项目结构最佳实践
  • 改进的Docker组织
  • 增强的文档,便于新开发者上手

破坏性变更:

  • Go模块的导入路径已更改
  • 脚本和配置文件位置已更改
  • Docker compose文件位置已更改

By submitting this PR, I confirm | 提交此 PR,我确认:

  • I have read the Contributing Guidelines | 已阅读贡献指南
  • I agree to the Code of Conduct | 同意行为准则
  • My contribution is licensed under AGPL-3.0 | 贡献遵循 AGPL-3.0 许可证

🌟 Thank you for your contribution! | 感谢你的贡献!

- Introduced new markdown files for PR descriptions and readiness.
- Updated `start.sh` to create the database in the correct directory.
- Added a new `STRUCTURE.md` file detailing the project structure and Docker configuration.
- Included new Go module and sum files for backend dependencies.
- Created various new components and pages in the frontend, enhancing the user interface and experience.
- Added multiple SVG icons and images for better visual representation.
- Implemented new hooks and context for improved state management in the frontend.

These changes aim to enhance project organization, improve user experience, and ensure better maintainability.
@xqliu
Copy link
Contributor

xqliu commented Nov 8, 2025

建议 Close,此类架构和项目结构调整,必须由核心人员发起,并经过充分审查和 review, 以

  1. 确保安全性、正确性
  2. 正确反应社区及团队对项目的合理贡献分布

@Icyoung
Icyoung
@hzb1115
hzb1115
@tangmengqiu
tangmengqiu
@SkywalkerJi
SkywalkerJi
@heronsbillC
heronsbillC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants