Skip to content

Commit 12820ac

Browse files
committed
feat(api): initial scaffold (v0.1.0)
- Express 5 + TypeScript skeleton with /api/healthz - Vitest smoke test + coverage config - Canonical OpenAPI stub at lib/api-spec/openapi.yaml - 8-doc CTO navigation under docs/ - ESLint + Prettier + tsc CI gating - Dependabot, PR/issue templates, SECURITY.md - License: Proprietary Migrated from CTO restructure plan Phase 1.
0 parents  commit 12820ac

34 files changed

Lines changed: 819 additions & 0 deletions

.env.example

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ArdaLink API — environment template
2+
# Copy to .env and fill in. Never commit .env.
3+
4+
# Server
5+
PORT=3000
6+
NODE_ENV=development
7+
LOG_LEVEL=info
8+
9+
# Database — PostgreSQL (operational data)
10+
DATABASE_URL=postgresql://user:password@localhost:5432/ardalink
11+
12+
# Database — Azure Cosmos DB (reference data: baselines, pixel grids)
13+
COSMOS_DB_ENDPOINT=https://your-account.documents.azure.com:443/
14+
COSMOS_DB_PRIMARY_KEY=your-cosmos-db-primary-key
15+
16+
# Azure OpenAI
17+
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
18+
AZURE_OPENAI_API_KEY=your-azure-openai-api-key
19+
AZURE_OPENAI_CHAT_DEPLOYMENT=gpt-4o
20+
AZURE_OPENAI_WHISPER_DEPLOYMENT=whisper
21+
AZURE_OPENAI_REALTIME_DEPLOYMENT=gpt-4o-realtime-preview
22+
23+
# Google Earth Engine (single-line JSON)
24+
GOOGLE_SERVICE_ACCOUNT_JSON={"type":"service_account","project_id":"..."}
25+
26+
# Africa's Talking
27+
AFRICASTALKING_USERNAME=sandbox
28+
AFRICASTALKING_API_KEY=your-africastalking-api-key
29+
AFRICASTALKING_CALLER_ID=+254711082200
30+
31+
# App
32+
RECIPIENT_PHONE=+254700000000
33+
SESSION_SECRET=your-random-session-secret-here
34+
35+
# Optional rate limits
36+
PUBLIC_TALK_DAILY_BUDGET_MINUTES=30
37+
PUBLIC_TALK_MAX_CALLS_PER_PHONE=3
38+
PUBLIC_TALK_MAX_CALLS_PER_IP=10
39+
TALK_CHAT_MAX_MSGS_PER_IP=50
40+
TALK_CHAT_PER_IP_COOLDOWN_MS=60000
41+
42+
# Optional location defaults (Bula Pesa Ward)
43+
WARD_CLIMATE_LAT=0.355
44+
WARD_CLIMATE_LON=37.583
45+
LOCAL_ZONE_LAT=0.355
46+
LOCAL_ZONE_LON=37.583
47+
LOCAL_ZONE_RADIUS_KM=5

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @MUNENE1212
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Bug report
3+
---
4+
5+
## Describe
6+
7+
## Repro
8+
```bash
9+
curl ...
10+
```
11+
12+
## Expected
13+
14+
## Environment
15+
- Version:
16+
- Node:
17+
- Postgres:
18+
19+
## Logs
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: Feature request
3+
---
4+
5+
## Problem
6+
7+
## Proposal
8+
9+
## Acceptance
10+
- [ ]
11+
- [ ]

.github/ISSUE_TEMPLATE/security.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: Security vulnerability
3+
---
4+
5+
> Email **security@ardalink.local** instead of filing publicly.
6+
> See [SECURITY.md](../../SECURITY.md).

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Description
2+
3+
## Type
4+
- [ ] Bug fix
5+
- [ ] New feature
6+
- [ ] Breaking change
7+
- [ ] Docs / refactor
8+
9+
## Related
10+
Fixes #
11+
12+
## Changes
13+
-
14+
-
15+
16+
## Testing
17+
- [ ] Unit tests added/updated
18+
- [ ] All tests pass locally
19+
20+
## Checklist
21+
- [ ] Conventional Commit message
22+
- [ ] `pnpm run lint` passes
23+
- [ ] `pnpm run typecheck` passes
24+
- [ ] No new secrets committed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule: { interval: 'weekly' }
6+
groups:
7+
minor-and-patch:
8+
patterns: ['*']
9+
- package-ecosystem: 'github-actions'
10+
directory: '/'
11+
schedule: { interval: 'weekly' }

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main, dev, 'release/**']
6+
push:
7+
branches: [main, dev]
8+
9+
jobs:
10+
lint:
11+
name: Lint (eslint + prettier + tsc)
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: '24'
18+
cache: 'pnpm'
19+
- uses: pnpm/action-setup@v4
20+
with:
21+
version: 9
22+
- run: pnpm install --frozen-lockfile
23+
- run: pnpm run lint
24+
- run: pnpm run format:check
25+
- run: pnpm run typecheck
26+
27+
test:
28+
name: Test (vitest + coverage)
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: '24'
35+
cache: 'pnpm'
36+
- uses: pnpm/action-setup@v4
37+
with: { version: 9 }
38+
- run: pnpm install --frozen-lockfile
39+
- run: pnpm run test:cov
40+
- uses: actions/upload-artifact@v4
41+
with: { name: coverage, path: coverage/ }
42+
43+
secrets:
44+
name: Secrets scan
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
with: { fetch-depth: 0 }
49+
- uses: gitleaks/gitleaks-action@v2
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
vuln-scan:
54+
name: Vuln scan
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/setup-node@v4
59+
with:
60+
node-version: '24'
61+
cache: 'pnpm'
62+
- uses: pnpm/action-setup@v4
63+
with: { version: 9 }
64+
- run: pnpm install --frozen-lockfile
65+
- run: pnpm audit --prod --audit-level=high
66+
- uses: aquasecurity/trivy-action@master
67+
with:
68+
scan-type: 'fs'
69+
scan-ref: '.'
70+
format: 'sarif'
71+
output: 'trivy.sarif'
72+
- uses: github/codeql-action/upload-sarif@v3
73+
if: always()
74+
with: { sarif_file: trivy.sarif }

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*.*.*']
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
name: Build and publish
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with: { fetch-depth: 0 }
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '24'
20+
cache: 'pnpm'
21+
- uses: pnpm/action-setup@v4
22+
with: { version: 9 }
23+
- run: pnpm install --frozen-lockfile
24+
- run: pnpm run build
25+
- uses: actions/upload-artifact@v4
26+
with: { name: dist, path: dist/ }
27+
- uses: softprops/action-gh-release@v2
28+
with: { generate_release_notes: true }

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
node_modules/
2+
dist/
3+
tmp/
4+
out-tsc/
5+
*.tsbuildinfo
6+
7+
# IDE
8+
.idea/
9+
.vscode/*
10+
!.vscode/settings.json
11+
!.vscode/tasks.json
12+
13+
# OS
14+
.DS_Store
15+
Thumbs.db
16+
17+
# Env / secrets
18+
.env
19+
.env.*
20+
!.env.example
21+
22+
# Test artifacts
23+
coverage/
24+
*.log
25+
26+
# Local scratch
27+
outputs/
28+
screenshots/
29+
exports/

0 commit comments

Comments
 (0)