{"id":50712174,"url":"https://github.com/ba0f3/is-sap-go","last_synced_at":"2026-06-09T16:04:20.224Z","repository":{"id":352515674,"uuid":"1213011387","full_name":"ba0f3/is-sap-go","owner":"ba0f3","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-20T01:10:34.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-20T01:23:47.550Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ba0f3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-17T00:42:16.000Z","updated_at":"2026-04-20T01:08:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ba0f3/is-sap-go","commit_stats":null,"previous_names":["ba0f3/is-sap-go"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ba0f3/is-sap-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ba0f3%2Fis-sap-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ba0f3%2Fis-sap-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ba0f3%2Fis-sap-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ba0f3%2Fis-sap-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ba0f3","download_url":"https://codeload.github.com/ba0f3/is-sap-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ba0f3%2Fis-sap-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34114462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-09T16:04:19.063Z","updated_at":"2026-06-09T16:04:20.217Z","avatar_url":"https://github.com/ba0f3.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# is-sap-go\n\n**Detect Single Page Application frameworks from HTML responses**\n\n[![CI](https://github.com/ba0f3/is-sap-go/actions/workflows/ci.yml/badge.svg)](https://github.com/ba0f3/is-sap-go/actions/workflows/ci.yml)\n[![Go Reference](https://pkg.go/dev/badge/github.com/ba0f3/is-sap-go.svg)](https://pkg.go/dev/github.com/ba0f3/is-sap-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ba0f3/is-sap-go)](https://goreportcard.com/report/github.com/ba0f3/is-sap-go)\n\n\u003c/div\u003e\n\n---\n\n`is-sap-go` inspects an HTTP response (or raw HTML) and determines whether a page is a **Single Page Application**, identifying the specific framework, meta-framework, and hosting platform with confidence scores.\n\n## Features\n\n- **30+ signatures** covering React, Vue, Angular, Svelte, Next.js, Nuxt, Remix, Astro, SvelteKit, and more\n- **Confidence-weighted scoring** with hit multiplier for multiple matching signals\n- **Redundancy suppression** — detects Next.js without also reporting React\n- **Hosting detection** — Vercel, Netlify, Cloudflare Pages, GitHub Pages, Fly.io, Render\n- **Optional JS sandbox** via [goja](https://github.com/dop251/goja) to extract `window.__*` globals from inline scripts\n- **Zero HTTP dependencies** for the detection path — bring your own `*http.Client`\n- **Functional options** API for clean configuration\n\n## Install\n\n```bash\ngo get github.com/ba0f3/is-sap-go\n```\n\n**Requires Go 1.22+**\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"encoding/json\"\n    \"fmt\"\n    \"time\"\n\n    sap \"github.com/ba0f3/is-sap-go\"\n)\n\nfunc main() {\n    ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n    defer cancel()\n\n    result, err := sap.Detect(ctx, \"https://nextjs.org\",\n        sap.WithTimeout(10*time.Second),\n        sap.WithUserAgent(\"my-scanner/1.0\"),\n    )\n    if err != nil {\n        panic(err)\n    }\n\n    data, _ := json.MarshalIndent(result, \"\", \"  \")\n    fmt.Println(string(data))\n}\n```\n\nOutput:\n\n```json\n{\n  \"url\": \"https://nextjs.org\",\n  \"status_code\": 200,\n  \"is_spa\": true,\n  \"confidence\": 0.95,\n  \"frameworks\": [\n    {\n      \"name\": \"Next.js\",\n      \"category\": \"meta_framework\",\n      \"confidence\": 0.95,\n      \"signals\": [\"selector \\\"div#__next\\\"\", \"script src contains \\\"/_next/\\\"\"]\n    }\n  ],\n  \"hosting\": [\n    {\n      \"name\": \"Vercel\",\n      \"category\": \"hosting\",\n      \"confidence\": 0.80,\n      \"signals\": [\"header x-vercel-id: abc123\"]\n    }\n  ],\n  \"headers\": {\n    \"Content-Type\": [\"text/html; charset=utf-8\"],\n    \"X-Vercel-Id\": [\"abc123\"]\n  }\n}\n```\n\n## API\n\n### `Detect(ctx, url, ...Option) (*Result, error)`\n\nFetches the URL and runs all detection signatures.\n\n### `DetectFromResponse(resp, body, ...Option) (*Result, error)`\n\nDetects from a pre-fetched `*http.Response` and its body bytes.\n\n### `DetectFromHTML(html, headers, ...Option) (*Result, error)`\n\nLowest-level entry point. Analyzes raw HTML string and `http.Header`.\n\n### Options\n\n| Option | Type | Default | Description |\n|---|---|---|---|\n| `WithTimeout` | `time.Duration` | `10s` | HTTP request timeout |\n| `WithUserAgent` | `string` | `\"is-sap-go/1.0\"` | User-Agent header |\n| `WithMaxBodyBytes` | `int64` | `2 MiB` | Max response body to read |\n| `WithFollowRedirects` | `bool` | `true` | Follow HTTP 3xx redirects |\n| `WithEnableJSEval` | `bool` | `false` | Enable goja JS sandbox |\n| `WithHTTPClient` | `*http.Client` | *(new)* | Custom HTTP client |\n\n## Detection Methodology\n\nEach **signature** defines a framework name, category, weight, and a list of **matchers**:\n\n| Weight | Meaning |\n|---|---|\n| `0.95` | Definitive signal (e.g., `#__next` selector for Next.js) |\n| `0.6–0.8` | Strong signal (e.g., `data-reactroot` for React) |\n| `0.3–0.5` | Weak/generic signal (e.g., `div#app` for SPA generic) |\n\nMultiple matching signals increase the score via a hit multiplier. Confidence is computed as `1 − e^(−score)` and capped at `1.0`. When a meta-framework (e.g., Next.js) is detected, implied frameworks (React) are suppressed unless they have independent high-confidence signals.\n\n### Categories\n\n| Category | Description |\n|---|---|\n| `spa_framework` | Frontend libraries: React, Vue, Angular, Svelte, etc. |\n| `meta_framework` | Full-stack frameworks: Next.js, Nuxt, Remix, Astro, etc. |\n| `hosting` | Platform detection: Vercel, Netlify, Cloudflare Pages, etc. |\n| `bundler` | Build tools: Webpack, Vite, esbuild, etc. |\n\n### Matcher Types\n\n| Matcher | Description |\n|---|---|\n| `HeaderContains` | Response header contains substring |\n| `HeaderRegex` | Response header matches regex |\n| `AnyHeader` | Response header is present |\n| `CookieNameHas` | Cookie with given name exists |\n| `HTMLSubstring` | Body contains substring (case-insensitive) |\n| `HTMLRegex` | Body matches regex |\n| `Selector` | CSS selector matches elements |\n| `SelectorAttr` | Element matching selector has attribute containing substring |\n| `AttrExists` | Any element has the given attribute |\n| `ScriptSrcContains` | `\u003cscript src\u003e` contains substring |\n| `LinkHrefContains` | `\u003clink href\u003e` contains substring |\n| `MetaName` | `\u003cmeta name\u003e` content contains substring |\n| `JSGlobal` | JS sandbox found `window.__key` global |\n| `Any(ms...)` | At least one matcher fires |\n| `All(ms...)` | All matchers must fire |\n\n## Running Tests\n\n```bash\n# Unit tests (offline)\ngo test -v -race -short ./...\n\n# Integration tests (requires network)\ngo test -v -run TestIntegration -timeout 120s ./...\n```\n\n## Example CLI\n\n```bash\ngo run examples/cmd/main.go https://nextjs.org\n```\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fba0f3%2Fis-sap-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fba0f3%2Fis-sap-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fba0f3%2Fis-sap-go/lists"}