theslopmachine 0.6.2 → 0.7.0
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/MANUAL.md +21 -6
- package/README.md +55 -7
- package/RELEASE.md +15 -0
- package/assets/agents/developer.md +41 -1
- package/assets/agents/slopmachine-claude.md +100 -60
- package/assets/agents/slopmachine.md +40 -17
- package/assets/claude/agents/developer.md +42 -5
- package/assets/skills/clarification-gate/SKILL.md +25 -5
- package/assets/skills/claude-worker-management/SKILL.md +280 -57
- package/assets/skills/developer-session-lifecycle/SKILL.md +81 -37
- package/assets/skills/development-guidance/SKILL.md +21 -1
- package/assets/skills/evaluation-triage/SKILL.md +32 -23
- package/assets/skills/final-evaluation-orchestration/SKILL.md +86 -50
- package/assets/skills/hardening-gate/SKILL.md +17 -3
- package/assets/skills/integrated-verification/SKILL.md +3 -3
- package/assets/skills/planning-gate/SKILL.md +32 -3
- package/assets/skills/planning-guidance/SKILL.md +72 -13
- package/assets/skills/retrospective-analysis/SKILL.md +2 -2
- package/assets/skills/scaffold-guidance/SKILL.md +129 -124
- package/assets/skills/submission-packaging/SKILL.md +33 -27
- package/assets/skills/verification-gates/SKILL.md +44 -14
- package/assets/slopmachine/backend-evaluation-prompt.md +1 -1
- package/assets/slopmachine/frontend-evaluation-prompt.md +5 -5
- package/assets/slopmachine/scaffold-playbooks/android-kotlin-compose.md +81 -0
- package/assets/slopmachine/scaffold-playbooks/android-kotlin-views.md +191 -0
- package/assets/slopmachine/scaffold-playbooks/android-native-java.md +203 -0
- package/assets/slopmachine/scaffold-playbooks/angular-default.md +181 -0
- package/assets/slopmachine/scaffold-playbooks/backend-baseline.md +142 -0
- package/assets/slopmachine/scaffold-playbooks/backend-family-matrix.md +80 -0
- package/assets/slopmachine/scaffold-playbooks/database-module-matrix.md +80 -0
- package/assets/slopmachine/scaffold-playbooks/django-default.md +166 -0
- package/assets/slopmachine/scaffold-playbooks/docker-baseline.md +189 -0
- package/assets/slopmachine/scaffold-playbooks/docker-shared-contract.md +334 -0
- package/assets/slopmachine/scaffold-playbooks/electron-vite-default.md +124 -0
- package/assets/slopmachine/scaffold-playbooks/expo-react-native-default.md +73 -0
- package/assets/slopmachine/scaffold-playbooks/fastapi-default.md +134 -0
- package/assets/slopmachine/scaffold-playbooks/frontend-baseline.md +160 -0
- package/assets/slopmachine/scaffold-playbooks/frontend-family-matrix.md +134 -0
- package/assets/slopmachine/scaffold-playbooks/generic-unknown-tech-guide.md +136 -0
- package/assets/slopmachine/scaffold-playbooks/go-chi-default.md +160 -0
- package/assets/slopmachine/scaffold-playbooks/ios-linux-portable.md +93 -0
- package/assets/slopmachine/scaffold-playbooks/ios-native-objective-c.md +151 -0
- package/assets/slopmachine/scaffold-playbooks/ios-native-swift.md +188 -0
- package/assets/slopmachine/scaffold-playbooks/laravel-default.md +216 -0
- package/assets/slopmachine/scaffold-playbooks/livewire-default.md +265 -0
- package/assets/slopmachine/scaffold-playbooks/overlay-module-matrix.md +130 -0
- package/assets/slopmachine/scaffold-playbooks/platform-family-matrix.md +79 -0
- package/assets/slopmachine/scaffold-playbooks/selection-matrix.md +72 -0
- package/assets/slopmachine/scaffold-playbooks/spring-boot-default.md +182 -0
- package/assets/slopmachine/scaffold-playbooks/tauri-default.md +80 -0
- package/assets/slopmachine/scaffold-playbooks/vue-vite-default.md +162 -0
- package/assets/slopmachine/scaffold-playbooks/web-default.md +96 -0
- package/assets/slopmachine/templates/AGENTS.md +41 -3
- package/assets/slopmachine/templates/CLAUDE.md +111 -0
- package/assets/slopmachine/utils/claude_create_session.mjs +1 -0
- package/assets/slopmachine/utils/claude_live_channel.mjs +188 -0
- package/assets/slopmachine/utils/claude_live_common.mjs +406 -0
- package/assets/slopmachine/utils/claude_live_hook.py +47 -0
- package/assets/slopmachine/utils/claude_live_launch.mjs +181 -0
- package/assets/slopmachine/utils/claude_live_status.mjs +25 -0
- package/assets/slopmachine/utils/claude_live_stop.mjs +45 -0
- package/assets/slopmachine/utils/claude_live_turn.mjs +250 -0
- package/assets/slopmachine/utils/claude_resume_session.mjs +1 -0
- package/assets/slopmachine/utils/claude_wait_for_rate_limit_reset.mjs +23 -0
- package/assets/slopmachine/utils/claude_wait_for_rate_limit_reset.sh +5 -0
- package/assets/slopmachine/utils/claude_worker_common.mjs +224 -4
- package/assets/slopmachine/utils/cleanup_delivery_artifacts.py +4 -0
- package/assets/slopmachine/utils/export_ai_session.mjs +1 -1
- package/assets/slopmachine/utils/normalize_claude_session.py +153 -0
- package/assets/slopmachine/utils/package_claude_session.mjs +96 -0
- package/assets/slopmachine/utils/prepare_strict_audit_workspace.mjs +65 -0
- package/package.json +1 -1
- package/src/constants.js +42 -3
- package/src/init.js +173 -28
- package/src/install.js +75 -0
- package/src/send-data.js +56 -57
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Angular Default Scaffold Playbook
|
|
2
|
+
|
|
3
|
+
Use this playbook when the prompt explicitly wants Angular rather than a category-open frontend choice.
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Create a simple Angular baseline that:
|
|
8
|
+
|
|
9
|
+
- uses the official Angular CLI bootstrap path
|
|
10
|
+
- pins the working defaults exactly
|
|
11
|
+
- keeps `docker compose up --build` as the runtime contract
|
|
12
|
+
- keeps `./run_tests.sh` as the broad containerized verification path
|
|
13
|
+
- includes minimal real Angular tests without pretending the app is product-complete
|
|
14
|
+
|
|
15
|
+
Verified lab: `/Users/yohannesakd/code/eaglepoint/demonstration/scaffold-lab/angular-baseline`
|
|
16
|
+
|
|
17
|
+
## Runtime contract
|
|
18
|
+
|
|
19
|
+
- required Docker command: `docker compose up --build`
|
|
20
|
+
- required broad test command: `./run_tests.sh`
|
|
21
|
+
- both commands must be real and working
|
|
22
|
+
|
|
23
|
+
## Official bootstrap path
|
|
24
|
+
|
|
25
|
+
Angular docs define the local project bootstrap as `ng new [project-name] [options]`.
|
|
26
|
+
The experimentally verified non-interactive baseline here used:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx -y @angular/cli@21.2.7 new angular-baseline --defaults --package-manager npm --skip-git --routing false --style css --ssr false --test-runner vitest
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Why this shape:
|
|
33
|
+
|
|
34
|
+
- official CLI path
|
|
35
|
+
- no SSR, routing, or extra product surface at scaffold time
|
|
36
|
+
- standalone app defaults preserved
|
|
37
|
+
- Angular 21 docs show `vitest` as the default test runner for new projects
|
|
38
|
+
|
|
39
|
+
## Evidence basis for the defaults
|
|
40
|
+
|
|
41
|
+
- Angular CLI docs: `ng new` is the official command to create a workspace and initial application.
|
|
42
|
+
- Angular CLI docs: `test-runner` defaults to `vitest` for new projects.
|
|
43
|
+
- Angular version compatibility docs: Angular 21 supports Node `^20.19.0 || ^22.12.0 || ^24.0.0`.
|
|
44
|
+
|
|
45
|
+
## Safe pinned defaults used in the verified lab
|
|
46
|
+
|
|
47
|
+
- bootstrap generator: `@angular/cli@21.2.7`
|
|
48
|
+
- Docker base image: `node:24.13.0-alpine3.22`
|
|
49
|
+
- Angular packages: `21.2.8`
|
|
50
|
+
- `@angular/build`: `21.2.7`
|
|
51
|
+
- `@angular/compiler-cli`: `21.2.8`
|
|
52
|
+
- `typescript`: `5.9.3`
|
|
53
|
+
- `vitest`: `4.1.4`
|
|
54
|
+
- `rxjs`: `7.8.2`
|
|
55
|
+
- `tslib`: `2.8.1`
|
|
56
|
+
- `jsdom`: `28.1.0`
|
|
57
|
+
|
|
58
|
+
Pin exact versions in `package.json` after generation so reruns are deterministic.
|
|
59
|
+
|
|
60
|
+
## Docker / Compose pattern
|
|
61
|
+
|
|
62
|
+
Recommended light baseline pattern:
|
|
63
|
+
|
|
64
|
+
1. **single pinned Node base image** for both runtime and verification
|
|
65
|
+
2. **development target** runs `ng serve --host 0.0.0.0 --port 4200`
|
|
66
|
+
3. **verify target** runs `npm run verify`
|
|
67
|
+
4. **Compose services**
|
|
68
|
+
- `web` for `docker compose up --build`
|
|
69
|
+
- `test` behind a `test` profile for disposable verification
|
|
70
|
+
5. **port strategy**
|
|
71
|
+
- expose only the Angular app port
|
|
72
|
+
- prefer `127.0.0.1::4200` so local worktrees do not collide
|
|
73
|
+
6. **health strategy**
|
|
74
|
+
- use a localhost HTTP healthcheck against `/`
|
|
75
|
+
|
|
76
|
+
This keeps the baseline convergent without adding SSR, nginx, or browser automation.
|
|
77
|
+
|
|
78
|
+
## Testing baseline
|
|
79
|
+
|
|
80
|
+
Minimum real testing floor for this playbook:
|
|
81
|
+
|
|
82
|
+
- Angular unit tests generated from the official starter
|
|
83
|
+
- at least one rendered-content assertion
|
|
84
|
+
- at least one real user interaction assertion (for example, toggling a panel)
|
|
85
|
+
- `npm run verify` that runs tests and production build
|
|
86
|
+
- `./run_tests.sh` that smoke-checks the live app and runs the verify container
|
|
87
|
+
|
|
88
|
+
Suggested scripts:
|
|
89
|
+
|
|
90
|
+
- `npm run test:ci`
|
|
91
|
+
- `npm run build`
|
|
92
|
+
- `npm run verify`
|
|
93
|
+
- `./run_tests.sh`
|
|
94
|
+
|
|
95
|
+
## README floor
|
|
96
|
+
|
|
97
|
+
`README.md` must already state:
|
|
98
|
+
|
|
99
|
+
- that this is a baseline scaffold only
|
|
100
|
+
- exact official bootstrap command used
|
|
101
|
+
- required Docker command: `docker compose up --build`
|
|
102
|
+
- broad test command: `./run_tests.sh`
|
|
103
|
+
- exact pinned versions that materially matter
|
|
104
|
+
- what is intentionally included now
|
|
105
|
+
- what is intentionally deferred
|
|
106
|
+
- no `.env` / no secrets policy
|
|
107
|
+
|
|
108
|
+
## Exact commands actually run in the verified lab
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npx -y @angular/cli@21.2.7 new angular-baseline --defaults --package-manager npm --skip-git --routing false --style css --ssr false --test-runner vitest
|
|
112
|
+
npm install
|
|
113
|
+
npm run verify
|
|
114
|
+
docker compose up -d --build
|
|
115
|
+
docker compose ps
|
|
116
|
+
docker compose port web 4200
|
|
117
|
+
curl -fsS http://127.0.0.1:<mapped-port>
|
|
118
|
+
docker compose down --remove-orphans
|
|
119
|
+
./run_tests.sh
|
|
120
|
+
python3 - <<'PY'
|
|
121
|
+
import signal
|
|
122
|
+
import subprocess
|
|
123
|
+
import time
|
|
124
|
+
from urllib.request import urlopen
|
|
125
|
+
|
|
126
|
+
cwd = "/Users/yohannesakd/code/eaglepoint/demonstration/scaffold-lab/angular-baseline"
|
|
127
|
+
proc = subprocess.Popen(["docker", "compose", "up", "--build"], cwd=cwd)
|
|
128
|
+
error = None
|
|
129
|
+
try:
|
|
130
|
+
deadline = time.time() + 240
|
|
131
|
+
while time.time() < deadline:
|
|
132
|
+
try:
|
|
133
|
+
output = subprocess.check_output(["docker", "compose", "port", "web", "4200"], cwd=cwd, text=True).strip()
|
|
134
|
+
if output:
|
|
135
|
+
port = output.rsplit(":", 1)[1]
|
|
136
|
+
with urlopen(f"http://127.0.0.1:{port}", timeout=2) as response:
|
|
137
|
+
if response.status == 200:
|
|
138
|
+
print(f"Angular baseline reached while docker compose up --build was active at http://127.0.0.1:{port}")
|
|
139
|
+
break
|
|
140
|
+
except Exception as exc:
|
|
141
|
+
error = exc
|
|
142
|
+
time.sleep(2)
|
|
143
|
+
else:
|
|
144
|
+
raise RuntimeError(f"Angular baseline never became ready: {error}")
|
|
145
|
+
finally:
|
|
146
|
+
proc.send_signal(signal.SIGINT)
|
|
147
|
+
try:
|
|
148
|
+
proc.wait(timeout=30)
|
|
149
|
+
except subprocess.TimeoutExpired:
|
|
150
|
+
proc.kill()
|
|
151
|
+
proc.wait(timeout=30)
|
|
152
|
+
subprocess.run(["docker", "compose", "down", "--remove-orphans"], cwd=cwd, check=True)
|
|
153
|
+
PY
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Observed results from the verified lab
|
|
157
|
+
|
|
158
|
+
- `npm run verify`: passed
|
|
159
|
+
- `docker compose up --build`: reached a live Angular page before controlled shutdown
|
|
160
|
+
- `curl -fsS http://127.0.0.1:<mapped-port>`: returned the HTML shell containing `<title>Angular Baseline Lab</title>`
|
|
161
|
+
- `./run_tests.sh`: passed and printed `Smoke check passed at http://127.0.0.1:<mapped-port>`
|
|
162
|
+
|
|
163
|
+
## Common pitfalls
|
|
164
|
+
|
|
165
|
+
- keeping caret ranges instead of exact pins after generation
|
|
166
|
+
- letting Angular's generated README overstate scope
|
|
167
|
+
- skipping containerized smoke proof and only running local tests
|
|
168
|
+
- adding routing, SSR, API clients, or auth before the baseline is verified
|
|
169
|
+
- checking in `.env` even though the scaffold does not need it
|
|
170
|
+
|
|
171
|
+
## Acceptance checklist
|
|
172
|
+
|
|
173
|
+
Scaffold is acceptable when:
|
|
174
|
+
|
|
175
|
+
- `docker compose up --build` works
|
|
176
|
+
- `./run_tests.sh` works
|
|
177
|
+
- minimal real Angular tests exist
|
|
178
|
+
- package and Docker defaults are pinned safely
|
|
179
|
+
- README is honest
|
|
180
|
+
- no `.env` is required or committed
|
|
181
|
+
- the result is experimentally verified, not just theoretically scaffolded
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Backend Baseline Scaffold Playbook
|
|
2
|
+
|
|
3
|
+
Use this playbook when the request is for a category-level backend/API scaffold and the prompt does not already force a different backend family.
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Create a simple backend baseline that:
|
|
8
|
+
|
|
9
|
+
- uses an official or safest-known bootstrap path for the selected backend family
|
|
10
|
+
- keeps the runtime contract honest and Docker-first
|
|
11
|
+
- includes a real database dependency and a safe config path
|
|
12
|
+
- exposes one portable broad test command
|
|
13
|
+
- stops at baseline infrastructure instead of product-specific features
|
|
14
|
+
|
|
15
|
+
## Runtime contract
|
|
16
|
+
|
|
17
|
+
- required runtime command: `docker compose up --build`
|
|
18
|
+
- required broad test command: `./run_tests.sh`
|
|
19
|
+
- required database bootstrap command when a DB exists: `./init_db.sh`
|
|
20
|
+
- all three commands must be real and working
|
|
21
|
+
|
|
22
|
+
## Selection matrix for major backend families
|
|
23
|
+
|
|
24
|
+
| Family | Official / bootstrap path | Strengths | Risks for baseline category work | Decision |
|
|
25
|
+
| --- | --- | --- | --- | --- |
|
|
26
|
+
| Node | `nest new backend-baseline --package-manager npm` | strongest official CLI, batteries included, built-in test scaffolding | heavier config/ORM wiring once safe config and DB state are enforced | good fallback when prompt explicitly asks for Nest or Node enterprise conventions |
|
|
27
|
+
| Python | `python3 -m venv .venv` + pinned install; if available, prefer `uv init backend-baseline` first | fastest API + DB prototype, smallest surface to keep honest, easy Docker/test story | no single dominant framework generator, so some app structure is still hand-wired | **chosen default** |
|
|
28
|
+
| Java | Spring Initializr / `start.spring.io` bootstrap | strongest official generator, production-shaped defaults, rich ecosystem | slower build/test loops, more boilerplate for a neutral category baseline | use when prompt explicitly asks for Spring or JVM enterprise patterns |
|
|
29
|
+
| Go | `go mod init backend-baseline` plus Gin/Chi setup | fast builds, simple container runtime, small deploy footprint | fewer built-in baseline opinions for validation/config/test ergonomics | use when prompt explicitly wants Go or minimal static binaries |
|
|
30
|
+
| PHP | `composer create-project laravel/laravel backend-baseline` or `laravel new backend-baseline` | strong official starter, batteries included, mature testing story | heavier than needed for neutral category baseline; requires PHP/Composer toolchain | use when prompt explicitly asks for Laravel/PHP |
|
|
31
|
+
|
|
32
|
+
## Chosen default stack and version pins
|
|
33
|
+
|
|
34
|
+
Prototype and default recommendation:
|
|
35
|
+
|
|
36
|
+
- Python `3.12`
|
|
37
|
+
- FastAPI `0.122.0`
|
|
38
|
+
- Uvicorn `0.38.0`
|
|
39
|
+
- SQLAlchemy `2.0.44`
|
|
40
|
+
- SQLite `3` via Python stdlib driver
|
|
41
|
+
- pytest `8.4.2`
|
|
42
|
+
- httpx `0.28.1`
|
|
43
|
+
|
|
44
|
+
Why this default won:
|
|
45
|
+
|
|
46
|
+
- fastest verified path to a real API + real DB baseline
|
|
47
|
+
- Docker and test setup stay readable instead of framework-heavy
|
|
48
|
+
- works well as a category-level default when the prompt does not already lock the backend family
|
|
49
|
+
|
|
50
|
+
## Bootstrap rule
|
|
51
|
+
|
|
52
|
+
- use the official or best-known bootstrap command for the requested backend family when one exists
|
|
53
|
+
- if the prompt leaves the backend family open, default to the Python/FastAPI baseline above
|
|
54
|
+
- after bootstrap, adapt only enough to make Docker runtime, DB wiring, config, and README honest
|
|
55
|
+
|
|
56
|
+
## Database wiring pattern
|
|
57
|
+
|
|
58
|
+
- always route the app through one explicit runtime config path such as `APP_CONFIG_PATH=/runtime/config/app-config.json`
|
|
59
|
+
- generate the runtime config file at container startup instead of committing `.env` files
|
|
60
|
+
- for the default prototype, point the app at a SQLite file inside a Docker-managed volume so no DB credentials are needed
|
|
61
|
+
- provide `./init_db.sh` as the single project-standard database setup entrypoint
|
|
62
|
+
- `./init_db.sh` should create the baseline schema or migrations already known at scaffold time
|
|
63
|
+
- when the prompt requires a network DB later, keep the same config-file contract and swap only the database URL and service wiring
|
|
64
|
+
|
|
65
|
+
## Safe secret/config defaults
|
|
66
|
+
|
|
67
|
+
- no `.env` dependency
|
|
68
|
+
- no committed secrets
|
|
69
|
+
- runtime secret values generated into Docker-managed volumes or mounted secret files
|
|
70
|
+
- app config should be able to load secrets from file paths rather than only raw environment variables
|
|
71
|
+
- Docker startup must work without user-side exports
|
|
72
|
+
|
|
73
|
+
## Docker / Compose pattern
|
|
74
|
+
|
|
75
|
+
- one app service
|
|
76
|
+
- one database strategy: either an embedded DB file for the default fast baseline or a separate DB service when the prompt requires it
|
|
77
|
+
- one test service behind a `test` profile when practical
|
|
78
|
+
- app exposed on `127.0.0.1` only, preferably with a random host port
|
|
79
|
+
- healthchecks on app and database
|
|
80
|
+
- named volumes for runtime-generated config/state instead of committed files
|
|
81
|
+
|
|
82
|
+
## Testing baseline
|
|
83
|
+
|
|
84
|
+
At scaffold, include at least:
|
|
85
|
+
|
|
86
|
+
- one health or smoke endpoint
|
|
87
|
+
- one CRUD-ish endpoint with real persistence
|
|
88
|
+
- containerized `./run_tests.sh`
|
|
89
|
+
- pytest, Jest, JUnit, Go test, or framework-equivalent tests that hit real routes and prove DB wiring
|
|
90
|
+
|
|
91
|
+
For the chosen Python baseline, the minimum real test floor is:
|
|
92
|
+
|
|
93
|
+
- `GET /health` proves API boot + DB connectivity
|
|
94
|
+
- `POST /items` then `GET /items` proves real persistence
|
|
95
|
+
- `./run_tests.sh` performs both smoke `curl` checks and containerized pytest execution
|
|
96
|
+
|
|
97
|
+
## README requirements
|
|
98
|
+
|
|
99
|
+
`README.md` must already state:
|
|
100
|
+
|
|
101
|
+
- scaffold status versus implemented scope
|
|
102
|
+
- chosen stack and version pins
|
|
103
|
+
- required runtime command: `docker compose up --build`
|
|
104
|
+
- broad test command: `./run_tests.sh`
|
|
105
|
+
- database bootstrap command: `./init_db.sh`
|
|
106
|
+
- how config is generated safely without `.env`
|
|
107
|
+
- what is intentionally excluded from the baseline
|
|
108
|
+
|
|
109
|
+
## Verification commands actually run for this prototype
|
|
110
|
+
|
|
111
|
+
Commands run in `/Users/yohannesakd/code/eaglepoint/demonstration/scaffold-lab/backend-baseline`:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
docker compose build
|
|
115
|
+
docker compose up --build -d
|
|
116
|
+
docker compose ps
|
|
117
|
+
docker compose port app 8000
|
|
118
|
+
curl -fsS "http://127.0.0.1:32771/health"
|
|
119
|
+
curl -fsS -X POST "http://127.0.0.1:32771/items" -H "content-type: application/json" -d '{"name":"manual-smoke-item"}'
|
|
120
|
+
curl -fsS "http://127.0.0.1:32771/items"
|
|
121
|
+
docker compose down --volumes --remove-orphans
|
|
122
|
+
./run_tests.sh
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Observed result:
|
|
126
|
+
|
|
127
|
+
- app reached healthy state on `127.0.0.1:32771`
|
|
128
|
+
- `./run_tests.sh` finished with `2 passed in 0.49s`
|
|
129
|
+
|
|
130
|
+
## Known caveats
|
|
131
|
+
|
|
132
|
+
- this baseline uses schema creation via `./init_db.sh`; upgrade to a migrations tool when the prompt starts evolving the schema over time
|
|
133
|
+
- the verified prototype uses SQLite for speed and zero-secret local startup; switch to a network database when the prompt needs external services, concurrent writers, or production-shaped infra
|
|
134
|
+
- the default stack choice is category-level guidance, not a rule; use the prompt-specific family when it is explicit
|
|
135
|
+
|
|
136
|
+
## What to reuse later
|
|
137
|
+
|
|
138
|
+
- Docker-first runtime contract
|
|
139
|
+
- `./run_tests.sh` wrapper pattern
|
|
140
|
+
- `./init_db.sh` as the single DB bootstrap entrypoint
|
|
141
|
+
- config-file-plus-secret-file wiring instead of `.env`
|
|
142
|
+
- health endpoint + one persistence-backed route as the minimum real backend proof
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Backend Scaffold Family Matrix
|
|
2
|
+
|
|
3
|
+
Use this matrix after `backend-baseline.md` when the prompt or existing repo indicates a backend/API scaffold and the backend family still needs to be normalized.
|
|
4
|
+
|
|
5
|
+
## Selection defaults
|
|
6
|
+
|
|
7
|
+
Follow the original prompt and existing repo first. When the prompt is language-level only, use these defaults:
|
|
8
|
+
|
|
9
|
+
| Prompt signal | Default family | Why this is the safe default |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Node.js | Nest + Fastify | strongest batteries-included Node backend starter, clear module structure, good DB/test story |
|
|
12
|
+
| Python | FastAPI | current playbook default; fastest honest API + DB baseline with low scaffold cost |
|
|
13
|
+
| Java | Spring Boot | strongest official bootstrap and production-shaped defaults |
|
|
14
|
+
| Go | Go + Chi | smallest reliable HTTP surface, easy Docker/runtime wiring, low framework lock-in |
|
|
15
|
+
| PHP | Laravel | strongest official starter, migrations/testing already standardized |
|
|
16
|
+
| `not_specified` | Python + FastAPI | current category-open backend default from `backend-baseline.md` |
|
|
17
|
+
|
|
18
|
+
If the repo already uses Express, Flask, Django, Gin, or another supported family, keep the repo family unless the prompt explicitly requests migration.
|
|
19
|
+
|
|
20
|
+
## Shared contract for every backend family
|
|
21
|
+
|
|
22
|
+
- required runtime command: `docker compose up --build`
|
|
23
|
+
- required broad test command: `./run_tests.sh`
|
|
24
|
+
- required DB bootstrap command when persistence exists: `./init_db.sh`
|
|
25
|
+
- do not depend on a checked-in `.env`
|
|
26
|
+
- generate runtime config into a mounted runtime path such as `APP_CONFIG_PATH=/runtime/config/app-config.json`
|
|
27
|
+
- keep database services internal-only in Compose; publish host ports only when the prompt truly needs direct host access
|
|
28
|
+
- include a real health endpoint plus at least one persistence-backed route or module test
|
|
29
|
+
- wire healthchecks so app startup waits on database readiness when a database service exists
|
|
30
|
+
|
|
31
|
+
## Supported backend family matrix
|
|
32
|
+
|
|
33
|
+
| Family | Likely scaffold root / bootstrap command | Safe default direction | Right choice when | Baseline API / test structure expectation | Database composition + shared Docker contract |
|
|
34
|
+
| --- | --- | --- | --- | --- | --- |
|
|
35
|
+
| **Nest + Fastify** (default Node family) | `npx @nestjs/cli@latest new <app-name> --package-manager npm` then `npm install @nestjs/platform-fastify` | Node `22 LTS`, TypeScript `5.x`, Nest `11.x`, Fastify `5.x`; keep Nest CLI layout and switch the HTTP adapter to Fastify | prompt says Node.js only, Nest, modular enterprise API, decorators/DI, or team-scale backend conventions | `src/main.ts`, root module, per-feature `module/controller/service`, unit `*.spec.ts`, e2e `test/*.e2e-spec.ts`, `/health` plus one persistence route | compose with SQLite for smallest local baseline or PostgreSQL for network DB; use Prisma/TypeORM/Drizzle only when chosen explicitly or already present; `./init_db.sh` owns migrations; app stays internal and waits on DB health |
|
|
36
|
+
| **Express + TypeScript** | `npx express-generator@latest <app-name> --no-view` then add TypeScript + test wiring | Node `22 LTS`, Express `5.x`, TypeScript `5.x`; keep the stack thin and explicit | prompt explicitly says Express, webhook/middleware-heavy service, or minimal Node API without Nest ceremony | `src/server.ts` or `src/app.ts`, route modules, service/repository split where needed, `tests/integration/*.test.ts` with Supertest, `/health` plus one persistence route | same Docker contract as Nest; prefer PostgreSQL for service DB, SQLite for smallest local baseline, MongoDB only when the prompt explicitly wants a document store |
|
|
37
|
+
| **FastAPI** (default Python family; experimentally verified) | `uv init <app-name>` then add FastAPI dependencies; fallback `python3 -m venv .venv && pip install fastapi uvicorn[standard] sqlalchemy pytest httpx` | Python `3.12`, FastAPI `0.122.x`, Uvicorn `0.38.x`, SQLAlchemy `2.0.x`, pytest `8.4.x`, httpx `0.28.x` | prompt says Python only, API-first service, typed request/response models, fast neutral backend scaffold | `app/main.py`, router package, config/settings module, DB/session module, `tests/test_health.py` and persistence tests using pytest | default local DB is SQLite in a Docker-managed volume; default network DB is PostgreSQL; keep `APP_CONFIG_PATH` contract, run migrations or schema bootstrap through `./init_db.sh`, and gate app on DB readiness when a DB service exists; see `fastapi-default.md` |
|
|
38
|
+
| **Flask** | `python3 -m venv .venv && pip install Flask SQLAlchemy pytest` | Python `3.12`, Flask `3.1.x`, SQLAlchemy `2.0.x`, pytest `8.4.x`; prefer app-factory structure | prompt explicitly says Flask, simple service/webhook, or very small Python backend without FastAPI/Django weight | `app/__init__.py` app factory, blueprints, DB/extensions module, `tests/` with pytest and Flask test client or httpx, `/health` plus one persistence route | SQLite is acceptable for the minimal baseline; PostgreSQL is the default service DB when a network database is needed; use Alembic or a small idempotent bootstrap in `./init_db.sh` |
|
|
39
|
+
| **Django** (experimentally verified) | `python3 -m pip install "Django>=5.2,<5.3" && django-admin startproject <app-name> . && python manage.py startapp api` | Python `3.12`, Django `5.2.x`; add Django REST Framework only when the scaffold is clearly JSON-API-first | prompt says Django, admin-heavy backend, server-rendered platform, or batteries-included Python monolith | project package + one or more apps, `urls.py`, models, migrations, `tests.py` or `tests/`, `/health` or equivalent readiness view, framework test runner or pytest-django | SQLite is acceptable only for tiny/local baselines; PostgreSQL is the default network DB; use Django migrations via `./init_db.sh`; Compose app should wait on DB health before migrations/start; see `django-default.md` |
|
|
40
|
+
| **Spring Boot** (default Java family; experimentally verified) | `curl -G "https://start.spring.io/starter.tgz" --data-urlencode "type=maven-project" --data-urlencode "language=java" --data-urlencode "javaVersion=21" --data-urlencode "dependencies=web,data-jpa,validation,actuator,testcontainers" --data-urlencode "baseDir=<app-name>" | tar -xz` | Java `21 LTS`, Spring Boot `3.5.x`, Maven wrapper by default, Actuator on, Validation on; prefer explicit config properties and a single app module at scaffold time | prompt says Java only, Spring, JVM enterprise conventions, strong validation/config needs, or production-shaped service baseline | `src/main/java/...` with controller/service/repository split, `src/test/java/...`, `@SpringBootTest` and slice tests, `/actuator/health` plus one persistence-backed API | PostgreSQL is the default network DB; MySQL only when explicit or existing-repo driven; use Flyway or Liquibase for SQL migrations, run through `./init_db.sh`, and keep the DB service internal with healthchecks; see `spring-boot-default.md` |
|
|
41
|
+
| **Go + Chi** (default Go family; experimentally verified) | `go mod init <module-path> && go get github.com/go-chi/chi/v5` | Go `1.24.x`, Chi `5.x`; stay close to `net/http`, `database/sql`, and small explicit packages | prompt says Go only, wants a low-magic service, small binary, or direct control over middleware and DB access | `cmd/server/main.go`, `internal/http`, `internal/store`, `internal/config`, `*_test.go` using `httptest`, `/health` plus one persistence route | SQLite is the local default; PostgreSQL is the default network DB using `pgx` or driver-equivalent; keep migration/bootstrap in `./init_db.sh`; no separate DB host port unless explicitly requested; see `go-chi-default.md` |
|
|
42
|
+
| **Go + Gin** | `go mod init <module-path> && go get github.com/gin-gonic/gin` | Go `1.24.x`, Gin `1.11.x`; use only when the request benefits from higher-level JSON binding/middleware helpers | prompt explicitly says Gin or wants faster handler ergonomics than Chi/stdlib | same structure as Chi, but handlers and middleware hang off Gin router groups; tests still use `httptest` and `go test ./...` | same DB and Docker contract as Chi; do not make MongoDB or Redis the default just because Gin is chosen |
|
|
43
|
+
| **Laravel** (default PHP family; experimentally verified) | `composer create-project laravel/laravel <app-name>` or `laravel new <app-name>` | PHP `8.3+`, Laravel `12.x`; keep built-in config/migration/test structure and queue/cache stubs off unless requested | prompt says PHP only, Laravel, admin/back-office style app, or batteries-included MVC/API backend | `routes/api.php`, controllers, models, migrations, `tests/Feature`, `tests/Unit`, `/up` or `/health` readiness route, real DB-backed feature test | MySQL is the conventional default service DB for PHP-only asks; PostgreSQL is also supported when the repo or prompt wants it; SQLite is fine for tiny local/test baselines; Eloquent migrations run through `./init_db.sh`; DB stays on an internal Compose network; see `laravel-default.md` |
|
|
44
|
+
|
|
45
|
+
## Practical family guidance
|
|
46
|
+
|
|
47
|
+
- **Prefer Nest + Fastify over Express** when the prompt only says Node.js and does not push for minimalism.
|
|
48
|
+
- **Prefer FastAPI over Flask or Django** when the prompt only says Python and the task is an API/backend scaffold.
|
|
49
|
+
- **Prefer Django over FastAPI** only when the prompt implies Django conventions, admin-heavy behavior, or server-rendered/backend-monolith shape.
|
|
50
|
+
- **Prefer Chi over Gin** when the prompt only says Go and does not need extra framework ergonomics.
|
|
51
|
+
- **Prefer Laravel over custom PHP wiring** for every PHP-only baseline unless an existing repo already chose a different PHP framework.
|
|
52
|
+
|
|
53
|
+
## Verified concrete playbooks
|
|
54
|
+
|
|
55
|
+
- `backend-baseline.md` — verified category-open backend baseline
|
|
56
|
+
- `fastapi-default.md` — experimentally verified FastAPI baseline
|
|
57
|
+
- `spring-boot-default.md` — experimentally verified Spring Boot baseline
|
|
58
|
+
- `django-default.md` — experimentally verified Django baseline
|
|
59
|
+
- `laravel-default.md` — experimentally verified Laravel baseline
|
|
60
|
+
- `go-chi-default.md` — experimentally verified Go + Chi baseline
|
|
61
|
+
|
|
62
|
+
## Placeholder handling
|
|
63
|
+
|
|
64
|
+
- `backend_family=not_specified` means **choose from the language default table above**, not “invent a new framework.”
|
|
65
|
+
- `backend_language=not_specified` and no existing repo evidence means **Python + FastAPI**.
|
|
66
|
+
- `backend_family=not_specified` with an existing repo means **keep the existing repo family**.
|
|
67
|
+
- `database=not_specified` should not remove persistence entirely; pair the chosen backend family with the default database module from `database-module-matrix.md`.
|
|
68
|
+
|
|
69
|
+
## Family-by-family default DB pairing summary
|
|
70
|
+
|
|
71
|
+
| Family | Local / smallest honest DB default | Network / service DB default |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| Nest + Fastify | SQLite | PostgreSQL |
|
|
74
|
+
| Express + TypeScript | SQLite | PostgreSQL |
|
|
75
|
+
| FastAPI | SQLite | PostgreSQL |
|
|
76
|
+
| Flask | SQLite | PostgreSQL |
|
|
77
|
+
| Django | SQLite only for tiny local baseline | PostgreSQL |
|
|
78
|
+
| Spring Boot | SQLite only if the prompt truly keeps things local and tiny | PostgreSQL |
|
|
79
|
+
| Go + Chi / Gin | SQLite | PostgreSQL |
|
|
80
|
+
| Laravel | SQLite for tiny local/test baseline | MySQL |
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Database Module Matrix
|
|
2
|
+
|
|
3
|
+
Use this after selecting the backend family. This matrix defines the standard database wiring modules we should compose into backend and fullstack scaffolds.
|
|
4
|
+
|
|
5
|
+
## Shared database wiring contract
|
|
6
|
+
|
|
7
|
+
- if the scaffold has persistence, it gets a real `./init_db.sh`
|
|
8
|
+
- app runtime reads one generated config path such as `APP_CONFIG_PATH=/runtime/config/app-config.json`
|
|
9
|
+
- no checked-in `.env`
|
|
10
|
+
- no committed secrets or baked database credentials
|
|
11
|
+
- database services stay internal-only in Compose unless the prompt explicitly requires host access
|
|
12
|
+
- healthchecks are mandatory for every database service container
|
|
13
|
+
- `./run_tests.sh` must prove both app readiness and real database access
|
|
14
|
+
|
|
15
|
+
At the config level, normalize on a small shared shape even when each framework maps it into native config objects:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"database": {
|
|
20
|
+
"driver": "postgresql|mysql|sqlite|mongodb",
|
|
21
|
+
"url": "...",
|
|
22
|
+
"host": "db",
|
|
23
|
+
"port": 5432,
|
|
24
|
+
"name": "app",
|
|
25
|
+
"user": "app",
|
|
26
|
+
"password_file": "/run/secrets/db_password"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Database selection defaults
|
|
32
|
+
|
|
33
|
+
| Prompt / selector state | Default database module | Why |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| `database=postgresql` | PostgreSQL | neutral service-container SQL default across most backend families |
|
|
36
|
+
| `database=mysql` | MySQL | explicit MySQL ask, existing MySQL estate, or conventional Laravel/MySQL pairing |
|
|
37
|
+
| `database=sqlite` | SQLite | smallest honest local persistence path with no credentials |
|
|
38
|
+
| `database=mongodb` | MongoDB | explicit document-store or flexible-schema requirement |
|
|
39
|
+
| `database=not_specified` | SQLite for the smallest honest baseline | baseline should still prove persistence without forcing a network DB |
|
|
40
|
+
|
|
41
|
+
When the prompt or repo clearly requires a **service-container relational DB** but leaves the engine open, prefer **PostgreSQL** except for conventional PHP/Laravel defaults where MySQL is still reasonable.
|
|
42
|
+
|
|
43
|
+
## Database module matrix
|
|
44
|
+
|
|
45
|
+
| Module | Safe baseline direction | Use it when | Secret / config handling model | Migration / init expectations | Docker composition expectations | State location default |
|
|
46
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
47
|
+
| **PostgreSQL** | PostgreSQL `17.x`, internal service name `db`, healthcheck via `pg_isready` | prompt wants a real service DB, relational integrity, concurrent writers, or production-shaped SQL infrastructure | app reads one generated DSN or config object; local disposable credentials may live in Compose only when the DB is internal-only and clearly documented as throwaway; otherwise mount secret files | `./init_db.sh` waits for healthy DB then runs family-native migrations (Alembic, Django migrations, Flyway/Liquibase, Prisma/TypeORM/Drizzle, Eloquent, goose, etc.); idempotent seed/bootstrap is allowed | `db` service on the internal bridge network, `expose: 5432`, named volume for data, readiness-gated `depends_on`, no host port by default | **service container state** with a named Docker volume |
|
|
48
|
+
| **MySQL** | MySQL `8.4 LTS`, internal service name `db`, healthcheck via `mysqladmin ping` | prompt explicitly wants MySQL/MariaDB-family behavior, existing repo already uses it, or Laravel/PHP conventions dominate | same config-file contract as PostgreSQL; never commit credentials; local-only disposable credentials are acceptable only for isolated internal Compose use | `./init_db.sh` runs framework-native migrations after healthcheck; schema/bootstrap stays idempotent; avoid raw hand-edited SQL dumps as the primary scaffold contract | `db` service on internal network, `expose: 3306`, named volume, readiness-gated startup, no host port unless explicitly requested | **service container state** with a named Docker volume |
|
|
49
|
+
| **SQLite** | SQLite `3` via language/runtime driver, DB file under a mounted runtime path such as `/runtime/data/app.sqlite` | prompt leaves DB open, the scaffold only needs the smallest honest persistence layer, or the backend family is still in category-open baseline mode | no DB credentials; keep the file path in generated runtime config; never commit live `.sqlite` state into the repo | `./init_db.sh` creates the file path, runs schema creation or migrations against that file, and can safely recreate it for tests; once schema evolution becomes real, switch to the family's migration tool instead of ad hoc SQL | **no separate DB service**; the app service mounts a named volume for DB state; app health should still prove it can open/query the file | **local app-mounted state** in a named Docker volume by default; use a gitignored host bind mount only if the prompt explicitly needs inspectable local files |
|
|
50
|
+
| **MongoDB** | MongoDB `8.x`, internal service name `db`, healthcheck via `mongosh --eval 'db.adminCommand({ ping: 1 })'` | prompt explicitly wants a document store, event/log style documents, flexible schema, or an existing Mongo repo | same generated config-file contract; use URI plus optional secret-file paths; local disposable users are acceptable only for internal-only Compose bootstrap | `./init_db.sh` should create users/databases as needed, apply indexes/validators, and seed any baseline documents idempotently; think “indexes + validators + bootstrap” rather than SQL migrations | `db` service on internal network, `expose: 27017`, named volume, healthcheck, readiness-gated startup; no host port by default | **service container state** with a named Docker volume |
|
|
51
|
+
|
|
52
|
+
## Host-volume local state vs service-container state
|
|
53
|
+
|
|
54
|
+
| Database module | Default state model | When to use host-volume local state instead |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| PostgreSQL | service-container named volume | almost never at scaffold time; only when the prompt explicitly needs inspectable raw database files on the host |
|
|
57
|
+
| MySQL | service-container named volume | almost never at scaffold time; same rule as PostgreSQL |
|
|
58
|
+
| SQLite | app-mounted named volume | when the prompt explicitly wants a visible local file for manual inspection or offline tooling; keep the bind mount gitignored |
|
|
59
|
+
| MongoDB | service-container named volume | almost never at scaffold time |
|
|
60
|
+
|
|
61
|
+
## Family-to-database pairing defaults
|
|
62
|
+
|
|
63
|
+
| Backend family | Smallest honest default when DB is open | Default network/service DB | Notes |
|
|
64
|
+
| --- | --- | --- | --- |
|
|
65
|
+
| Nest + Fastify | SQLite | PostgreSQL | MongoDB only when the prompt explicitly wants a document model |
|
|
66
|
+
| Express + TypeScript | SQLite | PostgreSQL | MySQL is fine when the repo already uses it; not the neutral default |
|
|
67
|
+
| FastAPI | SQLite | PostgreSQL | this is the current category-open backend default pairing |
|
|
68
|
+
| Flask | SQLite | PostgreSQL | stay lightweight unless the prompt proves a larger service DB is needed |
|
|
69
|
+
| Django | SQLite for tiny local scaffolds only | PostgreSQL | keep Django migrations first-class; use DRF only when the API surface warrants it |
|
|
70
|
+
| Spring Boot | SQLite only for rare tiny local baselines | PostgreSQL | MySQL is acceptable for explicit compatibility; PostgreSQL remains the neutral default |
|
|
71
|
+
| Go + Chi / Gin | SQLite | PostgreSQL | use MongoDB only for explicit document-store prompts |
|
|
72
|
+
| Laravel | SQLite for tiny local/test baselines | MySQL | PostgreSQL is still acceptable when the repo or prompt asks for it |
|
|
73
|
+
|
|
74
|
+
## Placeholder handling
|
|
75
|
+
|
|
76
|
+
- `database=not_specified` means **choose the smallest honest DB module for the selected backend family**, not “skip the database.”
|
|
77
|
+
- if both backend family and database are open, default to **FastAPI + SQLite** per the current backend baseline direction.
|
|
78
|
+
- if the prompt explicitly implies a multi-user or production-shaped service DB but does not name an engine, default to **PostgreSQL**.
|
|
79
|
+
- if the prompt says PHP only and leaves the DB open, default to **Laravel + MySQL** unless the repo already standardized on PostgreSQL.
|
|
80
|
+
- `not_specified` never means “commit secrets later”; keep the config-file + secret-file contract from day one.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Django Default Scaffold Playbook
|
|
2
|
+
|
|
3
|
+
Use this playbook when the request explicitly wants Django or when a backend baseline should prefer Django's official project/app bootstrap path over lighter Python microframeworks.
|
|
4
|
+
|
|
5
|
+
Verified lab: `/Users/yohannesakd/code/eaglepoint/demonstration/scaffold-lab/django-baseline`
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Create a Django baseline that:
|
|
10
|
+
|
|
11
|
+
- uses Django's official bootstrap path
|
|
12
|
+
- keeps defaults pinned and conservative
|
|
13
|
+
- wires the backend to a safe default database pattern without `.env`
|
|
14
|
+
- ships a real `docker compose up --build` path
|
|
15
|
+
- ships a real containerized `./run_tests.sh`
|
|
16
|
+
- includes minimal real Django tests
|
|
17
|
+
- keeps the README honest about included versus excluded scope
|
|
18
|
+
- stops at baseline infrastructure instead of product-specific features
|
|
19
|
+
|
|
20
|
+
## Runtime contract
|
|
21
|
+
|
|
22
|
+
- required runtime command: `docker compose up --build`
|
|
23
|
+
- required broad test command: `./run_tests.sh`
|
|
24
|
+
- required database bootstrap command: `./init_db.sh`
|
|
25
|
+
- all three commands must be real and working
|
|
26
|
+
|
|
27
|
+
## Official/bootstrap path
|
|
28
|
+
|
|
29
|
+
Per Django's documented admin commands, the baseline should start from:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
django-admin startproject config .
|
|
33
|
+
python manage.py startapp core
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Those commands preserve the standard Django project shape while keeping the app split explicit.
|
|
37
|
+
|
|
38
|
+
## Chosen default stack and version pins
|
|
39
|
+
|
|
40
|
+
- Python `3.12`
|
|
41
|
+
- Django `5.2.6`
|
|
42
|
+
- Gunicorn `23.0.0`
|
|
43
|
+
- SQLite `3` via Django's built-in SQLite backend
|
|
44
|
+
|
|
45
|
+
Why this default won:
|
|
46
|
+
|
|
47
|
+
- Django provides the official project generator, ORM, migrations, and test runner in one maintained stack
|
|
48
|
+
- SQLite keeps the baseline fast, reproducible, and secret-free while still proving real persistence
|
|
49
|
+
- Gunicorn provides a safer container runtime than `runserver` while keeping the app bootstrap simple
|
|
50
|
+
|
|
51
|
+
## Safe database/config pattern
|
|
52
|
+
|
|
53
|
+
- always route runtime configuration through one explicit config file path such as `APP_CONFIG_PATH=/runtime/config/app-config.json`
|
|
54
|
+
- generate that config file at startup with a small bootstrap script instead of committing `.env`
|
|
55
|
+
- generate `SECRET_KEY` into a Docker-managed runtime file under `/runtime/state`
|
|
56
|
+
- default the database to a SQLite file under `/runtime/db/django-baseline.sqlite3` in a named volume
|
|
57
|
+
- provide `./init_db.sh` as the single database bootstrap entrypoint and make it run `python manage.py migrate --noinput`
|
|
58
|
+
|
|
59
|
+
## Docker / Compose pattern
|
|
60
|
+
|
|
61
|
+
- one `app` service
|
|
62
|
+
- one disposable `test` service behind a `test` profile
|
|
63
|
+
- host exposure loopback-bound only via `127.0.0.1::8000`
|
|
64
|
+
- named volumes for runtime config, generated secret state, and SQLite data
|
|
65
|
+
- app healthcheck must hit `/health` inside the container and the endpoint must perform a real DB query
|
|
66
|
+
|
|
67
|
+
## Minimal baseline behavior
|
|
68
|
+
|
|
69
|
+
At scaffold time, include at least:
|
|
70
|
+
|
|
71
|
+
- `GET /health` proves app boot + DB connectivity
|
|
72
|
+
- `POST /items` and `GET /items` prove ORM-backed persistence
|
|
73
|
+
- one migration for the minimal model
|
|
74
|
+
- `python manage.py test` wired into `./run_tests.sh`
|
|
75
|
+
|
|
76
|
+
Minimum real Django tests:
|
|
77
|
+
|
|
78
|
+
- one test for `GET /health`
|
|
79
|
+
- one test for `POST /items` then `GET /items`
|
|
80
|
+
|
|
81
|
+
## README requirements
|
|
82
|
+
|
|
83
|
+
`README.md` must already state:
|
|
84
|
+
|
|
85
|
+
- scaffold status versus implemented scope
|
|
86
|
+
- chosen stack and pinned versions
|
|
87
|
+
- required runtime command: `docker compose up --build`
|
|
88
|
+
- required test command: `./run_tests.sh`
|
|
89
|
+
- database bootstrap command: `./init_db.sh`
|
|
90
|
+
- how runtime config and `SECRET_KEY` are generated safely without `.env`
|
|
91
|
+
- what is intentionally excluded from the baseline
|
|
92
|
+
|
|
93
|
+
## Verification commands actually run for this prototype
|
|
94
|
+
|
|
95
|
+
Commands run in `/Users/yohannesakd/code/eaglepoint/demonstration/scaffold-lab/django-baseline`:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
docker compose build
|
|
99
|
+
docker compose up --build -d
|
|
100
|
+
docker compose ps
|
|
101
|
+
docker compose port app 8000
|
|
102
|
+
curl -fsS "http://127.0.0.1:32781/health"
|
|
103
|
+
curl -fsS -X POST "http://127.0.0.1:32781/items" -H "content-type: application/json" -d '{"name":"manual-smoke-item"}'
|
|
104
|
+
curl -fsS "http://127.0.0.1:32781/items"
|
|
105
|
+
docker compose down --volumes --remove-orphans
|
|
106
|
+
./run_tests.sh
|
|
107
|
+
python3 - <<'PY'
|
|
108
|
+
import signal
|
|
109
|
+
import subprocess
|
|
110
|
+
import time
|
|
111
|
+
from urllib.request import urlopen
|
|
112
|
+
|
|
113
|
+
cwd = "/Users/yohannesakd/code/eaglepoint/demonstration/scaffold-lab/django-baseline"
|
|
114
|
+
proc = subprocess.Popen(["docker", "compose", "up", "--build"], cwd=cwd)
|
|
115
|
+
error = None
|
|
116
|
+
try:
|
|
117
|
+
deadline = time.time() + 180
|
|
118
|
+
while time.time() < deadline:
|
|
119
|
+
try:
|
|
120
|
+
port_output = subprocess.check_output(["docker", "compose", "port", "app", "8000"], cwd=cwd, text=True).strip()
|
|
121
|
+
if port_output:
|
|
122
|
+
host = port_output.split(":")[-1]
|
|
123
|
+
with urlopen(f"http://127.0.0.1:{host}/health", timeout=2) as response:
|
|
124
|
+
body = response.read().decode("utf-8")
|
|
125
|
+
if response.status == 200 and '"status": "ok"' in body and '"database": "ok"' in body:
|
|
126
|
+
print(f"docker compose up --build reached healthy /health on http://127.0.0.1:{host}/health")
|
|
127
|
+
break
|
|
128
|
+
except Exception as exc:
|
|
129
|
+
error = exc
|
|
130
|
+
time.sleep(2)
|
|
131
|
+
else:
|
|
132
|
+
raise RuntimeError(f"django baseline never became ready: {error}")
|
|
133
|
+
finally:
|
|
134
|
+
proc.send_signal(signal.SIGINT)
|
|
135
|
+
try:
|
|
136
|
+
proc.wait(timeout=30)
|
|
137
|
+
except subprocess.TimeoutExpired:
|
|
138
|
+
proc.kill()
|
|
139
|
+
proc.wait(timeout=30)
|
|
140
|
+
subprocess.run(["docker", "compose", "down", "-v", "--remove-orphans"], cwd=cwd, check=True)
|
|
141
|
+
PY
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Observed results:
|
|
145
|
+
|
|
146
|
+
- `docker compose ps` reported the app `Up ... (healthy)` and `docker compose port app 8000` returned `127.0.0.1:32781`
|
|
147
|
+
- `GET /health` returned `{"status": "ok", "database": "ok", "app_name": "django-baseline-lab", "environment": "development"}`
|
|
148
|
+
- `POST /items` returned `{"id": 1, "name": "manual-smoke-item", "created_at": "2026-04-14T21:27:33.090Z"}`
|
|
149
|
+
- `GET /items` returned `[{"id": 1, "name": "manual-smoke-item", "created_at": "2026-04-14T21:27:33.090Z"}]`
|
|
150
|
+
- `./run_tests.sh` reported `Ran 2 tests in 0.005s`, `OK`, and `Django smoke check passed at http://127.0.0.1:32794`
|
|
151
|
+
- the interactive `docker compose up --build` path reached a healthy `/health` endpoint and printed `docker compose up --build reached healthy /health on http://127.0.0.1:32796/health`
|
|
152
|
+
|
|
153
|
+
## Known caveats
|
|
154
|
+
|
|
155
|
+
- this baseline uses direct Django migrations for the initial schema; introduce more advanced migration workflows only when the prompt grows beyond a baseline lab
|
|
156
|
+
- SQLite is the safe default for local baseline work, not a production recommendation for concurrent high-write deployments
|
|
157
|
+
- admin/auth are present only as framework defaults; they are not configured as finished product features
|
|
158
|
+
|
|
159
|
+
## What to reuse later
|
|
160
|
+
|
|
161
|
+
- Django official bootstrap shape
|
|
162
|
+
- config-file-plus-secret-file runtime pattern instead of `.env`
|
|
163
|
+
- Docker-first runtime contract
|
|
164
|
+
- `./run_tests.sh` wrapper pattern
|
|
165
|
+
- `./init_db.sh` as the single DB bootstrap entrypoint
|
|
166
|
+
- health endpoint + one persistence-backed route as the minimum real backend proof
|