diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0eff54a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog + +## 1.0.0-beta.1 (2026-05-10) + +Initial public beta. + +### Added +- Web dashboard with AI pre-grading detail panel, PSA signal bar, source filters +- Multi-source slab search: compare PSA 10 prices across eBay, magi.camp, Yahoo Auctions +- AI pre-grading from listing photos (centering, corners, edges, surface + confidence) +- PSA tier recommendations (Value/Regular/Express) with reasoning per card value +- REST API with CC_LIVE_ key auth, rate limiting (60/min auth, 20/min demo), error monitoring +- Firestore caching with stale-while-revalidate, per-key cache isolation +- Magi search migrated from Playwright to fetch+cheerio (~10x faster) +- eBay sold scrape retry with backoff on 503 +- 105 tests (63 unit + 42 API integration) +- GitHub Actions CI on push/PR +- Chrome extension: queue auto-join for Pokemon Center, Walmart, Costco, Target +- Claude Code `/casecomp` skill for plain-English card search + +### Infrastructure +- GCP Cloud Run (asia-south1), Firestore, HTTPS load balancer, managed SSL +- Secret Manager for API keys (EBAY, ANTHROPIC, PSA, CASECOMP) +- Cloud Monitoring alert policy (email on >5 errors/5min) +- Terraform with GCS state backend diff --git a/README.md b/README.md index 39d925d..459963c 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,28 @@ # Casecomp logo Casecomp -[![Version](https://img.shields.io/badge/version-1.0.0--beta.1-d9b676)](https://api.casecomp.xyz/docs/spec.json) +[![Version](https://img.shields.io/badge/version-1.0.0--beta.1-d9b676)](CHANGELOG.md) [![Tests](https://github.com/Pyronewbic/casecomp/actions/workflows/test.yml/badge.svg)](https://github.com/Pyronewbic/casecomp/actions/workflows/test.yml) [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE) [![API](https://img.shields.io/badge/API-docs-d9b676)](https://api.casecomp.xyz/docs) -**[casecomp.xyz](https://casecomp.xyz)** | **[API Docs](https://api.casecomp.xyz/docs)** | **[Dashboard](https://api.casecomp.xyz)** +**[casecomp.xyz](https://casecomp.xyz)** | **[API Docs](https://api.casecomp.xyz/docs)** | **[Dashboard](https://api.casecomp.xyz)** | **[Changelog](CHANGELOG.md)** -Pokemon TCG card research tool. Live listings from eBay, magi.camp, Yahoo Auctions JP, and SNKRDUNK with AI pre-grading, PSA grading signals, and multi-source slab comparison. +Search any Pokemon card across four marketplaces in one query. Get live prices, AI condition estimates, and PSA grading signals — instead of manually checking eBay, magi.camp, Yahoo Auctions, and SNKRDUNK separately. ![eBay Pokémon card search demo](docs/demo.gif) +### Features + +- **Multi-source search** — eBay, magi.camp, Yahoo Auctions JP, SNKRDUNK in one query +- **AI pre-grading** — centering, corners, edges, surface scores from listing photos (Claude/OpenAI) +- **PSA grading signals** — population data, difficulty, gem 10%, recommended submission tier with reasoning +- **Slab comparison** — compare PSA 10 / BGS 9.5 / TAG 10 prices across sources with filter pills +- **Sold comps** — recent sold prices to see what cards actually sell for +- **Web dashboard** — interactive search UI with detail panel, grade breakdown bars, source filters +- **REST API** — authenticated endpoints with rate limiting, per-key caching, OpenAPI spec +- **Claude Code skill** — `/casecomp` for plain-English card search, no CLI flags needed +- **Chrome extension** — queue auto-join for Pokemon Center, Walmart, Costco, Target drops + --- ## Quick start @@ -191,6 +203,12 @@ Load unpacked from `extension/` in `chrome://extensions`. 105 tests: 63 unit (filters, grading, query builder, demo data integrity) + 42 API (health, drops, webhooks, search, sold, PSA, grade, auth, demo validation). +## Contributing + +Contributions welcome. Fork the repo, create a branch, and open a PR against `dev`. Run `yarn test` before submitting — all 105 tests must pass. + +For bug reports or feature requests, open an [issue](https://github.com/Pyronewbic/casecomp/issues). + ## Terms of Use Personal, non-commercial use only. Not for scalping, cook groups, or bulk purchasing. Full terms in [LICENSE](LICENSE). diff --git a/terraform/README.md b/terraform/README.md new file mode 100644 index 0000000..88169ef --- /dev/null +++ b/terraform/README.md @@ -0,0 +1,50 @@ +# Terraform — Casecomp Infrastructure + +GCP infrastructure for the Casecomp API. State is stored in a GCS bucket (`casecomp-terraform-state`). + +## Resources + +| Resource | Purpose | +|----------|---------| +| Cloud Run (`cardscrapebot`) | API + dashboard, asia-south1, scales to 20 instances | +| Firestore | Grade logs, drops, webhooks, alerts, all caches | +| HTTPS Load Balancer | Global IP, managed SSL cert, URL map, backend service | +| Secret Manager | EBAY_CLIENT_ID/SECRET, ANTHROPIC_API_KEY, PSA_AUTH_TOKEN, CASECOMP_API_KEY | +| Cloud Monitoring | Log-based metric on `[ERROR]`, email alert on >5 errors/5min | +| APIs enabled | Cloud Run, Compute, Firestore, Cloud Build, Secret Manager, Monitoring | + +## Variables + +| Variable | Default | Description | +|----------|---------|-------------| +| `project_id` | `casecomp-495718` | GCP project | +| `region` | `asia-south1` | Deploy region | +| `domain` | `api.casecomp.xyz` | SSL cert domain | +| `container_image` | `gcr.io/casecomp-495718/cardscrapebot` | Docker image | +| `alert_email` | *(sensitive, in terraform.tfvars)* | Monitoring alert recipient | + +## Usage + +```bash +terraform init # first time — downloads providers, connects to GCS backend +terraform plan # preview changes +terraform apply # apply changes +``` + +## Importing existing resources + +If resources were created manually (outside Terraform), import them before applying: + +```bash +terraform import google_cloud_run_v2_service.api \ + "projects/casecomp-495718/locations/asia-south1/services/cardscrapebot" +``` + +## Files + +| File | Content | +|------|---------| +| `main.tf` | All resource definitions | +| `variables.tf` | Input variables with defaults | +| `terraform.tfvars` | Sensitive values (gitignored) | +| `.terraform.lock.hcl` | Provider version lock | diff --git a/terraform/main.tf b/terraform/main.tf index af53161..44d271e 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -257,6 +257,60 @@ resource "google_monitoring_alert_policy" "api_error_alert" { depends_on = [google_project_service.monitoring] } +resource "google_monitoring_uptime_check_config" "api_uptime" { + display_name = "Casecomp API Health" + timeout = "10s" + period = "300s" + + http_check { + path = "/api/health" + port = 443 + use_ssl = true + validate_ssl = true + } + + monitored_resource { + type = "uptime_url" + labels = { + project_id = var.project_id + host = var.domain + } + } + + depends_on = [google_project_service.monitoring] +} + +resource "google_monitoring_alert_policy" "api_uptime_alert" { + display_name = "Casecomp API Down" + combiner = "OR" + + conditions { + display_name = "Health check failing" + + condition_threshold { + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" AND resource.type=\"uptime_url\" AND metric.labels.check_id=\"${google_monitoring_uptime_check_config.api_uptime.uptime_check_id}\"" + comparison = "COMPARISON_GT" + threshold_value = 1 + duration = "300s" + + aggregations { + alignment_period = "300s" + per_series_aligner = "ALIGN_NEXT_OLDER" + cross_series_reducer = "REDUCE_COUNT_FALSE" + group_by_fields = ["resource.label.project_id"] + } + } + } + + notification_channels = [google_monitoring_notification_channel.email.id] + + alert_strategy { + auto_close = "1800s" + } + + depends_on = [google_project_service.monitoring] +} + # ── Outputs ─────────────────────────────────────────────────── output "cloud_run_url" {