How one week of SEO actually flows
Nothing runs in one long request. Every run is a queue message, one step at a time, so it never times out and every step is logged.
Built entirely on Cloudflare, under WeExalate
Same stack you already trust for WeExalate: Next.js + Cloudflare. One app, two audiences — agency admin and client portal — separated by role, not by codebase.
Frontend — Pages
Next.js on Cloudflare Pages at seo.weexalate.com. Admin + client portal in one app. Server components for dashboards, client components only where interaction is needed.
API — Workers + Hono
Two Workers: one for the dashboard API, one for webhooks (WordPress, Razorpay, Cron). Every API handler checks client_id against the logged-in user's org — on every query, no exceptions.
Jobs — Queues + Cron
Cloudflare Queues carry every agent step. Cron Triggers start the weekly runs (Mon 9 AM IST audit, Wed content, Fri report). A queue consumer does one step, logs it, enqueues the next.
Locking — Durable Objects
One Durable Object per client site = one run at a time per client. Two runs never edit the same post at once. This is your concurrency lock, not a database flag you hope works.
Data — D1 (SQLite)
All relational data: clients, sites, voice cards, runs, logs, approvals, subscriptions, invoices, cost ledger. R2 holds monthly PDF reports, exports and before/after screenshots.
Auth — Clerk
Clerk Organisations = one org per client. Roles: Agency Admin (you), Agency Editor, Client Owner, Client Viewer. You already use Clerk for WeExalate — reuse the pattern.
| D1 table | What it holds | Why it matters |
|---|---|---|
| clients / sites | Business, plan, WP URL, encrypted app password, GSC + GA4 property IDs | Multi-tenancy root. Every other row carries client_id. |
| voice_cards | Tone, audience, banned words, services, cities, examples — versioned | Change the card, every future run changes. Old runs keep the version they used. |
| runs / run_steps | Run type, agent, model, tokens, cost ₹, input hash, output, status | Your cost ledger and your audit trail in one place. |
| approvals | Draft change, before/after, who approved, when, edits made | Proof the human-in-the-loop rule actually happened. |
| subscriptions / invoices | Razorpay subscription ID, status, next charge, GST invoice link | Billing state mirrors Razorpay webhooks — never hand-edited. |
| gsc_snapshots | Weekly clicks, impressions, CTR, avg position per page/query | Your before/after proof. Baseline saved at onboarding, forever. |
Secrets rule: Cline + Anthropic keys live only in Workers Secrets. WP app passwords are encrypted in D1 with AES-GCM, key in Workers Secrets, never displayed after save, never written to logs. Hosting cost is not your problem — Workers Paid is $5/mo including 10M requests and 30M CPU ms. AI tokens are your variable cost, so you cap them per client (see §03).
Your keys, centrally. Haiku does the volume, Sonnet does the thinking.
Never give a client your key and never let a client bring theirs. Agency keys, tracked per client, capped per plan. If a run hits the cap it pauses and pings you — it does not keep spending.
| Job | Model | Why | Cost shape |
|---|---|---|---|
| Bulk meta — titles, descriptions, slugs, alt text, FAQ | Claude Haiku | Fast, cheap, excellent at strict JSON. ~1,500 tokens in, ~300 out per page. | Under ₹0.10 / page |
| Strategy — keyword map, content calendar, briefs, outlines | Claude Sonnet | The thinking work. Used sparingly — briefs and outlines only, not every page. | ~20% of AI spend |
| Fallback — meta-only, if Anthropic is down | Cline → DeepSeek V3.2 via api.cline.bot | OpenAI-compatible, same prompts. Top up first Balance was −$0.07 with 402 errors; the free Flint model timed out twice on full SEO JSON — do not build the client product on it. | Pay-per-use |
Hard caps in D1
Starter ₹1,000/mo · Growth ₹1,800/mo · Scale ₹3,000/mo of AI cost — each set above that plan's expected spend (Starter ~₹600–900), so the cap catches runaway runs, not normal work. Cap hit = run pauses + you get pinged. No silent overspend, ever.
Fallback order
Haiku → (retry once) → Cline DeepSeek → mark failed + alert you. Never retry a WordPress write without first checking whether the first write landed.
Kill switch
Per-client, one click in admin. Stops all queued + future runs for that client instantly. You need this the day a client says “stop everything.”
Five agents, not one black box
Split the work so you can see, fix and show each step. If rankings drop, you need to know whether the audit, the strategy or the writing was wrong — a single “SEO agent” can never tell you that.
Auditor
Pulls all posts/pages via WP REST API. Checks Rank Math scores, missing/duplicate titles & descriptions, broken internal links, missing alt text, orphan pages, slow templates.
- Output: a checklist, not prose
- Runs: weekly, Mon 9 AM IST
- Model: none / Haiku for grouping
Strategist
Takes GSC queries + the client's services + competitors. Builds the keyword map — one focus keyword per page, no cannibalisation — and the 4-week content calendar.
- Output: keyword map + calendar
- Runs: monthly + on onboarding
- Model: Sonnet
Meta Agent
Generates title (<60 chars), description (120–155), slug, FAQ + schema, internal-link suggestions. Strict JSON, schema-validated, retried once on failure — same logic as your existing seo_connector.py.
- Output: validated JSON → WP draft meta
- Runs: per batch of 10 pages
- Model: Haiku
Content Agent
Writes outlines and first drafts in the client's voice, using only facts the client gave you. Never invents prices, testimonials, certifications or case studies.
- Output: outline → draft in WP
- Runs: per calendar slot
- Model: Sonnet (outline) + Haiku (fill)
Reporter
Pulls GSC + GA4 weekly. Writes the client report in plain language: what we fixed, what moved, what we're doing next. Generates the monthly PDF into R2.
- Output: dashboard update + PDF
- Runs: weekly, Fri
- Model: Haiku
Every step writes a log row
Client · site · post · agent · model · tokens · cost · input · output · status · who approved it. That log is your client trust — it's what you show when a client asks “what did you actually do this month?”
Keep logs 12 months. Export on cancellation.
| Time | Agent | Action | Before → After | Cost | Status |
|---|---|---|---|---|---|
| Mon 09:04 | Auditor | Scanned 48 pages | 11 missing descriptions found | ₹0.00 | Done |
| Mon 09:11 | Meta | Fixed /services page title | “Home” → “Silent Genset Service in Vapi | …” | ₹0.08 | Awaiting you |
| Mon 10:02 | — You — | Approved 9 of 10 drafts | 1 rejected: wrong city name | — | Approved |
| Fri 17:00 | Reporter | Weekly GSC pull | Impressions +18% vs prior 28d | ₹0.21 | Sent |
The Brand Voice Card is the whole trick
This is where most AI SEO fails — generic copy in nobody's voice. Fix it once per client, at onboarding, and lock it. Only you can edit it. Every agent call uses the same structure, so one system can hold ten different voices.
Brand Voice Card — per client, versioned
- Business: what they sell, services list, cities served
- Audience: who they sell to — and who they don't
- Tone: direct, plain, no hype — your house style as the default
- Banned: words never to use, competitors never to mention, prices never to invent
- Proof: only real facts — years, brands carried, areas covered — as supplied by the client
- Examples: 3–5 good past copy samples, 2–3 bad ones to avoid
- Real questions: the questions their customers actually ask, in their words
SYSTEM = Brand Voice Card (versioned) + Global SEO Rules
TASK = One job only: e.g. "Fix meta for this page"
DATA = Page text + GSC queries for this page + keyword map
RULES FOR EVERY CALL:
- Return strict JSON only. No markdown, no extra text.
- Title < 60 chars, focus keyword near the start.
- Description 120–155 chars, keyword + one clear CTA.
- Never invent a price, testimonial, rating or claim
that is not in the Voice Card or the page itself.
- Use only internal links from the list provided.
- If the facts are missing, return {"needs_info": "..."}
instead of guessing.Content flow per client, per week: WP fetch → Auditor finds 10 gaps → Strategist prioritises → Meta/Content drafts → Draft in WP + dashboard → You approve / edit / reject → Publish → Reporter verifies indexing in 7 days.
One app, two very different screens
You work in the full screen. The client sees a read-only version of their own screen only — no other clients, no keys, no costs, no bulk-run button.
| Client | Plan | Approvals pending | AI spend / cap | GSC clicks 28d | Health |
|---|---|---|---|---|---|
| Your pilot client WordPress · Rank Math | Growth | 9 | ₹412 / ₹1,800 | — baseline first | Setup |
| Columns to build: Plan · MRR · Next billing date · Runs this week · Approvals pending · AI spend · GSC clicks vs previous 28d · Health (green / amber / red). Plus a top strip: total MRR, churn risk (no login in 14 days + no movement = call them), failed payments. | Spec | ||||
Onboarding: no main passwords, ever
Same rule as your Client Access Tracker. Everything is delegated, scoped and revocable in one click.
- Create the scoped user. Client creates an Editor user weexalate-seo in wp-admin — or gives you temporary admin access so you create it, then hand admin back.
- Create the Application Password. That user generates an App Password named “WeExalate SEO”. You paste site URL + username + app password into the admin onboarding form. It's encrypted, never shown again.
- Confirm Rank Math Free is installed and its setup wizard is done. Connect Search Console + Analytics modules inside Rank Math.
- Connect Google data by sharing, not passwords. Client adds your agency Google account as a user on Search Console + GA4. Never ask for their Gmail login.
- Fill the Voice Card together on a 30-minute call. Services, cities, audience, banned words, real proof, good/bad copy examples.
- Run the baseline audit and save the before numbers. GSC 28-day clicks, impressions, CTR, position, indexed pages. Without a baseline you can never prove results later.
- Disconnect is the reverse: client revokes the app password, removes GSC/GA4 access, you export their logs + reports, delete their data on request. Done in minutes, no hostage data.
Razorpay Subscriptions — don't build recurring billing yourself
Create one Razorpay Plan per tier, one Subscription per client. UPI AutoPay and cards are what your clients will actually use. Checkout is Razorpay's hosted page, invoices are Razorpay's GST invoices shown inside the portal — you generate neither yourself.
| Webhook → Worker | D1 action |
|---|---|
| subscription.activated | Status = active. Agents start running. |
| payment.captured | Invoice linked in portal. Next charge date set. |
| payment.failed | Email client + Razorpay retries 3 days. Pause runs after 7 days unpaid. |
| subscription.cancelled | Finish the paid month, then stop runs. Offer log/report export. |
Price the fees in, don't absorb them
Razorpay standard domestic fee is 2% + GST, and Subscriptions adds 0.99% per transaction. On a ₹10,000 charge, expect roughly ₹299 + GST in fees.
Setup fee: ₹5,000 one-time, waived on quarterly prepay. Minimum term: 3 months — SEO needs it, and say so in the contract before they sign, not after.
Price for entry + proof, then raise
Indian agencies charge ₹15,000–₹30,000/mo for basic SEO and ₹25,000–₹60,000 for local SEO — but Vapi–Valsad SMEs won't start there with a new product. Start where trust starts, scope honestly, and let Growth carry the business.
One-Time Audit
Baseline audit, keyword map, top-10 fixes list. Credited against month 1 if they sign up. This is how an unknown product gets a first yes.
Starter
10 pages fixed/mo · 2 blogs/mo · GSC report · Google Business Profile check. AI cost ~₹600–900, hosting ~₹100, your review ~2 hrs. Honest scope, good margin.
Growth
20 pages · 4 blogs · local pages · internal linking · monthly strategy call. 7 Growth clients = ₹1,04,993/mo — that's the ₹1L milestone, not 30 tiny clients.
Scale — ₹24,999 /mo + GST
40 pages · 8 blogs · 2 locations · outreach / digital PR help · weekly reporting. For multi-location and manufacturer clients only.
Run your own maths
The honest timeline — put it in the proposal, in writing
If you don't set this expectation before they sign, you'll get churn at day 45 no matter how good the work is. Never promise “#1 on Google” or “results in 30 days.” Promise output + process, and prove it with the log.
Fix the foundations
Technical fixes, duplicate titles, missing descriptions, sitemap, indexing.
Expect: Rank Math scores up, impressions up, clicks flat. That's normal — say so in advance.
Content starts compounding
Content + internal links publish, local pages go live.
Expect: impressions up 30–80%, keywords moving page 3 → page 2, CTR improving from better titles.
Rankings & enquiries
Compounding, if publishing stays consistent and the site earns clicks.
Expect: 5–10 keywords on page 1 for local / low-competition terms, enquiries starting to track.
Measure leading indicators weekly (impressions, CTR, avg position, indexed pages) and lagging ones monthly (enquiries via form / call tracking). The weekly promise is concrete: X pages fixed, Y posts published, Z report every Monday — and the agent log to prove every line of it.
8 weeks. Don't build it all first.
The biggest risk isn't technical — it's building the full platform before a single client has paid. Pilot first, platform second.
Admin dashboard, connect WP, Meta Agent only, approvals queue, agent log. No client login, no Razorpay yet. Charge the launch price and learn where the prompts break.
Clerk orgs per client, Voice Cards, Strategist + Content Agent, client read-only login. The client_id check on every query gets tested here, hard.
Razorpay Plans + webhooks, GSC/GA4 reporting, monthly PDF reports in R2. Failed-payment flow (email → 3-day retry → pause at 7 days) goes live.
Onboarding flow, sales page, 2 more pilot clients onboarded with baselines saved. Then raise the price for everyone after the pilots.
Your weekly admin rhythm
- Monday (30 min): clear the approvals queue, check failed runs + AI spend vs caps
- Wednesday: strategy check for Growth + Scale clients — is the calendar still right?
- Friday: send client reports, chase failed Razorpay payments, flag churn risk (no login 14 days + no movement)
Serving clients — the offer in one line
“We run your SEO every week — fixes, content in your voice, local pages — you approve everything in one screen, and every Monday you see exactly what was done and what moved.”
Sell the audit first (₹4,999), credit it on signup, minimum 3 months, report every week whether the news is good or flat. Flat weeks reported honestly are why clients stay in month 4.
The boring bits that save you
Agent ops rules
- Daily + monthly cost cap per client — pause and ping, never overspend silently
- Model fallback: Haiku → Cline DeepSeek → fail + alert. Retry once, then stop
- Never retry a WP write blind — check if the first one landed (Rank Math's updateMeta needs a post re-save to clear cache)
- Kill switch per client; logs kept 12 months; data deleted on cancellation
- Long runs always via Queues — Workers CPU limits will kill a long in-request agent run
Risks to plan for now
- Cline credits: at −$0.07 today. Top up and pass a full SEO run on DeepSeek V3.2 before any client depends on it
- Stored WP passwords: encrypted, access-logged, revocable — treat this as your highest-sensitivity data
- Bad facts in, bad facts out — faster: if a client gives wrong facts, the agent publishes them at speed. Human review is not optional
- Thin-content trap: never bulk-generate and auto-publish articles. AI assists, human publishes — that's the Google-safe line
Your first move this week
- Top up Cline, run one full SEO JSON test on DeepSeek V3.2, confirm it returns clean validated JSON inside 60 seconds.
- Pick the pilot: weexalate.com first, then one friendly client on the launch price with a saved GSC baseline.
- Build only Weeks 1–2 scope: connect WP → Meta Agent → approvals → log. Nothing else until a pilot approves real drafts in it.