You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add spec conformance validator with reusable GitHub Action
Introduce a Python validation script that checks app repos against the
platform spec across three tiers (structure, content, runtime). Distribute
it to app repos via a reusable composite action. Tighten spec.md with
explicit Dockerfile locations, dependency requirements, HTTP 200 health
status, and an expanded compatibility checklist aligned to validator checks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/spec.md
+62-9Lines changed: 62 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Application Specification
2
2
3
+
**Spec Version:** 1.0
4
+
3
5
This document defines the **standard contract for applications** running on the Towlion platform. Every application repository in the ecosystem should follow this specification.
4
6
5
7
## Goals
@@ -18,7 +20,10 @@ Each application lives in its own GitHub repository under the `towlion` organiza
18
20
```
19
21
repo/
20
22
app/ # FastAPI backend
21
-
frontend/ # Next.js frontend
23
+
Dockerfile # Backend container image
24
+
main.py # Application entry point
25
+
frontend/ # Next.js frontend (optional)
26
+
Dockerfile # Frontend container image
22
27
23
28
deploy/
24
29
docker-compose.yml # App-specific containers
@@ -35,7 +40,9 @@ repo/
35
40
README.md
36
41
```
37
42
38
-
In the multi-app setup, `docker-compose.yml` defines only the application containers (app, frontend, workers). Shared platform services (Caddy, PostgreSQL, Redis, MinIO) are managed at the server level. The `docker-compose.standalone.yml` file bundles everything for self-hosted fork deployments.
43
+
In the multi-app setup, `docker-compose.yml` defines only the application containers (app, frontend, workers). Shared platform services (Caddy, PostgreSQL, Redis, MinIO) are managed at the server level.
44
+
45
+
The `docker-compose.standalone.yml` file provides a complete, self-contained stack for self-hosted fork deployments. It bundles all platform services (Caddy, PostgreSQL, Redis, MinIO) alongside the application containers so the app can run on a single server without any external dependencies.
39
46
40
47
## Backend Requirements
41
48
@@ -52,6 +59,7 @@ The platform reverse proxy routes traffic to this port.
52
59
Every application must provide a health check endpoint:
53
60
54
61
-**Endpoint:**`GET /health`
62
+
-**HTTP Status:**`200 OK`
55
63
-**Response:**`{"status": "ok"}`
56
64
57
65
This endpoint is used during deployments to verify the application started correctly.
@@ -118,15 +126,26 @@ Applications should avoid storing large files on the container filesystem.
118
126
119
127
Applications may include a frontend built with Next.js, React, and TypeScript. The frontend communicates with the backend via `/api`.
120
128
129
+
## Dependencies
130
+
131
+
Python dependencies must be declared in one of:
132
+
133
+
-`requirements.txt` (default)
134
+
-`pyproject.toml` (alternative)
135
+
136
+
At minimum, dependencies must include `fastapi` and `uvicorn`.
137
+
121
138
## Docker Requirements
122
139
123
-
Each repository must include Docker configuration. The container must:
140
+
Each repository must include Docker configuration. The backend Dockerfile must be located at `app/Dockerfile`. If the app includes a frontend, its Dockerfile must be at `frontend/Dockerfile`.
141
+
142
+
The container must:
124
143
125
144
- Start automatically
126
145
- Expose port 8000
127
146
- Read configuration from environment variables
128
147
129
-
Example Dockerfile:
148
+
Example `app/Dockerfile`:
130
149
131
150
```dockerfile
132
151
FROM python:3.11
@@ -161,9 +180,43 @@ Applications should follow basic security practices:
161
180
162
181
To remain compatible with the Towlion platform, applications must:
163
182
183
+
**Structure:**
184
+
-[ ] Include `app/` directory with `Dockerfile` and `main.py`
185
+
-[ ] Include `deploy/` directory with `docker-compose.yml`, `docker-compose.standalone.yml`, `Caddyfile`, and `env.template`
186
+
-[ ] Include `.github/workflows/deploy.yml`
187
+
-[ ] Include `scripts/health-check.sh`
188
+
-[ ] Include `README.md`
189
+
190
+
**Content:**
191
+
-[ ]`deploy/docker-compose.yml` is valid YAML, references port 8000, and includes a healthcheck
192
+
-[ ]`deploy/env.template` contains `APP_DOMAIN`, `DATABASE_URL`, and `REDIS_URL`
193
+
-[ ]`deploy/Caddyfile` contains `reverse_proxy` directive targeting port 8000
194
+
-[ ]`app/main.py` uses FastAPI
195
+
-[ ] Python dependencies (`requirements.txt` or `pyproject.toml`) include `fastapi` and `uvicorn`
196
+
-[ ] No hardcoded secrets in source code
197
+
198
+
**Runtime:**
164
199
-[ ] Expose HTTP service on port 8000
165
-
-[ ] Provide `GET /health` endpoint
166
-
-[ ] Support environment-based configuration
167
-
-[ ] Support automated deployment via GitHub Actions
168
-
-[ ] Use PostgreSQL for database
169
-
-[ ] Include Docker configuration
200
+
-[ ]`GET /health` returns HTTP 200 with `{"status": "ok"}`
201
+
-[ ] Containers build and start successfully
202
+
203
+
## Validation
204
+
205
+
Use the [Towlion Spec Validator](../validator/README.md) to automatically check conformance.
206
+
207
+
**Local usage:**
208
+
209
+
```bash
210
+
# Clone the platform repo and run against your app
0 commit comments