{"id":51322742,"url":"https://github.com/skcript/fos-g2-create-mock","last_synced_at":"2026-07-01T15:02:33.749Z","repository":{"id":368040311,"uuid":"1260298088","full_name":"skcript/fos-g2-create-mock","owner":"skcript","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-06T09:42:54.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-28T21:04:22.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/skcript.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":null,"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-06-05T10:50:28.000Z","updated_at":"2026-06-06T12:05:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/skcript/fos-g2-create-mock","commit_stats":null,"previous_names":["skcript/fos-g2-create-mock"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/skcript/fos-g2-create-mock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skcript%2Ffos-g2-create-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skcript%2Ffos-g2-create-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skcript%2Ffos-g2-create-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skcript%2Ffos-g2-create-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skcript","download_url":"https://codeload.github.com/skcript/fos-g2-create-mock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skcript%2Ffos-g2-create-mock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35011257,"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-07-01T02:00:05.325Z","response_time":130,"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-07-01T15:02:32.985Z","updated_at":"2026-07-01T15:02:33.729Z","avatar_url":"https://github.com/skcript.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# G2 → FeatureOS\n\nA small Next.js (Pages Router) demo that shows how to turn **G2 review feedback\ninto FeatureOS posts**. It renders a list of mock G2 reviews — each one a feature\nask from a customer — and lets you push any of them into FeatureOS as a feature\nrequest with a single click.\n\nThe point of the project is to demonstrate the **integration pattern**, not the\nG2 scraping: a browser UI that collects credentials, a server-side proxy that\nholds the real call to FeatureOS, and a live cURL panel that documents exactly\nwhat request went out.\n\n## Run\n\n```bash\nnpm install\nnpm run dev\n# open http://localhost:3000\n```\n\nIn the UI:\n\n1. Paste your **FeatureOS API key** and a **bucket id** (board id).\n2. Optionally generate an **SSO → JWT** token (SSO key + email).\n3. Click **Create in FeatureOS** on any G2 review.\n\nAll inputs are saved to `localStorage` so they preload on refresh.\n\n## Where the FeatureOS API call happens\n\nThe browser **never** calls FeatureOS directly. Every call goes through a local\nNext.js **edge** API route that acts as a proxy. This keeps secrets off the\nclient/CORS path and lets the server shape the request.\n\n### 1. Create a post — `pages/api/featureos/create-post.js`\n\nThis is where the actual FeatureOS write happens.\n\n- **Endpoint called:** `POST https://api.featureos.app/api/v3/feature_requests`\n- **Runtime:** edge (`export const config = { runtime: \"edge\" }`)\n- **Flow:** `pages/index.js` → `fetch(\"/api/featureos/create-post\")` → this route\n  → `fetch(FEATUREOS_URL)` → response relayed back to the browser.\n- **Auth headers sent upstream:**\n  - `API-KEY: \u003cyour key\u003e` — always sent.\n  - `Authorization: Bearer \u003cjwt\u003e` — added only when a JWT was generated.\n- **Body:** `{ title, bucket_id, description, ... }` — only defined fields are\n  forwarded.\n- **Docs output:** the route builds the full equivalent cURL (real headers +\n  pretty-printed JSON body) and returns it as `curl`. The UI renders it under\n  each post so you can see exactly what was sent.\n\nRequest reference:\nhttps://developers.featureos.app/docs/posts/create-post\n\n### 2. Generate an SSO JWT — `pages/api/featureos/generate-jwt.js`\n\nOptional. Signs a FeatureOS SSO token server-side so the SSO secret never\nreaches the browser.\n\n- **Runtime:** edge — uses Web Crypto (`crypto.subtle`), not Node `crypto`.\n- **Algorithm:** `HS256`, mirroring\n  `jwt.sign({ email, name }, SSO_KEY, { algorithm: \"HS256\" })`.\n- **Input:** `{ ssoKey, email, name }` → **Output:** `{ token, payload }`.\n\nSSO reference:\nhttps://help.featureos.app/en/articles/setting-up-single-sign-on-for-your-featureos-portal/\n\n## Project layout\n\n| Path | Purpose |\n|------|---------|\n| `pages/index.js` | Home page — credential inputs, G2 review list, create buttons, cURL/JWT panels |\n| `pages/api/featureos/create-post.js` | Edge proxy → FeatureOS create-post (**the API call**) |\n| `pages/api/featureos/generate-jwt.js` | Edge route → HS256 SSO JWT signer |\n| `data/g2Posts.js` | Mock G2 reviews (swap for a real G2 reviews fetch) |\n| `styles/globals.css` | Styling |\n\n## Notes\n\n- API key / SSO key inputs are `password`-typed and sent only to the local proxy.\n- The cURL shown in the UI is the **full** command (real values) — convenient as\n  copy-paste docs, but it does print secrets on screen.\n- Credentials persist in `localStorage`. Handy for a demo; secrets in\n  `localStorage` are exposed to any XSS, so don't use real production keys here.\n  Use **Clear saved values** to wipe them.\n- G2 data is mock; replace `data/g2Posts.js` with a real G2 reviews source.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskcript%2Ffos-g2-create-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskcript%2Ffos-g2-create-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskcript%2Ffos-g2-create-mock/lists"}