|
| 1 | +# Contributing to Fashio |
| 2 | + |
| 3 | +Thank you for contributing to Fashio. This document outlines the development standards, workspace architecture, issue tracking protocol, and pull request workflow required for maintaining a structured open-source codebase. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +1. [Code of Conduct](#code-of-conduct) |
| 10 | +2. [Monorepo Architecture & Rules](#monorepo-architecture--rules) |
| 11 | +3. [Functional Team Clusters](#functional-team-clusters) |
| 12 | +4. [Issue Labeling Strategy](#issue-labeling-strategy) |
| 13 | +5. [Development Environment Setup](#development-environment-setup) |
| 14 | +6. [Branching & Development Workflow](#branching--development-workflow) |
| 15 | +7. [Coding & Quality Verification](#coding--quality-verification) |
| 16 | +8. [Commit Message Specification](#commit-message-specification) |
| 17 | +9. [Submitting a Pull Request](#submitting-a-pull-request) |
| 18 | +10. [Milestone Roadmap Summary](#milestone-roadmap-summary) |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Code of Conduct |
| 23 | + |
| 24 | +All contributors are expected to uphold a professional, respectful, and inclusive environment. Discriminatory behavior, harassment, or non-constructive communication will not be tolerated. |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Monorepo Architecture & Rules |
| 29 | + |
| 30 | +The project operates as a decoupled monorepo containing a Django REST Framework backend managed by `uv` and a React frontend built with Vite. |
| 31 | + |
| 32 | +```text |
| 33 | +fashio/ |
| 34 | +├── .github/ |
| 35 | +│ ├── ISSUE_TEMPLATE/ |
| 36 | +│ │ ├── bug_report.md |
| 37 | +│ │ └── feature_request.md |
| 38 | +│ ├── workflows/ |
| 39 | +│ │ ├── backend-ci.yml |
| 40 | +│ │ └── frontend-ci.yml |
| 41 | +│ └── PULL_REQUEST_TEMPLATE.md |
| 42 | +│ |
| 43 | +├── backend/ # Django REST Framework application (managed by uv) |
| 44 | +│ ├── .python-version # Python version pinned by uv |
| 45 | +│ ├── pyproject.toml # Dependencies and tool settings managed by uv |
| 46 | +│ ├── uv.lock # Deterministic dependency lockfile |
| 47 | +│ ├── Dockerfile |
| 48 | +│ ├── manage.py |
| 49 | +│ ├── config/ # Core Django settings and URLs |
| 50 | +│ │ ├── __init__.py |
| 51 | +│ │ ├── asgi.py |
| 52 | +│ │ ├── urls.py |
| 53 | +│ │ ├── wsgi.py |
| 54 | +│ │ └── settings/ |
| 55 | +│ │ ├── __init__.py |
| 56 | +│ │ ├── base.py |
| 57 | +│ │ ├── local.py |
| 58 | +│ │ └── prod.py |
| 59 | +│ └── apps/ # Modular Django domain applications |
| 60 | +│ ├── __init__.py |
| 61 | +│ ├── authentication/ |
| 62 | +│ ├── catalog/ |
| 63 | +│ ├── orders/ |
| 64 | +│ ├── profiles/ |
| 65 | +│ └── sellers/ |
| 66 | +│ |
| 67 | +├── frontend/ # React single-page application (Vite) |
| 68 | +│ ├── .eslintrc.cjs |
| 69 | +│ ├── .prettierrc |
| 70 | +│ ├── package.json |
| 71 | +│ ├── vite.config.js |
| 72 | +│ ├── Dockerfile |
| 73 | +│ └── src/ |
| 74 | +│ ├── components/ # Reusable UI primitives (Buttons, Modals) |
| 75 | +│ ├── context/ # React Context providers |
| 76 | +│ ├── features/ # Domain-specific UI and state logic |
| 77 | +│ │ ├── auth/ |
| 78 | +│ │ ├── catalog/ |
| 79 | +│ │ ├── cart/ |
| 80 | +│ │ └── checkout/ |
| 81 | +│ ├── layouts/ # Page shell layouts |
| 82 | +│ ├── pages/ # Route views |
| 83 | +│ ├── services/ # API interaction layer |
| 84 | +│ └── store/ # State management store |
| 85 | +│ |
| 86 | +├── compose.yml # Container orchestration specification |
| 87 | +├── .env.example |
| 88 | +├── ARCHITECTURE.md |
| 89 | +├── CONTRIBUTING.md |
| 90 | +└── README.md |
| 91 | +``` |
| 92 | + |
| 93 | +### Workspace Execution Rules |
| 94 | + |
| 95 | +* **Backend Environment (`uv`):** All Python interactions must use `uv`. Dependencies are synced via `uv sync`, and scripts/management commands must execute using `uv run python manage.py <command>`. |
| 96 | +* **Modular Django Apps:** All domain logic resides inside `/backend/apps/`. The settings configuration inserts `/backend/apps/` into `sys.path` to permit direct application imports (e.g., `from catalog.models import Product`). |
| 97 | +* **Modular Settings:** Environment configuration is divided within `config/settings/` (`base.py`, `local.py`, `prod.py`) using `django-environ` for secret isolation. |
| 98 | +* **Frontend Component Architecture:** Primitive, generic UI components belong in `src/components/`, while domain-specific state, API service calls, and sub-views must be placed inside `src/features/<domain>/`. |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## Functional Team Clusters |
| 103 | + |
| 104 | +To avoid merge bottlenecks across contributor teams, tasks are organized into three primary functional domain clusters: |
| 105 | + |
| 106 | +* **Cluster A (Core & Identity):** Covers Milestone 0 (Infrastructure), Milestone 1 (Auth & Identity), and Milestone 6 (Customer Profiles & History). |
| 107 | +* **Cluster B (Catalog & Vendor Engine):** Covers Milestone 2 (Catalog & Product Engine), Milestone 3 (Seller/Vendor Management), and Milestone 7 (Global UI Navigation & Search). |
| 108 | +* **Cluster C (Commerce & Operations):** Covers Milestone 4 (Cart & Wishlist), Milestone 5 (Checkout & Orders), and Milestone 8 (Security, Hardening & Launch). |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Issue Labeling Strategy |
| 113 | + |
| 114 | +All backlog tasks and pull requests must be classified using three label categories: |
| 115 | + |
| 116 | +### 1. Layer Classification |
| 117 | +* `layer:backend/drf` |
| 118 | +* `layer:frontend/react` |
| 119 | +* `layer:database` |
| 120 | +* `layer:devops` |
| 121 | +* `layer:docs` |
| 122 | +* `layer:design/ui` |
| 123 | + |
| 124 | +### 2. Type Classification |
| 125 | +* `type:feat` |
| 126 | +* `type:fix` |
| 127 | +* `type:refactor` |
| 128 | +* `type:test` |
| 129 | +* `type:security` |
| 130 | + |
| 131 | +### 3. Complexity Estimation |
| 132 | +* `good-first-issue` (1–2 Story Points) |
| 133 | +* `complexity:medium` (3–5 Story Points) |
| 134 | +* `complexity:complex` (8+ Story Points) |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## Development Environment Setup |
| 139 | + |
| 140 | +### Prerequisites |
| 141 | + |
| 142 | +* Python >= 3.12 |
| 143 | +* [uv](https://github.com/astral-sh/uv) package manager |
| 144 | +* Node.js >= 20.0.0 |
| 145 | +* Podman / Docker Engine with Compose support |
| 146 | + |
| 147 | +### Setup Steps |
| 148 | + |
| 149 | +1. Fork the repository on GitHub and clone your fork locally: |
| 150 | +```bash |
| 151 | + git clone [https://github.com/YOUR_USERNAME/Fashio.git](https://github.com/YOUR_USERNAME/Fashio.git) |
| 152 | + cd Fashio |
| 153 | +``` |
| 154 | + |
| 155 | +2. Configure the upstream remote repository: |
| 156 | +```bash |
| 157 | +git remote add upstream [https://github.com/ORIGINAL_OWNER/Fashio.git](https://github.com/ORIGINAL_OWNER/Fashio.git) |
| 158 | +``` |
| 159 | + |
| 160 | + |
| 161 | +3. Initialize environment configuration: |
| 162 | +```bash |
| 163 | +cp .env.example .env |
| 164 | +``` |
| 165 | + |
| 166 | + |
| 167 | +4. Launch the local container environment using Podman or Docker: |
| 168 | +```bash |
| 169 | +# Using Podman |
| 170 | +podman compose up --build |
| 171 | + |
| 172 | +# Using Docker |
| 173 | +docker compose up --build |
| 174 | +``` |
| 175 | + |
| 176 | +Application addresses: |
| 177 | + |
| 178 | +* Backend API: `http://localhost:8000` |
| 179 | +* Frontend Application: `http://localhost:5173` |
| 180 | +* PostgreSQL Database: `localhost:5432` |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## Branching & Development Workflow |
| 185 | + |
| 186 | +Do not commit directly to `main` or `dev`. All work must occur on dedicated feature branches. |
| 187 | + |
| 188 | +1. Fetch and rebase against upstream tracking branch: |
| 189 | +```bash |
| 190 | +git fetch upstream |
| 191 | +git checkout -b <type>/<short-description> upstream/main |
| 192 | +``` |
| 193 | + |
| 194 | +2. Keep branches small and focused on a single issue. |
| 195 | + |
| 196 | +### Branch Prefix Naming |
| 197 | + |
| 198 | +* `feat/` - New functionality |
| 199 | +* `fix/` - Bug fixes |
| 200 | +* `docs/` - Documentation modifications |
| 201 | +* `refactor/` - Code changes that do not alter behavior |
| 202 | +* `test/` - Adding or updating test suites |
| 203 | +* `ci/` - Pipeline configuration changes |
| 204 | + |
| 205 | +--- |
| 206 | + |
| 207 | +## Coding & Quality Verification |
| 208 | + |
| 209 | +Before committing, run local verification checks. |
| 210 | + |
| 211 | +### Backend Validation (`/backend`) |
| 212 | + |
| 213 | +```bash |
| 214 | +cd backend |
| 215 | + |
| 216 | +# Sync environment |
| 217 | +uv sync |
| 218 | + |
| 219 | +# Static analysis and linting |
| 220 | +uv run ruff check . |
| 221 | + |
| 222 | +# Validate formatting |
| 223 | +uv run ruff format --check . |
| 224 | + |
| 225 | +# Execute test suite |
| 226 | +uv run pytest |
| 227 | +``` |
| 228 | + |
| 229 | +Automated code formatting can be applied using: |
| 230 | + |
| 231 | +```bash |
| 232 | +uv run ruff format . |
| 233 | + |
| 234 | +``` |
| 235 | + |
| 236 | +### Frontend Validation (`/frontend`) |
| 237 | + |
| 238 | +```bash |
| 239 | +cd frontend |
| 240 | + |
| 241 | +# Install dependencies |
| 242 | +npm install |
| 243 | + |
| 244 | +# Run linter |
| 245 | +npm run lint |
| 246 | + |
| 247 | +# Validate production build compilation |
| 248 | +npm run build |
| 249 | +``` |
| 250 | + |
| 251 | +--- |
| 252 | + |
| 253 | +## Commit Message Specification |
| 254 | + |
| 255 | +Commits must conform to the [Conventional Commits](https://www.conventionalcommits.org/) specification: |
| 256 | + |
| 257 | +```text |
| 258 | +<type>(<scope>): <short message> |
| 259 | +
|
| 260 | +[optional detailed description] |
| 261 | +
|
| 262 | +[optional issue reference] |
| 263 | +
|
| 264 | +``` |
| 265 | + |
| 266 | +### Supported Types |
| 267 | + |
| 268 | +* `feat`: A new feature implementation |
| 269 | +* `fix`: A bug resolution |
| 270 | +* `docs`: Documentation-only updates |
| 271 | +* `style`: White-space, formatting, or missing semi-colon fixes |
| 272 | +* `refactor`: Code restructures that do not alter public API behavior |
| 273 | +* `perf`: Performance optimizations |
| 274 | +* `test`: Adding or correcting tests |
| 275 | +* `chore`: Build process or tooling updates |
| 276 | + |
| 277 | +### Example Commit Message |
| 278 | + |
| 279 | +```text |
| 280 | +feat(auth): implement Google OAuth2 token exchange endpoint |
| 281 | +
|
| 282 | +Integrate ID token validation flow for frontend authentication calls. |
| 283 | +Includes unit test coverage for user creation and JWT pair issuance. |
| 284 | +
|
| 285 | +Closes #19 |
| 286 | +
|
| 287 | +``` |
| 288 | + |
| 289 | +--- |
| 290 | + |
| 291 | +## Submitting a Pull Request |
| 292 | + |
| 293 | +1. Rebase your feature branch onto the latest upstream branch: |
| 294 | +```bash |
| 295 | +git fetch upstream |
| 296 | +git rebase upstream/main |
| 297 | + |
| 298 | +``` |
| 299 | + |
| 300 | + |
| 301 | +2. Push your topic branch to your fork: |
| 302 | +```bash |
| 303 | +git push -u origin <type>/<short-description> |
| 304 | + |
| 305 | +``` |
| 306 | + |
| 307 | + |
| 308 | +3. Open a Pull Request on GitHub against the target branch (`main` or `dev`). |
| 309 | +4. Ensure your PR description clearly states: |
| 310 | +* The issue being addressed. |
| 311 | +* A summary of technical changes. |
| 312 | +* Steps required to manually verify the implementation. |
| 313 | + |
| 314 | + |
| 315 | +5. Verify that all GitHub Actions CI status checks pass cleanly. |
| 316 | + |
| 317 | +--- |
| 318 | + |
| 319 | +## Milestone Roadmap Summary |
| 320 | + |
| 321 | +The roadmap is structured into 8 sequential milestones containing granular implementation tasks: |
| 322 | + |
| 323 | +* **Milestone 0: Environment, CI/CD & Architecture Setup:** Repository initialization, containerization, quality pipelines, and project documentation. |
| 324 | + |
| 325 | + |
| 326 | +* **Milestone 1: Authentication & Identity Management:** JWT pair issuance, registration, password recovery, and Google/GitHub OAuth integrations. |
| 327 | + |
| 328 | + |
| 329 | +* **Milestone 2: Catalog, Categories & Product Engine:** Hierarchical categories (`mptt`), product models, full-text search, filtering, and catalog UI. |
| 330 | + |
| 331 | + |
| 332 | +* **Milestone 3: Seller Management & Vendor System:** Vendor profiles, seller authorization rules (`IsSeller`), and product management dashboards. |
| 333 | + |
| 334 | + |
| 335 | +* **Milestone 4: Cart & Wishlist System:** Session-based and persistent user carts, cart synchronization, and wishlist persistence. |
| 336 | + |
| 337 | + |
| 338 | +* **Milestone 5: Checkout Engine & Order Flow:** Atomic order transactions, inventory locking, state transitions, and payment processing integrations. |
| 339 | + |
| 340 | + |
| 341 | +* **Milestone 6: Customer Profile, Reviews & History:** User settings, address management, order history, and verified purchase product reviews. |
| 342 | + |
| 343 | + |
| 344 | +* **Milestone 7: Global UI Navigation, Search & Layout:** App layout shells, debounced global search, toast notifications, and responsive navigation. |
| 345 | + |
| 346 | + |
| 347 | +* **Milestone 8: Hardening, Security, Performance & Launch:** DRF throttling, database indexing, OpenAPI documentation generation, and E2E testing. |
0 commit comments