c0py: initial scaffolding for website registry tool
CI (SIAX Cloud) / security (push) Successful in 12s
CI (SIAX Cloud) / contracts (push) Failing after 12s
CI (SIAX Cloud) / quality (push) Failing after 8s
Deploy to Coolify / deploy (push) Failing after 2s

This commit is contained in:
2026-09-16 13:15:21 +02:00
commit e6cc719f37
58 changed files with 1131 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
# C0PY — Plattformsinfrastruktur
Det här dokumentet beskriver hur c0py ska sättas upp på SIAX Cloud.
## Steg 1: Skapa repo (Gitea)
```bash
# Repot skapas på git.siax.io som sax3l/c0py
# Pusha sedan lokalt repo
git push git@100.121.34.99:2222/sax3l/c0py.git main
```
## Steg 2: Coolify app
| Inställning | Värde |
|---|---|
| Resource type | Application |
| Git source | `git@100.121.34.99:2222/sax3l/c0py.git` |
| Build pack | Dockerfile |
| Domain | `c0py.siax.io` |
| Port | 3000 |
| Healthcheck path | `/health` |
## Steg 3: Postgres
Skapa dedikerad Postgres i Coolify för c0py (ej shared). Databasnamn: `c0py`.
## Steg 4: Infisical secrets
Projekt: `c0py` (eller nytt under `siax-platform`)
| Secret | Värde |
|---|---|
| `DATABASE_URL` | Postgres connection string |
| `CL0UD_BASE_URL` | `https://cl0ud.siax.io` |
| `ZITADEL_ISSUER` | `https://id-customers.siax.io` |
| `ZITADEL_AUDIENCE` | `api.c0py.siax.io` |
| `PORT` | `3000` |
## Steg 5: DNS
`c0py.siax.io` → A-record → server med Coolify appen (Cloudflare + PowerDNS dual-write).
## Steg 6: Zitadel projekt
Skapa OIDC-app under projekt `c0py` (eller motsvarande). Client credentials flow för API, PKCE för web.
## Steg 7: Deploy verification
1. `pnpm install --frozen-lockfile` (eller motsvarande i CI)
2. `pnpm run typecheck`
3. `pnpm run test`
4. `pnpm run build`
5. Pusha main → CI → Deploy via `.gitea/workflows/deploy.yml`
6. Verifiera `https://c0py.siax.io/health` → 200 OK
7. Verifiera fail-closed: `https://c0py.siax.io/v1/c0py/registries` → 401 utan token
+76
View File
@@ -0,0 +1,76 @@
# C0PY Architecture
## Översikt
C0PY är ett verktyg för att skapa fullständigt register över en hemsida ut alla aspekter. Det konsumerar en webbadress och producerar ett strukturerat register med information om sidor, struktur, innehåll, prestanda och mer.
## Komponenter
```
┌──────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ apps/web │────→│ apps/api │────→│ packages/ │
│ (Next.js) │◄────│ (Fastify/API) │◄────│ c0py-core │
└──────────────┘ └──────────────────┘ └─────────────────┘
│
┌───────┴───────┐
│ Integrations │
│ (CL0UD,ST0RE│
│ AUD0,INF0,N0D│
└───────────────┘
```
## Ytor
| Yta | Beskrivning |
|---|---|
| `apps/api/src/routes/` | REST-rutter under /v1/c0py/* |
| `apps/api/src/services/` | Tjocka tjänster, rent TS |
| `apps/web/src/app/` | Next.js App Router — registerhantering |
| `apps/web/src/components/` | Delade UI-komponenter |
| `packages/c0py-core/` | Crawling, registry-uppbyggnad, analys |
| `packages/config/` | Zod-env-validering |
| `packages/types/` | Gemensamma typer |
## Konsumerade kapabiliteter
- **CL0UD**: Autentisering (Zitadel OIDC), RBAC, tenant-isolering
- **AUD0**: Regeleveranshändelser (skrivs när tillgängligt, fail-closed annars)
- **ST0RE**: Objektlagring för registerdata
- **INF0**: AI-baserad innehållsanalys
- **N0D**: Asynkrone crawling-jobb för stora sajter
## Datamodell (initiell)
```
Registry
├── id: uuid
├── url: string (målhemsadress)
├── name: string
├── createdAt: timestamp
├── updatedAt: timestamp
│
├── Page[]
│ ├── id: uuid
│ ├── registryId: uuid
│ ├── url: string
│ ├── path: string
│ ├── title: string?
│ ├── description: string?
│ ├── status: number
│ ├── contentType: string?
│ ├── discoveredAt: timestamp
│ └── analysis: JSON?
│
└── ScanRun[]
├── id: uuid
├── registryId: uuid
├── status: pending|running|completed|failed
├── startedAt: timestamp
└── completedAt: timestamp?
```
## Säkerhet
- Tenant identifierad via CL0UD-session, ALDRIG från klientinput
- Alla writes fail-closed (inget vs fel config = nek)
- Inga hemligheter i repo