2025-12-17 12:07:37 +08:00
|
|
|
# General Project Architecture Template
|
2025-12-16 23:15:43 +08:00
|
|
|
|
2025-12-17 12:07:37 +08:00
|
|
|
## 1️⃣ Standard Structure for Python Web/API Projects
|
2025-12-16 23:15:43 +08:00
|
|
|
|
|
|
|
|
```
|
2025-12-17 12:07:37 +08:00
|
|
|
ProjectName/
|
|
|
|
|
├── README.md # Project description document
|
|
|
|
|
├── LICENSE # Open-source license
|
|
|
|
|
├── requirements.txt # Dependency management (pip)
|
|
|
|
|
├── pyproject.toml # Modern Python project configuration (recommended)
|
|
|
|
|
├── setup.py # Package installation script (if used as a library)
|
|
|
|
|
├── .gitignore # Git ignore file
|
|
|
|
|
├── .env # Environment variables (not committed to Git)
|
|
|
|
|
├── .env.example # Example environment variables
|
|
|
|
|
├── CLAUDE.md # Claude persistent context
|
|
|
|
|
├── AGENTS.md # Codex persistent context
|
|
|
|
|
├── Sublime-Text.txt # For demands and notes, for myself, and CLI session recovery commands ^_^
|
2025-12-16 23:15:43 +08:00
|
|
|
│
|
2025-12-17 12:07:37 +08:00
|
|
|
├── docs/ # Documentation directory
|
|
|
|
|
│ ├── api.md # API documentation
|
|
|
|
|
│ ├── development.md # Development guide
|
|
|
|
|
│ └── architecture.md # Architecture description
|
2025-12-16 23:15:43 +08:00
|
|
|
│
|
2025-12-17 12:07:37 +08:00
|
|
|
├── scripts/ # Script tools
|
|
|
|
|
│ ├── deploy.sh # Deployment script
|
|
|
|
|
│ ├── backup.sh # Backup script
|
|
|
|
|
│ └── init_db.sh # Database initialization
|
2025-12-16 23:15:43 +08:00
|
|
|
│
|
2025-12-17 12:07:37 +08:00
|
|
|
├── tests/ # Test code
|
2025-12-16 23:15:43 +08:00
|
|
|
│ ├── __init__.py
|
2025-12-17 12:07:37 +08:00
|
|
|
│ ├── conftest.py # Pytest configuration
|
|
|
|
|
│ ├── unit/ # Unit tests
|
|
|
|
|
│ ├── integration/ # Integration tests
|
|
|
|
|
│ └── test_config.py # Configuration tests
|
2025-12-16 23:15:43 +08:00
|
|
|
│
|
2025-12-17 12:07:37 +08:00
|
|
|
├── src/ # Source code (recommended)
|
2025-12-16 23:15:43 +08:00
|
|
|
│ ├── __init__.py
|
2025-12-17 12:07:37 +08:00
|
|
|
│ ├── main.py # Program entry point
|
|
|
|
|
│ ├── app.py # Flask/FastAPI application
|
|
|
|
|
│ ├── config.py # Configuration management
|
2025-12-16 23:15:43 +08:00
|
|
|
│ │
|
2025-12-17 12:07:37 +08:00
|
|
|
│ ├── core/ # Core business logic
|
2025-12-16 23:15:43 +08:00
|
|
|
│ │ ├── __init__.py
|
2025-12-17 12:07:37 +08:00
|
|
|
│ │ ├── models/ # Data models
|
|
|
|
|
│ │ ├── services/ # Business services
|
|
|
|
|
│ │ └── utils/ # Utility functions
|
2025-12-16 23:15:43 +08:00
|
|
|
│ │
|
2025-12-17 12:07:37 +08:00
|
|
|
│ ├── api/ # API interface layer
|
2025-12-16 23:15:43 +08:00
|
|
|
│ │ ├── __init__.py
|
2025-12-17 12:07:37 +08:00
|
|
|
│ │ ├── v1/ # Version 1
|
2025-12-16 23:15:43 +08:00
|
|
|
│ │ └── dependencies.py
|
|
|
|
|
│ │
|
2025-12-17 12:07:37 +08:00
|
|
|
│ ├── data/ # Data processing
|
2025-12-16 23:15:43 +08:00
|
|
|
│ │ ├── __init__.py
|
2025-12-17 12:07:37 +08:00
|
|
|
│ │ ├── repository/ # Data access layer
|
|
|
|
|
│ │ └── migrations/ # Database migrations
|
2025-12-16 23:15:43 +08:00
|
|
|
│ │
|
2025-12-17 12:07:37 +08:00
|
|
|
│ └── external/ # External services
|
2025-12-16 23:15:43 +08:00
|
|
|
│ ├── __init__.py
|
2025-12-17 12:07:37 +08:00
|
|
|
│ ├── clients/ # API clients
|
|
|
|
|
│ └── integrations/ # Integration services
|
2025-12-16 23:15:43 +08:00
|
|
|
│
|
2025-12-17 12:07:37 +08:00
|
|
|
├── logs/ # Log directory (not committed to Git)
|
2025-12-16 23:15:43 +08:00
|
|
|
│ ├── app.log
|
|
|
|
|
│ └── error.log
|
|
|
|
|
│
|
2025-12-17 12:07:37 +08:00
|
|
|
└── data/ # Data directory (not committed to Git)
|
|
|
|
|
├── raw/ # Raw data
|
|
|
|
|
├── processed/ # Processed data
|
|
|
|
|
└── cache/ # Cache
|
|
|
|
|
```
|