112 lines
2.6 KiB
Markdown
112 lines
2.6 KiB
Markdown
# Standard Project Structures
|
|
|
|
## PowerShell / WPF Application
|
|
|
|
For IT tooling and local GUI applications.
|
|
|
|
```
|
|
ProjectName/
|
|
├── ProjectName.ps1 # Main entry point — UI, startup, STA check
|
|
├── company-settings.psd1 # External config — no credentials
|
|
├── README.md
|
|
├── Modules/
|
|
│ └── ProjectName.psm1 # Shared functions, config loading, helpers
|
|
└── Release-Notes/
|
|
├── v1.0.md
|
|
└── v1.1.md
|
|
```
|
|
|
|
**Rules:**
|
|
- Entry `.ps1` handles: STA check, assembly loading, module import, config load, show window
|
|
- All reusable logic lives in the `.psm1` module, not inline in the entry point
|
|
- Config file is always in the same directory as the script
|
|
- `Release-Notes/` uses one file per version: `v{major}.{minor}.md`
|
|
|
|
---
|
|
|
|
## FastAPI Web Application (Docker Compose)
|
|
|
|
For self-hosted web apps running behind Nginx.
|
|
|
|
```
|
|
project-name/
|
|
├── docker-compose.yml
|
|
├── .env.example # Always committed — placeholder values only
|
|
├── .gitignore # Must include .env
|
|
├── README.md
|
|
├── nginx/
|
|
│ └── default.conf
|
|
└── backend/
|
|
├── Dockerfile
|
|
├── requirements.txt
|
|
└── app/
|
|
├── main.py
|
|
├── config.py
|
|
├── database.py
|
|
├── dependencies.py
|
|
├── models/
|
|
│ └── user.py
|
|
├── schemas/
|
|
│ └── user.py
|
|
├── routers/
|
|
│ ├── auth.py
|
|
│ └── [resource].py
|
|
└── utils/
|
|
```
|
|
|
|
**Rules:**
|
|
- `.env` is never committed — `.env.example` always is
|
|
- Each resource (users, items, etc.) gets its own model, schema, and router file
|
|
|
|
---
|
|
|
|
## Hugo Blog (chns.tech)
|
|
|
|
Static site for tech blog posts.
|
|
|
|
```
|
|
site/
|
|
├── hugo.toml # Site config
|
|
├── content/
|
|
│ └── posts/
|
|
│ └── YYYY-MM-DD-post-title.md
|
|
├── themes/
|
|
├── static/
|
|
└── layouts/
|
|
```
|
|
|
|
**Post front matter standard:**
|
|
```yaml
|
|
---
|
|
title: "Post Title"
|
|
date: YYYY-MM-DD
|
|
draft: false
|
|
tags: ["tag1", "tag2"]
|
|
---
|
|
```
|
|
|
|
---
|
|
|
|
## Git Conventions
|
|
|
|
- **Branch:** Commit directly to `main` (solo projects)
|
|
- **Commit messages:** Short imperative summary — `Add user auth`, `Fix config loading`, `Update README`
|
|
- **Never commit:** `.env`, credentials, compiled binaries, `node_modules`, `__pycache__`
|
|
- **Always include** a `.gitignore` appropriate for the project type
|
|
|
|
### Standard `.gitignore` entries
|
|
|
|
**PowerShell projects:**
|
|
```
|
|
*.exe
|
|
company-settings.psd1 # If it contains org-specific paths
|
|
```
|
|
|
|
**Python projects:**
|
|
```
|
|
.env
|
|
__pycache__/
|
|
*.pyc
|
|
.pytest_cache/
|
|
```
|