@cubocicloide/stack-react-fastapi 13.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +33 -0
- package/README.md +66 -0
- package/dist/commands/lint/checks/BE/001.d.ts +6 -0
- package/dist/commands/lint/checks/BE/001.js +95 -0
- package/dist/commands/lint/checks/BE/001.js.map +1 -0
- package/dist/commands/lint/checks/BE/002.d.ts +6 -0
- package/dist/commands/lint/checks/BE/002.js +30 -0
- package/dist/commands/lint/checks/BE/002.js.map +1 -0
- package/dist/commands/lint/checks/BE/003.d.ts +11 -0
- package/dist/commands/lint/checks/BE/003.js +46 -0
- package/dist/commands/lint/checks/BE/003.js.map +1 -0
- package/dist/commands/lint/checks/BE/004.d.ts +6 -0
- package/dist/commands/lint/checks/BE/004.js +27 -0
- package/dist/commands/lint/checks/BE/004.js.map +1 -0
- package/dist/commands/lint/checks/BE/005.d.ts +6 -0
- package/dist/commands/lint/checks/BE/005.js +107 -0
- package/dist/commands/lint/checks/BE/005.js.map +1 -0
- package/dist/commands/lint/checks/BE/006.d.ts +6 -0
- package/dist/commands/lint/checks/BE/006.js +27 -0
- package/dist/commands/lint/checks/BE/006.js.map +1 -0
- package/dist/commands/lint/checks/BE/007.d.ts +31 -0
- package/dist/commands/lint/checks/BE/007.js +109 -0
- package/dist/commands/lint/checks/BE/007.js.map +1 -0
- package/dist/commands/lint/checks/BE/008.d.ts +12 -0
- package/dist/commands/lint/checks/BE/008.js +57 -0
- package/dist/commands/lint/checks/BE/008.js.map +1 -0
- package/dist/commands/lint/checks/BE/009.d.ts +12 -0
- package/dist/commands/lint/checks/BE/009.js +104 -0
- package/dist/commands/lint/checks/BE/009.js.map +1 -0
- package/dist/commands/lint/checks/BE/010.d.ts +12 -0
- package/dist/commands/lint/checks/BE/010.js +54 -0
- package/dist/commands/lint/checks/BE/010.js.map +1 -0
- package/dist/commands/lint/checks/BE/011.d.ts +16 -0
- package/dist/commands/lint/checks/BE/011.js +46 -0
- package/dist/commands/lint/checks/BE/011.js.map +1 -0
- package/dist/commands/lint/checks/E2E/001.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/001.js +35 -0
- package/dist/commands/lint/checks/E2E/001.js.map +1 -0
- package/dist/commands/lint/checks/E2E/002.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/002.js +37 -0
- package/dist/commands/lint/checks/E2E/002.js.map +1 -0
- package/dist/commands/lint/checks/E2E/003.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/003.js +42 -0
- package/dist/commands/lint/checks/E2E/003.js.map +1 -0
- package/dist/commands/lint/checks/E2E/004.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/004.js +37 -0
- package/dist/commands/lint/checks/E2E/004.js.map +1 -0
- package/dist/commands/lint/checks/E2E/005.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/005.js +47 -0
- package/dist/commands/lint/checks/E2E/005.js.map +1 -0
- package/dist/commands/lint/checks/E2E/006.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/006.js +28 -0
- package/dist/commands/lint/checks/E2E/006.js.map +1 -0
- package/dist/commands/lint/checks/E2E/007.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/007.js +47 -0
- package/dist/commands/lint/checks/E2E/007.js.map +1 -0
- package/dist/commands/lint/checks/FE/001.d.ts +6 -0
- package/dist/commands/lint/checks/FE/001.js +56 -0
- package/dist/commands/lint/checks/FE/001.js.map +1 -0
- package/dist/commands/lint/checks/FE/002.d.ts +6 -0
- package/dist/commands/lint/checks/FE/002.js +80 -0
- package/dist/commands/lint/checks/FE/002.js.map +1 -0
- package/dist/commands/lint/checks/FE/003.d.ts +6 -0
- package/dist/commands/lint/checks/FE/003.js +65 -0
- package/dist/commands/lint/checks/FE/003.js.map +1 -0
- package/dist/commands/lint/checks/FE/004.d.ts +6 -0
- package/dist/commands/lint/checks/FE/004.js +72 -0
- package/dist/commands/lint/checks/FE/004.js.map +1 -0
- package/dist/commands/lint/checks/FE/005.d.ts +6 -0
- package/dist/commands/lint/checks/FE/005.js +103 -0
- package/dist/commands/lint/checks/FE/005.js.map +1 -0
- package/dist/commands/lint/checks/FE/006.d.ts +6 -0
- package/dist/commands/lint/checks/FE/006.js +102 -0
- package/dist/commands/lint/checks/FE/006.js.map +1 -0
- package/dist/commands/lint/checks/FE/007.d.ts +6 -0
- package/dist/commands/lint/checks/FE/007.js +60 -0
- package/dist/commands/lint/checks/FE/007.js.map +1 -0
- package/dist/commands/lint/checks/FE/008.d.ts +6 -0
- package/dist/commands/lint/checks/FE/008.js +115 -0
- package/dist/commands/lint/checks/FE/008.js.map +1 -0
- package/dist/commands/lint/checks/FE/009.d.ts +6 -0
- package/dist/commands/lint/checks/FE/009.js +83 -0
- package/dist/commands/lint/checks/FE/009.js.map +1 -0
- package/dist/commands/lint/checks/FE/010.d.ts +6 -0
- package/dist/commands/lint/checks/FE/010.js +105 -0
- package/dist/commands/lint/checks/FE/010.js.map +1 -0
- package/dist/commands/lint/checks/FE/011.d.ts +6 -0
- package/dist/commands/lint/checks/FE/011.js +43 -0
- package/dist/commands/lint/checks/FE/011.js.map +1 -0
- package/dist/commands/lint/checks/FE/012.d.ts +6 -0
- package/dist/commands/lint/checks/FE/012.js +150 -0
- package/dist/commands/lint/checks/FE/012.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3491 -0
- package/dist/index.js.map +1 -0
- package/dude.stack.json +7 -0
- package/package.json +43 -0
- package/templates/aws-eks/backend/Dockerfile.prod.hbs +22 -0
- package/templates/aws-eks/docs/docs/deploy.md.hbs +159 -0
- package/templates/aws-eks/frontend/Dockerfile.prod +28 -0
- package/templates/aws-eks/frontend/nginx.conf +19 -0
- package/templates/aws-eks/iac/README.md.hbs +311 -0
- package/templates/aws-eks/iac/_gitignore +24 -0
- package/templates/aws-eks/iac/helm/app/.helmignore +7 -0
- package/templates/aws-eks/iac/helm/app/Chart.yaml.hbs +6 -0
- package/templates/aws-eks/iac/helm/app/templates/NOTES.txt +23 -0
- package/templates/aws-eks/iac/helm/app/templates/backend-deployment.yaml +44 -0
- package/templates/aws-eks/iac/helm/app/templates/backend-service.yaml +16 -0
- package/templates/aws-eks/iac/helm/app/templates/celery-beat-deployment.yaml +34 -0
- package/templates/aws-eks/iac/helm/app/templates/celery-worker-deployment.yaml +31 -0
- package/templates/aws-eks/iac/helm/app/templates/configmap.yaml +15 -0
- package/templates/aws-eks/iac/helm/app/templates/flower-deployment.yaml +28 -0
- package/templates/aws-eks/iac/helm/app/templates/flower-service.yaml +19 -0
- package/templates/aws-eks/iac/helm/app/templates/frontend-deployment.yaml +34 -0
- package/templates/aws-eks/iac/helm/app/templates/frontend-service.yaml +16 -0
- package/templates/aws-eks/iac/helm/app/templates/helpers.tpl +90 -0
- package/templates/aws-eks/iac/helm/app/templates/hpa.yaml +23 -0
- package/templates/aws-eks/iac/helm/app/templates/ingress.yaml +30 -0
- package/templates/aws-eks/iac/helm/app/templates/migration-job.yaml +38 -0
- package/templates/aws-eks/iac/helm/app/templates/redis-deployment.yaml +33 -0
- package/templates/aws-eks/iac/helm/app/templates/redis-service.yaml +18 -0
- package/templates/aws-eks/iac/helm/app/templates/secret.yaml +17 -0
- package/templates/aws-eks/iac/helm/app/templates/serviceaccount.yaml +12 -0
- package/templates/aws-eks/iac/helm/app/values-dev.yaml.hbs +35 -0
- package/templates/aws-eks/iac/helm/app/values.yaml.hbs +130 -0
- package/templates/aws-eks/iac/runner/Dockerfile +53 -0
- package/templates/aws-eks/iac/terraform/bootstrap/main.tf.hbs +101 -0
- package/templates/aws-eks/iac/terraform/bootstrap/outputs.tf +19 -0
- package/templates/aws-eks/iac/terraform/bootstrap/variables.tf.hbs +17 -0
- package/templates/aws-eks/iac/terraform/environments/dev/backend.hcl.hbs +12 -0
- package/templates/aws-eks/iac/terraform/environments/dev/terraform.tfvars.hbs +32 -0
- package/templates/aws-eks/iac/terraform/main.tf.hbs +305 -0
- package/templates/aws-eks/iac/terraform/outputs.tf.hbs +52 -0
- package/templates/aws-eks/iac/terraform/providers.tf +47 -0
- package/templates/aws-eks/iac/terraform/variables.tf.hbs +181 -0
- package/templates/aws-eks/iac/terraform/versions.tf +27 -0
- package/templates/base/.claude/agents/issue-fixer.md +190 -0
- package/templates/base/.claude/agents/security-fixer.md +250 -0
- package/templates/base/.claude/rules/BE/001.md +25 -0
- package/templates/base/.claude/rules/BE/002.md +15 -0
- package/templates/base/.claude/rules/BE/003.md +18 -0
- package/templates/base/.claude/rules/BE/004.md +14 -0
- package/templates/base/.claude/rules/BE/005.md +15 -0
- package/templates/base/.claude/rules/BE/006.md +17 -0
- package/templates/base/.claude/rules/BE/007.md +21 -0
- package/templates/base/.claude/rules/BE/008.md +19 -0
- package/templates/base/.claude/rules/BE/009.md +27 -0
- package/templates/base/.claude/rules/BE/010.md +16 -0
- package/templates/base/.claude/rules/BE/011.md +15 -0
- package/templates/base/.claude/rules/E2E/001.md +13 -0
- package/templates/base/.claude/rules/E2E/002.md +14 -0
- package/templates/base/.claude/rules/E2E/003.md +10 -0
- package/templates/base/.claude/rules/E2E/004.md +23 -0
- package/templates/base/.claude/rules/E2E/005.md +15 -0
- package/templates/base/.claude/rules/E2E/006.md +13 -0
- package/templates/base/.claude/rules/E2E/007.md +18 -0
- package/templates/base/.claude/rules/FE/001.md +22 -0
- package/templates/base/.claude/rules/FE/002.md +39 -0
- package/templates/base/.claude/rules/FE/003.md +19 -0
- package/templates/base/.claude/rules/FE/004.md +21 -0
- package/templates/base/.claude/rules/FE/005.md +33 -0
- package/templates/base/.claude/rules/FE/006.md +24 -0
- package/templates/base/.claude/rules/FE/007.md +19 -0
- package/templates/base/.claude/rules/FE/008.md +26 -0
- package/templates/base/.claude/rules/FE/009.md +30 -0
- package/templates/base/.claude/rules/FE/010.md +25 -0
- package/templates/base/.claude/rules/FE/011.md +22 -0
- package/templates/base/.claude/rules/FE/012.md +32 -0
- package/templates/base/.claude/settings.json +53 -0
- package/templates/base/.claude/skills/clean-branches/SKILL.md +100 -0
- package/templates/base/.claude/skills/create/SKILL.md +47 -0
- package/templates/base/.claude/skills/create-jira-issue/SKILL.md +174 -0
- package/templates/base/.claude/skills/create-page/SKILL.md +195 -0
- package/templates/base/.claude/skills/create-route/SKILL.md +199 -0
- package/templates/base/.claude/skills/draft-email/SKILL.md +104 -0
- package/templates/base/.claude/skills/fix-issues/SKILL.md +238 -0
- package/templates/base/.claude/skills/security-scan/SKILL.md +297 -0
- package/templates/base/.claude/skills/verify-security-fixes/SKILL.md +180 -0
- package/templates/base/.dude/commands/README.md +85 -0
- package/templates/base/.dude/commands/hello.ts +34 -0
- package/templates/base/.dude/lint/checks/PRJ/001.ts +26 -0
- package/templates/base/.dude/lint/checks/README.md +69 -0
- package/templates/base/.vscode/tasks.json +44 -0
- package/templates/base/.worktreeinclude +2 -0
- package/templates/base/CLAUDE.md.hbs +364 -0
- package/templates/base/README.md.hbs +187 -0
- package/templates/base/_env.example.hbs +29 -0
- package/templates/base/_env.hbs +25 -0
- package/templates/base/_gitignore +31 -0
- package/templates/base/_npmrc +2 -0
- package/templates/base/backend/Dockerfile.hbs +22 -0
- package/templates/base/backend/README.md.hbs +74 -0
- package/templates/base/backend/_dockerignore +11 -0
- package/templates/base/backend/app/__init__.py +1 -0
- package/templates/base/backend/app/core/__init__.py +0 -0
- package/templates/base/backend/app/core/config.py.hbs +23 -0
- package/templates/base/backend/app/fixtures/__init__.py +0 -0
- package/templates/base/backend/app/main.py.hbs +41 -0
- package/templates/base/backend/app/management/__init__.py +0 -0
- package/templates/base/backend/app/models/__init__.py +0 -0
- package/templates/base/backend/app/queries/__init__.py +0 -0
- package/templates/base/backend/app/routers/__init__.py +0 -0
- package/templates/base/backend/app/routers/health.py +13 -0
- package/templates/base/backend/app/schemas/__init__.py +0 -0
- package/templates/base/backend/app/schemas/health.py +7 -0
- package/templates/base/backend/app/tasks/__init__.py +1 -0
- package/templates/base/backend/app/tests/__init__.py +0 -0
- package/templates/base/backend/app/tests/conftest.py +13 -0
- package/templates/base/backend/app/tests/models/__init__.py +0 -0
- package/templates/base/backend/app/tests/queries/__init__.py +0 -0
- package/templates/base/backend/app/tests/routers/__init__.py +0 -0
- package/templates/base/backend/app/tests/routers/test_health.py +10 -0
- package/templates/base/backend/app/tests/tasks/__init__.py +1 -0
- package/templates/base/backend/app/tests/utils/__init__.py +0 -0
- package/templates/base/backend/app/utils/__init__.py +0 -0
- package/templates/base/backend/pyproject.toml.hbs +40 -0
- package/templates/base/docker-compose.yml.hbs +128 -0
- package/templates/base/docs/docs/api.md +21 -0
- package/templates/base/docs/docs/dude.md.hbs +316 -0
- package/templates/base/docs/docs/index.md.hbs +100 -0
- package/templates/base/docs/docs/mkdocs.md +238 -0
- package/templates/base/docs/mkdocs.yml.hbs +52 -0
- package/templates/base/e2e/.prettierrc.json +1 -0
- package/templates/base/e2e/_prettierignore +3 -0
- package/templates/base/e2e/cucumber.js +21 -0
- package/templates/base/e2e/eslint.config.mjs +14 -0
- package/templates/base/e2e/features/example.feature +13 -0
- package/templates/base/e2e/package.json.hbs +30 -0
- package/templates/base/e2e/pages/ExamplePage.ts +16 -0
- package/templates/base/e2e/playwright.config.ts +27 -0
- package/templates/base/e2e/steps/common.steps.ts +32 -0
- package/templates/base/e2e/steps/example.steps.ts +4 -0
- package/templates/base/e2e/support/hooks.ts +72 -0
- package/templates/base/e2e/support/world.ts +24 -0
- package/templates/base/e2e/tsconfig.json +22 -0
- package/templates/base/frontend/.prettierrc.json +6 -0
- package/templates/base/frontend/Dockerfile +10 -0
- package/templates/base/frontend/_dockerignore +4 -0
- package/templates/base/frontend/eslint.config.js +32 -0
- package/templates/base/frontend/index.html.hbs +13 -0
- package/templates/base/frontend/package.json.hbs +38 -0
- package/templates/base/frontend/public/favicon.svg +5 -0
- package/templates/base/frontend/src/$components/Layout/$assets/logo.svg +5 -0
- package/templates/base/frontend/src/$components/Layout/constants.tsx.hbs +10 -0
- package/templates/base/frontend/src/$components/Layout/index.tsx +80 -0
- package/templates/base/frontend/src/$components/Layout/types.tsx +9 -0
- package/templates/base/frontend/src/$components/index.tsx +1 -0
- package/templates/base/frontend/src/$hooks/index.tsx +2 -0
- package/templates/base/frontend/src/$hooks/useCounterStore/index.tsx +28 -0
- package/templates/base/frontend/src/$hooks/useCounterStore/types.tsx +7 -0
- package/templates/base/frontend/src/$hooks/usePageTitle/index.tsx +21 -0
- package/templates/base/frontend/src/$types/vite-env.d.ts +10 -0
- package/templates/base/frontend/src/App.tsx.hbs +40 -0
- package/templates/base/frontend/src/main.tsx +10 -0
- package/templates/base/frontend/src/openapi/utils/openapi.yaml.hbs +28 -0
- package/templates/base/frontend/src/pages/constants.tsx +31 -0
- package/templates/base/frontend/src/pages/index.tsx +192 -0
- package/templates/base/frontend/src/pages/types.tsx +6 -0
- package/templates/base/frontend/src/styles.module.css +7 -0
- package/templates/base/frontend/src/utils/constants.tsx +11 -0
- package/templates/base/frontend/src/utils/formatters/index.tsx +49 -0
- package/templates/base/frontend/src/utils/functions.tsx +70 -0
- package/templates/base/frontend/src/utils/index.tsx +3 -0
- package/templates/base/frontend/tsconfig.json +24 -0
- package/templates/base/frontend/vite.config.ts +20 -0
- package/templates/base/package.json.hbs +11 -0
- package/templates/base/security/baseline.json +4 -0
- package/templates/celery/backend/app/tasks/__init__.py +1 -0
- package/templates/celery/backend/app/tasks/example.py +21 -0
- package/templates/celery/backend/app/tests/tasks/test_example.py +7 -0
- package/templates/celery/backend/app/worker.py.hbs +33 -0
- package/templates/celerybeat/backend/app/tasks/scheduled.py +16 -0
- package/templates/celerybeat/backend/app/tests/tasks/test_scheduled.py +7 -0
- package/templates/postgres/.dude/commands/reset.ts +76 -0
- package/templates/postgres/backend/alembic/env.py +55 -0
- package/templates/postgres/backend/alembic/script.py.mako +27 -0
- package/templates/postgres/backend/alembic/versions/0001_create_user_table.py +38 -0
- package/templates/postgres/backend/alembic.ini +42 -0
- package/templates/postgres/backend/app/core/database.py +15 -0
- package/templates/postgres/backend/app/models/__init__.py +5 -0
- package/templates/postgres/backend/app/models/user.py +15 -0
- package/templates/postgres/backend/app/queries/__init__.py +5 -0
- package/templates/postgres/backend/app/queries/users.py +18 -0
- package/templates/postgres/backend/app/routers/users.py +19 -0
- package/templates/postgres/backend/app/routers/users__id.py +20 -0
- package/templates/postgres/backend/app/tests/conftest.py +33 -0
- package/templates/postgres/backend/app/tests/models/test_user.py +12 -0
- package/templates/postgres/backend/app/tests/queries/test_users.py +12 -0
- package/templates/postgres/backend/app/tests/routers/test_users.py +10 -0
- package/templates/postgres/backend/app/tests/routers/test_users__id.py +9 -0
- package/templates/postgres/backend/start.sh +32 -0
- package/templates/postgres/frontend/src/openapi/utils/openapi.yaml.hbs +138 -0
- package/templates/postgres/frontend/src/pages/users/[id]/index.tsx +51 -0
- package/templates/postgres/frontend/src/pages/users/index.tsx +54 -0
- package/templates/postgres/frontend/src/pages/users/types.tsx +4 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
FROM python:3.13-slim
|
|
2
|
+
WORKDIR /app
|
|
3
|
+
|
|
4
|
+
# Install uv (fast Python package manager)
|
|
5
|
+
RUN pip install --no-cache-dir uv
|
|
6
|
+
|
|
7
|
+
# Install all dependencies (including dev: pytest, ruff, mypy …)
|
|
8
|
+
COPY pyproject.toml .
|
|
9
|
+
RUN uv sync --no-cache
|
|
10
|
+
{{#if withPostgres}}
|
|
11
|
+
|
|
12
|
+
# Copy start script (waits for Postgres, runs migrations, starts uvicorn)
|
|
13
|
+
COPY start.sh /start.sh
|
|
14
|
+
RUN chmod +x /start.sh
|
|
15
|
+
|
|
16
|
+
EXPOSE 8000
|
|
17
|
+
CMD ["/start.sh"]
|
|
18
|
+
{{else}}
|
|
19
|
+
|
|
20
|
+
EXPOSE 8000
|
|
21
|
+
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
|
22
|
+
{{/if}}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Backend
|
|
2
|
+
|
|
3
|
+
FastAPI service for `{{projectName}}`.
|
|
4
|
+
|
|
5
|
+
## App structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
app/
|
|
9
|
+
├── core/ # settings, database session, shared utilities
|
|
10
|
+
├── fixtures/ # test fixture helpers
|
|
11
|
+
├── management/ # management / admin commands
|
|
12
|
+
├── models/ # SQLAlchemy ORM models
|
|
13
|
+
├── queries/ # database query functions
|
|
14
|
+
├── routers/ # APIRouter modules (one file per resource)
|
|
15
|
+
├── schemas/ # Pydantic request/response schemas
|
|
16
|
+
├── tasks/ # Celery task definitions
|
|
17
|
+
├── tests/ # pytest test suite
|
|
18
|
+
│ ├── models/
|
|
19
|
+
│ ├── queries/
|
|
20
|
+
│ ├── routers/
|
|
21
|
+
│ ├── tasks/
|
|
22
|
+
│ └── utils/
|
|
23
|
+
├── utils/ # pure helper functions
|
|
24
|
+
├── __init__.py
|
|
25
|
+
└── main.py # entry point — routers, lifespan
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Every source file in `models/`, `queries/`, `routers/`, `tasks/`, and `utils/`
|
|
29
|
+
must have a corresponding test file in `tests/<dir>/test_<name>.py`.
|
|
30
|
+
Run `dude lint` from the project root to check coverage.
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
- Python 3.13+
|
|
35
|
+
- [uv](https://docs.astral.sh/uv/) (recommended)
|
|
36
|
+
- Docker (recommended for full-stack dev)
|
|
37
|
+
{{#if withPostgres}}
|
|
38
|
+
- PostgreSQL 17
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{#if withCelery}}
|
|
41
|
+
- Redis 7
|
|
42
|
+
{{/if}}
|
|
43
|
+
|
|
44
|
+
## Run with Docker
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
docker compose up --build
|
|
48
|
+
```
|
|
49
|
+
{{#if withPostgres}}
|
|
50
|
+
|
|
51
|
+
Migrations run automatically on container start via `start.sh`.
|
|
52
|
+
|
|
53
|
+
To create a new migration after changing models:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
dude db makemigration --message "describe change"
|
|
57
|
+
dude db migrate
|
|
58
|
+
```
|
|
59
|
+
{{/if}}
|
|
60
|
+
{{#if withCelery}}
|
|
61
|
+
|
|
62
|
+
Celery worker and{{#if withCeleryBeat}} beat scheduler and{{/if}} Flower monitor are started automatically by docker compose.
|
|
63
|
+
Flower UI: <http://localhost:5555>
|
|
64
|
+
{{/if}}
|
|
65
|
+
|
|
66
|
+
## Run locally (without Docker)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
uv sync
|
|
70
|
+
uv run uvicorn app.main:app --reload --port 8000
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then open <http://localhost:8000/api/health>.
|
|
74
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""FastAPI application package."""
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Centralised settings — all environment variables are read here."""
|
|
2
|
+
|
|
3
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Settings(BaseSettings):
|
|
7
|
+
model_config = SettingsConfigDict(env_file=".env", case_sensitive=True)
|
|
8
|
+
|
|
9
|
+
APP_TITLE: str = "{{projectName}}"
|
|
10
|
+
{{#if withRedis}}
|
|
11
|
+
CELERY_BROKER_URL: str = "redis://redis:6379/0"
|
|
12
|
+
CELERY_RESULT_BACKEND: str = "redis://redis:6379/0"
|
|
13
|
+
{{/if}}
|
|
14
|
+
{{#if withPostgres}}
|
|
15
|
+
DATABASE_URL: str = "postgresql://postgres:postgres@postgres:5432/app"
|
|
16
|
+
{{/if}}
|
|
17
|
+
DEBUG: bool = False
|
|
18
|
+
{{#if withRedis}}
|
|
19
|
+
REDIS_URL: str = "redis://redis:6379/0"
|
|
20
|
+
{{/if}}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
settings = Settings()
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""FastAPI entrypoint."""
|
|
2
|
+
|
|
3
|
+
from fastapi import APIRouter, FastAPI
|
|
4
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
5
|
+
|
|
6
|
+
from app.routers import (
|
|
7
|
+
health,
|
|
8
|
+
{{#if withPostgres}}
|
|
9
|
+
users,
|
|
10
|
+
users__id,
|
|
11
|
+
{{/if}}
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
# Serve the docs + OpenAPI schema under /api so they reach the backend through
|
|
15
|
+
# the ALB Ingress (which routes /api → backend, everything else → frontend). This
|
|
16
|
+
# keeps a single backend prefix and works identically in local dev (the Vite
|
|
17
|
+
# proxy forwards /api) and in the cluster.
|
|
18
|
+
app = FastAPI(
|
|
19
|
+
title="{{projectName}} backend",
|
|
20
|
+
docs_url="/api/docs",
|
|
21
|
+
redoc_url="/api/redoc",
|
|
22
|
+
openapi_url="/api/openapi.json",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
app.add_middleware(
|
|
26
|
+
CORSMiddleware,
|
|
27
|
+
allow_origins=["http://localhost:5173"],
|
|
28
|
+
allow_credentials=True,
|
|
29
|
+
allow_methods=["*"],
|
|
30
|
+
allow_headers=["*"],
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
api_router = APIRouter(prefix="/api")
|
|
34
|
+
|
|
35
|
+
api_router.include_router(health.router)
|
|
36
|
+
{{#if withPostgres}}
|
|
37
|
+
api_router.include_router(users.router)
|
|
38
|
+
api_router.include_router(users__id.router)
|
|
39
|
+
{{/if}}
|
|
40
|
+
|
|
41
|
+
app.include_router(api_router)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Health-check router."""
|
|
2
|
+
|
|
3
|
+
from fastapi import APIRouter
|
|
4
|
+
|
|
5
|
+
from app.schemas.health import HealthResponse
|
|
6
|
+
|
|
7
|
+
router = APIRouter()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@router.get("/health")
|
|
11
|
+
async def get_health() -> HealthResponse:
|
|
12
|
+
"""Health-check endpoint."""
|
|
13
|
+
return HealthResponse(status="ok")
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Tasks package."""
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Pytest configuration and shared fixtures."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from httpx import ASGITransport, AsyncClient
|
|
5
|
+
|
|
6
|
+
from app.main import app
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.fixture
|
|
10
|
+
async def client():
|
|
11
|
+
"""Async HTTP client pointed at the FastAPI app."""
|
|
12
|
+
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as c:
|
|
13
|
+
yield c
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Task tests package."""
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "{{projectName}}-backend"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "FastAPI backend for {{projectName}}"
|
|
5
|
+
requires-python = ">=3.13"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"fastapi>=0.115.0",
|
|
8
|
+
"pydantic-settings>=2.6.0",
|
|
9
|
+
"uvicorn[standard]>=0.32.0",
|
|
10
|
+
{{#if withPostgres}}
|
|
11
|
+
"alembic>=1.14.0",
|
|
12
|
+
"psycopg2-binary>=2.9.9",
|
|
13
|
+
"sqlmodel>=0.0.22",
|
|
14
|
+
{{/if}}
|
|
15
|
+
{{#if withCelery}}
|
|
16
|
+
"celery[redis]>=5.4.0",
|
|
17
|
+
{{/if}}
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.uv]
|
|
21
|
+
dev-dependencies = [
|
|
22
|
+
"anyio[trio]>=4.0.0",
|
|
23
|
+
"pytest>=8.0.0",
|
|
24
|
+
"pytest-asyncio>=0.24.0",
|
|
25
|
+
"httpx>=0.27.0",
|
|
26
|
+
"ruff>=0.7.0",
|
|
27
|
+
"mypy>=1.13.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[tool.pytest.ini_options]
|
|
31
|
+
asyncio_mode = "strict"
|
|
32
|
+
|
|
33
|
+
[tool.ruff]
|
|
34
|
+
line-length = 100
|
|
35
|
+
|
|
36
|
+
[tool.ruff.lint]
|
|
37
|
+
select = ["E", "F", "I", "N", "UP", "B", "S", "RUF"]
|
|
38
|
+
|
|
39
|
+
[tool.mypy]
|
|
40
|
+
strict = true
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
services:
|
|
2
|
+
backend:
|
|
3
|
+
build:
|
|
4
|
+
context: ./backend
|
|
5
|
+
dockerfile: Dockerfile
|
|
6
|
+
ports:
|
|
7
|
+
- "8000:8000"
|
|
8
|
+
restart: unless-stopped
|
|
9
|
+
environment:
|
|
10
|
+
APP_TITLE: ${APP_TITLE:-app}
|
|
11
|
+
DEBUG: ${DEBUG:-false}
|
|
12
|
+
{{#if withPostgres}}
|
|
13
|
+
DATABASE_URL: ${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/app}
|
|
14
|
+
{{/if}}
|
|
15
|
+
{{#if withRedis}}
|
|
16
|
+
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379/0}
|
|
17
|
+
CELERY_RESULT_BACKEND: ${CELERY_RESULT_BACKEND:-redis://redis:6379/0}
|
|
18
|
+
{{/if}}
|
|
19
|
+
{{#if withPostgres}}
|
|
20
|
+
depends_on:
|
|
21
|
+
postgres:
|
|
22
|
+
condition: service_healthy
|
|
23
|
+
{{/if}}
|
|
24
|
+
volumes:
|
|
25
|
+
- ./backend/app:/app/app
|
|
26
|
+
{{#if withPostgres}}
|
|
27
|
+
- ./backend/alembic:/app/alembic
|
|
28
|
+
- ./backend/alembic.ini:/app/alembic.ini
|
|
29
|
+
{{/if}}
|
|
30
|
+
|
|
31
|
+
frontend:
|
|
32
|
+
build:
|
|
33
|
+
context: ./frontend
|
|
34
|
+
dockerfile: Dockerfile
|
|
35
|
+
ports:
|
|
36
|
+
- "5173:5173"
|
|
37
|
+
depends_on:
|
|
38
|
+
- backend
|
|
39
|
+
restart: unless-stopped
|
|
40
|
+
environment:
|
|
41
|
+
VITE_APP_TITLE: ${VITE_APP_TITLE:-app}
|
|
42
|
+
VITE_REACT_QUERY_DEVTOOLS: ${VITE_REACT_QUERY_DEVTOOLS:-false}
|
|
43
|
+
BACKEND_URL: http://backend:8000
|
|
44
|
+
volumes:
|
|
45
|
+
- ./frontend:/app
|
|
46
|
+
- /app/node_modules
|
|
47
|
+
{{#if withPostgres}}
|
|
48
|
+
|
|
49
|
+
postgres:
|
|
50
|
+
image: postgres:17-alpine
|
|
51
|
+
restart: unless-stopped
|
|
52
|
+
environment:
|
|
53
|
+
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
|
54
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
|
55
|
+
POSTGRES_DB: ${POSTGRES_DB:-app}
|
|
56
|
+
ports:
|
|
57
|
+
- "5432:5432"
|
|
58
|
+
volumes:
|
|
59
|
+
- postgres_data:/var/lib/postgresql/data
|
|
60
|
+
healthcheck:
|
|
61
|
+
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres}"]
|
|
62
|
+
interval: 5s
|
|
63
|
+
timeout: 5s
|
|
64
|
+
retries: 10
|
|
65
|
+
{{/if}}
|
|
66
|
+
{{#if withRedis}}
|
|
67
|
+
|
|
68
|
+
redis:
|
|
69
|
+
image: redis:7-alpine
|
|
70
|
+
restart: unless-stopped
|
|
71
|
+
ports:
|
|
72
|
+
- "6379:6379"
|
|
73
|
+
{{/if}}
|
|
74
|
+
{{#if withCelery}}
|
|
75
|
+
|
|
76
|
+
celery_worker:
|
|
77
|
+
build:
|
|
78
|
+
context: ./backend
|
|
79
|
+
dockerfile: Dockerfile
|
|
80
|
+
command: uv run celery -A app.worker.celery_app worker --loglevel=info
|
|
81
|
+
restart: unless-stopped
|
|
82
|
+
environment:
|
|
83
|
+
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379/0}
|
|
84
|
+
CELERY_RESULT_BACKEND: ${CELERY_RESULT_BACKEND:-redis://redis:6379/0}
|
|
85
|
+
{{#if withPostgres}}
|
|
86
|
+
DATABASE_URL: ${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/app}
|
|
87
|
+
{{/if}}
|
|
88
|
+
depends_on:
|
|
89
|
+
- redis
|
|
90
|
+
{{#if withPostgres}}
|
|
91
|
+
- backend
|
|
92
|
+
{{/if}}
|
|
93
|
+
volumes:
|
|
94
|
+
- ./backend/app:/app/app
|
|
95
|
+
|
|
96
|
+
flower:
|
|
97
|
+
image: mher/flower:2.0
|
|
98
|
+
restart: unless-stopped
|
|
99
|
+
environment:
|
|
100
|
+
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379/0}
|
|
101
|
+
ports:
|
|
102
|
+
- "5555:5555"
|
|
103
|
+
depends_on:
|
|
104
|
+
- redis
|
|
105
|
+
- celery_worker
|
|
106
|
+
{{/if}}
|
|
107
|
+
{{#if withCeleryBeat}}
|
|
108
|
+
|
|
109
|
+
celery_beat:
|
|
110
|
+
build:
|
|
111
|
+
context: ./backend
|
|
112
|
+
dockerfile: Dockerfile
|
|
113
|
+
command: uv run celery -A app.worker.celery_app beat --loglevel=info
|
|
114
|
+
restart: unless-stopped
|
|
115
|
+
environment:
|
|
116
|
+
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379/0}
|
|
117
|
+
CELERY_RESULT_BACKEND: ${CELERY_RESULT_BACKEND:-redis://redis:6379/0}
|
|
118
|
+
depends_on:
|
|
119
|
+
- redis
|
|
120
|
+
- celery_worker
|
|
121
|
+
volumes:
|
|
122
|
+
- ./backend/app:/app/app
|
|
123
|
+
{{/if}}
|
|
124
|
+
{{#if withPostgres}}
|
|
125
|
+
|
|
126
|
+
volumes:
|
|
127
|
+
postgres_data:
|
|
128
|
+
{{/if}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Command reference
|
|
2
|
+
|
|
3
|
+
!!! info "Auto-generated"
|
|
4
|
+
This page is generated from the **live `dude` command catalog** every time you
|
|
5
|
+
run `dude docs`, so it always matches your project's actual commands —
|
|
6
|
+
including the choices made at `dude init` (database, Celery, IaC…) and any
|
|
7
|
+
project-local commands under `.dude/commands/`.
|
|
8
|
+
|
|
9
|
+
You're seeing this placeholder because the docs haven't been served yet. Run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
dude docs
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
and this page will be replaced with the full reference. You can also print it
|
|
16
|
+
yourself at any time:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
dude help --format md # this page, as Markdown
|
|
20
|
+
dude help --format json # the same catalog as JSON (for tooling / LLMs)
|
|
21
|
+
```
|