feat: add standards wiki, MCP registry, and app template
This commit is contained in:
54
templates/README.md
Normal file
54
templates/README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Application Template
|
||||
|
||||
A minimal, runnable skeleton of the standardized architecture. It demonstrates
|
||||
both axes of the blueprint (see `standards`):
|
||||
|
||||
1. **Resource axis** — items and jobs, each a Claude-style generic CRUD slice
|
||||
(model → document → repo → service → route), all driven from `openapi.yaml`.
|
||||
2. **Pipeline axis** — a background `worker.py` that polls pending jobs and runs
|
||||
`pipelines/item_sync.py`, a deterministic async step chain.
|
||||
|
||||
Everything here is deliberately small so an agent can rewrite each file rather
|
||||
than delete unused code. The domain is a neutral "item", not an app noun.
|
||||
|
||||
## Instantiate a new app
|
||||
|
||||
cp -r templates/app apps/<your-app>
|
||||
cd apps/<your-app>
|
||||
|
||||
1. `pyproject.toml` — rename the package; keep the internal library pins.
|
||||
2. `config.py` — replace/add settings consumed by your domain.
|
||||
3. `openapi.yaml` — replace the `Item`/`Job` resources with your resources.
|
||||
4. `domain/` — rename `item` and `job` slices to your aggregates.
|
||||
5. `pipelines/item_sync.py` — replace the demo steps with your pipeline.
|
||||
6. `tests/` — keep the two test files as the pattern for your own.
|
||||
|
||||
Run the API:
|
||||
|
||||
pip install -e ".[dev]"
|
||||
uvicorn main:app --reload
|
||||
|
||||
Run the worker:
|
||||
|
||||
python worker.py
|
||||
|
||||
## What to keep, what to replace
|
||||
|
||||
| Keep | Replace / rename |
|
||||
|------------------------------|---------------------------------------|
|
||||
| `config.py` shape | Settings fields |
|
||||
| `init.py` wiring pattern | Resource names |
|
||||
| openapi-first routing | Paths, schemas, operationIds |
|
||||
| mongo-ops repo factory | Collections, doc models |
|
||||
| generic CRUD adaptor | Nothing (reuse as-is) |
|
||||
| worker poll + status loop | Job payloads, pipeline steps |
|
||||
|
||||
## Where the internal libraries slot in
|
||||
|
||||
- `openapi_first.app.OpenAPIFirstApp` — main.py, interfaces/openapi.py
|
||||
- `mongo_ops` — infra/db/setup.py, infra/db/repos/mongo.py, domain/*/ports/db.py
|
||||
- `hexa.build` — domain/*/ports/service.py
|
||||
- `dagpipe` — pipelines/ (wrap step chains in a DAG once they branch)
|
||||
|
||||
Confirm current endpoints and ownership with the `standards` registry MCP tool:
|
||||
`find_library("pipeline")`, `find_library("auth")`, etc.
|
||||
Reference in New Issue
Block a user