Siftwright commited on
Commit
9672b2c
·
verified ·
1 Parent(s): a7bb709

Showcase page for the Pay-Per-Event Actor Starter Kit

Browse files
Files changed (2) hide show
  1. README.md +8 -5
  2. index.html +56 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Actor Starter Kit
3
- emoji: 🔥
4
- colorFrom: green
5
- colorTo: green
6
  sdk: static
7
  pinned: false
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Pay-Per-Event Apify Actor Starter Kit
3
+ emoji: 🧰
4
+ colorFrom: indigo
5
+ colorTo: yellow
6
  sdk: static
7
  pinned: false
8
+ license: mit
9
+ short_description: "Template for a paid Apify Actor: charge only on success"
10
+ tags: [apify, actor, pay-per-event, template, nodejs, monetization]
11
  ---
12
 
13
+ Showcase for Siftwright's Pay-Per-Event Actor Starter Kit ($9 one-time, MIT): a working Node.js Apify Actor template that charges users only for successful results. Buy: https://buy.polar.sh/polar_cl_XmolAL821NucKjcWuwyYzutqK9a61YqXO9H6s0vySxc · More: https://siftwright.com/
index.html CHANGED
@@ -1,19 +1,56 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
2
+ <title>Pay-Per-Event Apify Actor Starter Kit · Siftwright</title><meta name="description" content="A small, working Node.js template for a paid Apify Actor that charges users only for successful results. Schemas, charge-on-success loop, tests, publish checklist. $9 one-time, MIT."><style>:root{--bg:#F2F3F8;--card:#fff;--ink:#161934;--muted:#595E7E;--line:#DDE0EA;--navy:#2A2F6B;--gold:#F2C14E}
3
+ @media (prefers-color-scheme:dark){:root{--bg:#0D0F1F;--card:#15182D;--ink:#E9EAF5;--muted:#A3A8C6;--line:#272B4A;--navy:#AEB5FF}}
4
+ *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:17px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
5
+ main{max-width:920px;margin:0 auto;padding:32px 16px 56px}
6
+ .hero{background:radial-gradient(120% 140% at 100% 0%,#2A2F6B 0%,#1D2150 60%);color:#F4F4FB;border-radius:18px;padding:28px 24px}
7
+ .hero h1{font-size:clamp(26px,5vw,38px);line-height:1.12;margin:0 0 10px;letter-spacing:-.02em}.hero p{margin:0 0 18px;color:#B9BDE0;max-width:60ch}
8
+ .price{display:inline-block;background:rgba(255,255,255,.1);border-radius:999px;padding:4px 12px;font-size:15px;margin-bottom:16px}
9
+ .cta{display:inline-block;margin-right:10px;background:var(--gold);color:#1D2150;font-weight:700;text-decoration:none;padding:12px 20px;border-radius:999px}
10
+ .cta2{display:inline-block;color:#F4F4FB;border:1.5px solid rgba(255,255,255,.4);font-weight:600;text-decoration:none;padding:11px 18px;border-radius:999px;margin-top:8px}.by{display:block;margin-top:14px;font-size:14px;color:#B9BDE0}
11
+ h2{font-size:22px;margin:36px 0 12px}ul.f{padding-left:20px;margin:0}ul.f li{margin:6px 0}
12
+ figure{margin:0 0 18px;background:var(--card);border:1px solid var(--line);border-radius:14px;overflow:hidden}
13
+ figure img{display:block;width:100%;height:auto}figcaption{padding:10px 14px;font-size:15px;color:var(--muted)}
14
+ table{width:100%;border-collapse:collapse;background:var(--card);border:1px solid var(--line);border-radius:14px;overflow:hidden;font-size:15px}
15
+ td,th{padding:10px 12px;border-bottom:1px solid var(--line);text-align:left}tr:last-child td{border-bottom:0}
16
+ a{color:var(--navy)}footer{margin-top:40px;font-size:14px;color:var(--muted)}@media (max-width:640px){table{display:block;overflow-x:auto;max-width:100%}}</style></head><body><main>
17
+ <section class="hero"><h1>Pay-Per-Event Apify Actor Starter Kit</h1><p>A small, working Node.js template for a paid Apify Actor that charges users only for results they actually got. Copy it, swap in your own logic, set one event price, publish.</p><span class="price">$9 one-time · MIT licence · instant download (zip, about 9 KB)</span><br>
18
+ <a class="cta" href="https://buy.polar.sh/polar_cl_XmolAL821NucKjcWuwyYzutqK9a61YqXO9H6s0vySxc" target="_blank" rel="noopener">Buy for $9 →</a><a class="cta2" href="https://apify.com/siftwright" target="_blank" rel="noopener">See Actors built on this pattern</a><span class="by">By Siftwright · checkout by Polar · the same charging pattern runs in our 9 live Apify Store Actors</span></section>
19
+ <h2>What it is</h2><p>The example Actor takes a list of URLs and returns each page's title and meta description. Every page that loads is one charged <code>result</code> event. Invalid URLs, timeouts and HTTP errors are still written to the dataset so the user can see what went wrong, but they are <b>not charged</b>. Replace the fetch and the parser with your own work and keep the rule: charge after success, never before.</p>
20
+ <h2>What's inside</h2><pre style="background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px;overflow-x:auto;font-size:14px"><code>.actor/
21
+ actor.json metadata; links input, dataset and output schemas
22
+ input_schema.json Console input form (urls, maxResults, timeoutSecs)
23
+ dataset_schema.json table view for the results
24
+ output_schema.json Output tab; Apify requires it before you can publish
25
+ src/
26
+ main.js run loop with charge-on-success logic
27
+ extract.js pure parsing helpers (swap in your own)
28
+ test/
29
+ extract.test.js unit tests (node --test)
30
+ Dockerfile apify/actor-node:22 base image
31
+ package.json apify ^3.7.2, Node 20+
32
+ LICENSE MIT
33
+ README.md setup, pricing steps and a publish checklist</code></pre>
34
+ <h2>The charging pattern</h2><p><code>Actor.pushData(item, eventName)</code> stores the row and charges the event in one call, so a row is never charged without being saved. <code>maxResults</code> caps charged rows, and the loop stops when the user's own max-cost-per-run is reached.</p>
35
+ <pre style="background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px;overflow-x:auto;font-size:14px"><code>const CHARGE_EVENT = 'result';
36
+
37
+ // success: save the row AND charge one event
38
+ const r = await Actor.pushData(item, CHARGE_EVENT);
39
+ if (r?.eventChargeLimitReached) break; // user's max cost per run reached
40
+
41
+ // failure: save the row, no charge
42
+ await Actor.pushData({ ...base, status: 'failed', error });</code></pre>
43
+ <h2>Real output</h2><p>A local run of the unmodified template (Node 22, apify 3.7.2) on 16 November 2026 with 4 inputs. The 2 pages that loaded are the rows that would be charged on the Apify platform; the 404 and the invalid URL are saved but free. Nothing is billed in a local run. The 3 bundled unit tests pass.</p>
44
+ <pre style="background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px;overflow-x:auto;font-size:14px"><code>$ node src/main.js
45
+ INFO Done. 2 successful (charged) result(s) out of 4 URL(s).</code></pre>
46
+ <table><tr><th>url</th><th>status</th><th>httpStatus</th><th>title</th><th>error</th></tr>
47
+ <tr><td>https://example.com</td><td>ok</td><td>200</td><td>Example Domain</td><td>–</td></tr>
48
+ <tr><td>https://www.iana.org/help/example-domains</td><td>ok</td><td>200</td><td>Example Domains</td><td>–</td></tr>
49
+ <tr><td>https://example.com/this-page-does-not-exist-404</td><td>failed</td><td>404</td><td>–</td><td>HTTP 404</td></tr>
50
+ <tr><td>not-a-url</td><td>failed</td><td>–</td><td>–</td><td>Invalid URL</td></tr></table>
51
+ <h2>From zip to Store listing</h2><ol class="f"><li>Unzip, <code>npm install</code>, <code>npm test</code>, then <code>apify run -i '{"urls":["https://example.com"]}'</code> (needs the free <code>apify-cli</code>).</li><li><code>apify push</code> to build it on Apify.</li><li>Console → your Actor → Publication → Monetization → <b>Pay per event</b>: add an event named exactly <code>result</code> and set its price.</li><li>Rename it, rewrite the README for your users, run the included checklist, publish.</li></ol>
52
+ <h2>Good to know</h2><table><tr><th>Price</th><td>$9 one-time, paid through Polar; no subscription</td></tr><tr><th>Licence</th><td>MIT: personal or commercial Actors, attribution appreciated but not required</td></tr><tr><th>Needs</th><td>Node 20+, a free Apify account; the kit ships as JavaScript (no TypeScript, no browser crawler)</td></tr><tr><th>Not included</th><td>Support for your own scraping logic, proxies or Store marketing; it is a template, not a service</td></tr></table>
53
+ <p>Why pay-per-result pricing: <a href="https://siftwright.com/blog/pay-per-result-vs-subscription-api-pricing/" target="_blank" rel="noopener">pay-per-result vs subscription API pricing</a> on the Siftwright blog.</p>
54
+ <p><a class="cta" style="margin-top:12px" href="https://buy.polar.sh/polar_cl_XmolAL821NucKjcWuwyYzutqK9a61YqXO9H6s0vySxc" target="_blank" rel="noopener">Buy the starter kit for $9 →</a></p>
55
+ <footer>Made by Siftwright · <a href="https://siftwright.com/" target="_blank" rel="noopener">siftwright.com</a> · support@siftwright.com</footer>
56
+ </main></body></html>