Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ on:
permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Lint, TypeCheck & Tests
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Setup Deno 2.x
uses: denoland/setup-deno@v2
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2
with:
deno-version: v2.x

Expand All @@ -35,3 +42,29 @@ jobs:

- name: Execute Unit & Integration Test Suite
run: deno test --unstable-kv -A

worker:
name: Cloudflare Worker (TypeCheck, Tests & Dry-Run)
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Setup Node.js 22
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
cache: npm

- name: Install Dependencies
run: npm ci

- name: TypeCheck & Vitest
run: npm run check

- name: Wrangler Dry-Run Bundle
run: npx wrangler deploy --dry-run
14 changes: 10 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,29 @@ permissions:
contents: read
security-events: write

concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: CodeQL AppSec Vulnerability Scan
runs-on: ubuntu-latest
timeout-minutes: 360
timeout-minutes: 60

steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@aaf92c3279600a7c7217a1cd605774c6c791c6c3 # v3
with:
languages: javascript-typescript
queries: security-extended,security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@aaf92c3279600a7c7217a1cd605774c6c791c6c3 # v3
with:
category: "/language:javascript-typescript"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
*.env.*.local

# Fresh & Deno build artifacts
node_modules/
.wrangler/
.dev.vars
dist/
_fresh/
.deno/
deno.lock
Expand Down
165 changes: 85 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,147 +1,152 @@
# StatusZero 🦕⚡
# StatusZero

> **The Zero-Config Status Page for Any GitHub Repository** An open-source,
> edge-native alternative to Vercel Status and Instatus. Built with **Deno
> Deploy**, **Deno KV**, **Fresh SSR**, and **Octokit**.
> **The Zero-Config Status Page for Any GitHub Repository** — An open-source,
> edge-native alternative to Vercel Status and Instatus. Powered by **Cloudflare
> Workers**, **Hono SSR**, **Cloudflare KV**, and **GitHub Actions**.

[![Status](https://img.shields.io/github/actions/workflow/status/glastor-dev/status/ci.yml?branch=master&label=CI%2FCD)](https://github.com/glastor-dev/status/actions)
[![Status](https://statuszero.pii-veilglastores.workers.dev/badge/glastor-dev/status.svg)](https://statuszero.pii-veilglastores.workers.dev/glastor-dev/status)
[![CI/CD](https://img.shields.io/github/actions/workflow/status/glastor-dev/status/ci.yml?branch=master&label=CI%2FCD)](https://github.com/glastor-dev/status/actions)
[![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](LICENSE)
[![Built with Deno](https://img.shields.io/badge/Deno-2.x-black?logo=deno)](https://deno.land)
[![Fresh Framework](https://img.shields.io/badge/Fresh-1.7.3-yellow?logo=fresh)](https://fresh.deno.dev)
[![Cloudflare Workers](https://img.shields.io/badge/Cloudflare-Workers-F38020?logo=cloudflare&logoColor=white)](https://workers.cloudflare.com)
[![Hono](https://img.shields.io/badge/Hono-4.x-E36002?logo=hono&logoColor=white)](https://hono.dev)
[![Repo](https://img.shields.io/badge/GitHub-glastor--dev%2Fstatus-181717?logo=github)](https://github.com/glastor-dev/status)

---

## ✨ Highlights
## Highlights

- **Zero Configuration**: No signup, database setup, or third-party paid
accounts. Just type any GitHub repository (`owner/repo`) and get a live status
page instantly.
- **Dynamic Real-Time SVG Badges**: Crisp, vector status badges
(`/badge/:owner/:repo.svg`) that reflect real-time operational status
(Operational, Degraded, Major Outage) with automatic HTTP edge caching.
- **Global Deno KV Caching**: Cached snapshots in Deno KV eliminate GitHub API
rate-limiting while serving status metrics in sub-50ms across 35+ global edge
locations.
- **Deep GitHub Actions CI/CD Telemetry**: Automatically tracks recent workflow
runs, run durations, commit SHAs, authors, branches, and success rates.
accounts. Visit `/:owner/:repo` for any public GitHub repository and get a
live status page instantly.
- **Dynamic Real-Time SVG Badges**: Crisp vector status badges
(`/badge/:owner/:repo.svg?lang=en|es&label=...`) with XML escaping and edge
HTTP caching.
- **Cloudflare Edge & KV Caching**: Runs across 300+ global edge locations
(~35 KiB gzipped bundle, ~5 ms startup) with dynamic KV TTL, conditional
GitHub **ETag (`304 Not Modified`)** requests, and consolidated 90-day daily
history snapshots.
- **Deep GitHub Actions CI/CD Telemetry**: Tracks recent workflow runs,
durations, commit SHAs, authors, branches, and failure rates in parallel.
- **Issue-Driven Incident Management**: Opening an issue labeled `incident`,
`outage`, `downtime`, or `bug` automatically flags system degradation with
real-time resolution timestamps.
- **90-Day Interactive Timeline**: Interactive daily uptime bars with hover
tooltips displaying daily uptime percentages and execution metrics.
- **Headless JSON REST API**: Query `/api/status/:owner/:repo` to power
Slack/Discord bots, widgets, or custom dashboards.
- **Automated CI Push Telemetry**: Optional 3-line step in your GitHub Actions
workflow pushes instant heartbeats via `POST /api/ping/:owner/:repo`.
`outage`, `downtime`, or `degradation` automatically updates system status and
the RSS 2.0 feed (`/rss/:owner/:repo.xml`).
- **Headless JSON REST API**: Query `/api/status/:owner/:repo` (with cooldown
protection on `?refresh=true`) to power bots, widgets, or dashboards.
- **Fail-Closed Push Telemetry & Webhooks**: Authenticated
`POST /api/ping/:owner/:repo` heartbeats (with latency & HTTP status integrated
into overall status) and HMAC-SHA256 verified `POST /api/webhook/github`.

---

## 🚀 Quick Start: Add to Your README
## Quick Start: Add to Your README

Simply paste this Markdown badge into your repository's `README.md`:
Paste this Markdown badge into your repository's `README.md`:

```markdown
[![Status](https://statuszero.deno.dev/badge/YOUR_OWNER/YOUR_REPO.svg)](https://statuszero.deno.dev/YOUR_OWNER/YOUR_REPO)
[![Status](https://statuszero.pii-veilglastores.workers.dev/badge/YOUR_OWNER/YOUR_REPO.svg)](https://statuszero.pii-veilglastores.workers.dev/YOUR_OWNER/YOUR_REPO)
```

Whenever users or team members click the badge, they are directed to your
dedicated status page: `https://statuszero.deno.dev/YOUR_OWNER/YOUR_REPO`
Clicking the badge opens your dedicated status page:
`https://statuszero.pii-veilglastores.workers.dev/YOUR_OWNER/YOUR_REPO`

---

## ⚡ Optional: Push Instant Heartbeats via GitHub Actions
## Optional: Push Instant Heartbeats via GitHub Actions

To record immediate status pings whenever your CI/CD pipeline finishes, add this
step to `.github/workflows/ci.yml`:
step to `.github/workflows/ci.yml` (configure `STATUSZERO_PING_SECRET` in your
repository secrets to match `PING_SECRET` in Cloudflare Workers):

```yaml
- name: 📡 Report Telemetry to StatusZero
- name: Report Telemetry to StatusZero
if: always()
env:
STATUSZERO_PING_SECRET: ${{ secrets.STATUSZERO_PING_SECRET }}
run: |
curl -s -X POST https://statuszero.deno.dev/api/ping/${{ github.repository }} \
curl -fsS -X POST "https://statuszero.pii-veilglastores.workers.dev/api/ping/${{ github.repository }}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${STATUSZERO_PING_SECRET}" \
-d '{"workflow":"${{ github.workflow }}","status":"${{ job.status }}","branch":"${{ github.ref_name }}","commit":"${{ github.sha }}"}'
```

---

## 🛠 Tech Stack
## Tech Stack

- **Runtime**: [Deno 2.x](https://deno.com)
- **Framework**: [Fresh 1.7.3](https://fresh.deno.dev) (Islands architecture &
Server-Side Rendering)
- **Database & Cache**: [Deno KV](https://deno.com/kv) (Global ACID Key-Value
store on Deno Deploy)
- **API Client**: `@octokit/rest` (GitHub REST & Actions API)
- **Styling**: Modern Vanilla CSS Design System with dark mode, glassmorphism,
and responsive layouts
- **Deployment Target**: [Deno Deploy](https://deno.com/deploy)
- **Runtime & Hosting**: [Cloudflare Workers](https://workers.cloudflare.com) +
Workers Static Assets (`./public`)
- **Framework**: [Hono](https://hono.dev) (`hono/jsx` Server-Side Rendering)
- **Storage & Cache**: [Cloudflare KV](https://developers.cloudflare.com/kv/)
(`STATUS_KV` binding)
- **GitHub Integration**: Native Web `fetch` + conditional `If-None-Match` ETag
requests + Web Crypto API (`crypto.subtle`)
- **Testing**: [Vitest](https://vitest.dev) + TypeScript strict mode

---

## 💻 Local Development
## Local Development

### 1. Prerequisites

Install Deno (version 2.0 or later):
### 1. Install dependencies

```bash
# Windows (PowerShell)
irm https://deno.land/install.ps1 | iex
npm install
```

### 2. Run the Worker locally

# macOS / Linux
curl -fsSL https://deno.land/install.sh | sh
```bash
npm run dev
```

### 2. Run the Development Server
### 3. Type-check, test, and dry-run bundle

```bash
deno task start
npm run check
npx wrangler deploy --dry-run
```

The server will start at `http://localhost:8000/`.
---

### 3. Run Tests & Validation
## Deploy to Cloudflare Workers

```bash
# Run unit & integration test suite
deno test --unstable-kv -A
1. Authenticate with Cloudflare and create the KV namespace:

# Type-check and lint
deno task check
```bash
npx wrangler login
npx wrangler kv namespace create STATUS_KV
```

---
2. Put the generated KV namespace `id` into `wrangler.jsonc`.
3. Configure production secrets (fail-closed by default):

## 🌐 Deploy to Deno Deploy
```bash
npx wrangler secret put GITHUB_WEBHOOK_SECRET
npx wrangler secret put PING_SECRET
# Optional (recommended): fine-grained read-only token for 5,000 req/h
npx wrangler secret put GITHUB_TOKEN
```

Deploy with 1-click or via GitHub integration on
[Deno Deploy Dashboard](https://dash.deno.com):
4. Deploy to the global edge:

1. Connect your repository.
2. Set entry point to `main.ts`.
3. _(Optional)_ Add `GITHUB_TOKEN` environment variable in project settings to
increase rate limit from 60 to 5,000 requests/hour.
```bash
npm run deploy
```

---

## 📚 Documentación y Recursos
## Documentación y Recursos

- 👥 [CONTRIBUTORS.md](CONTRIBUTORS.md) — Gobernanza, equipo y guía de
patrocinio.
- 📜 [CHANGELOG.md](CHANGELOG.md) — Historial de versiones y notas de
lanzamiento.
- 🔖 [CITATION.cff](CITATION.cff) — Metadatos de citación académica y de
software.
- 🛡️ [SECURITY.md](.github/SECURITY.md) — Políticas de seguridad y reporte de
- [CONTRIBUTORS.md](CONTRIBUTORS.md) — Gobernanza, equipo y guía de patrocinio.
- [CHANGELOG.md](CHANGELOG.md) — Historial de versiones y notas de lanzamiento.
- [CITATION.cff](CITATION.cff) — Metadatos de citación académica y de software.
- [SECURITY.md](.github/SECURITY.md) — Políticas de seguridad y reporte de
vulnerabilidades.
- 📄 [LICENSE](LICENSE) — Licencia de código abierto GNU Affero General Public
- [LICENSE](LICENSE) — Licencia de código abierto GNU Affero General Public
License v3.0 (AGPL-3.0).

---

## 📄 Licencia
## Licencia

Este proyecto está licenciado bajo los términos de la **GNU Affero General
Public License v3.0 (AGPL-3.0)**. Consulta el archivo [LICENSE](LICENSE) para
Expand Down
6 changes: 5 additions & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
# Si se define, solo las peticiones con 'Authorization: Bearer <token>' o 'x-statuszero-token' serán admitidas.
# PING_SECRET=your_ping_secret_here

# GITHUB_WEBHOOK_SECRET (Opcional - AppSec)
# GITHUB_WEBHOOK_SECRET (Requerido en producción - fail-closed)
# Clave secreta para verificar firmas HMAC-SHA256 (x-hub-signature-256) en /api/webhook/github.
# GITHUB_WEBHOOK_SECRET=your_webhook_secret_here

# Solo desarrollo local (NO activar en producción):
# ALLOW_UNAUTHENTICATED_PINGS=false
# ALLOW_UNAUTHENTICATED_WEBHOOKS=false
Loading
Loading