Introducing the Automated Affiliate Marketing Dashboard & Local LLM Writing Assistant
2026-06-03 | 3 min read
Introducing the Automated Affiliate Marketing Dashboard & Local LLM Writing Assistant
Building a highly automated, 100% affiliate marketing platform requires more than scheduling static scripts. Until now, takescake relied on automated GitHub Actions runs and external Azure OpenAI deployments to compile daily affiliate blog posts. If secrets expired, or if GitHub ran out of workflow runner minutes, the pipeline failed.
To solve this, we are introducing the Affiliate Control Centerβa visual, secure dashboard located at /admin that integrates with a local LLM generation assistant and background scheduler, giving you complete control over your content production engine.
What is the Affiliate Control Center?
The new control center is a responsive, glassmorphic admin dashboard built to centralize queue management and on-demand content writing. It brings several key capabilities:
- On-Demand AI Generator: Paste any Amazon product link, optional override title, choose your LLM writing engine, and click write. The system fetches the HTML, downloads the product media, generates a structured SEO post, and writes the markdown directly to the server in seconds.
- Local Ollama Fallback: If you do not have Azure OpenAI credentials configured, or want to write reviews completely for free, the generator hooks into the server's local Ollama instance (using the lightweight
gemma3:4bmodel by default) to compile the content. - Queue Catalog Visualizer: Lists every link saved in
content/affiliates/products.txtand dynamically tags whether that product has a live blog post on the site, or is pending generation. - Interactive Batch Run: Instead of running timeouts or cron tasks in the dark, trigger a batch run directly from the browser. The dashboard walks through pending queue items one-by-one, showing you completion results in real time.
- Config Diagnostics: Instantly see your active Amazon Associate Tag, TCGplayer Partner Code, and AI service health states.
Technical Architecture
Under the hood, we refactored the affiliate pipeline into a unified shared library. Here is the module workflow:
graph TD
A[Admin UI / CLI Trigger] --> B[lib/affiliate-generator.ts]
B --> C[Fetch Amazon HTML]
C --> D[Extract Meta & Landing Image]
D --> E{AI Backend Configured?}
E -- Azure OpenAI --> F[Generate review using Azure]
E -- Ollama local --> G[Generate review using Gemma]
E -- None --> H[Generate review using Static Scaffold]
F --> I[Download image to /public/products]
G --> I
H --> I
I --> J[Save post to content/posts]
J --> K{AUTO_COMMIT_POSTS = 1?}
K -- Yes --> L[git add & commit & push]
K -- No --> M[Finished]
1. Refactored Shared Library
The core extraction, image downloading, and generation routines now live in lib/affiliate-generator.ts. Both the CLI script (npm run generate:affiliate) and the Next.js API routes (/api/admin/products and /api/admin/generate) consume this same file, ensuring exact parity.
2. Zero-Cost Writing with Ollama
If EMBEDDINGS_PROVIDER is set to ollama and an Ollama host is active, the generator sends the extracted Amazon product context to /api/chat. It prompts Gemma to output a high-conversion review including:
- What it is and why it matters
- Detailed features & benefits
- Pros & cons
- Mulligan priorities & upgrades (if forced as an MTG Deck review)
- Call-to-action with custom affiliate tagging
3. Server Git Auto-Commits
When running the automated scheduler on a persistent VPS, you can set AUTO_COMMIT_POSTS=1 in your environment. When a post is generated locally, the CLI runner automatically runs Git commands to add the new article and its download image, commits the changes, and pushes to your remote branch, triggering static-build redeployments automatically.
Setup & Administration
Unlocking the Dashboard
To prevent crawlers or anonymous users from modifying files on your server, the /admin page is protected by a lightweight token check.
- Add an admin secret to your
.envfile:ADMIN_SECRET="your-super-secure-token" - When visiting
/admin, you will be prompted for this token. - Once unlocked, the token is saved securely in your browser's local storage for future visits.
Running CLI Scripts Locally
If you want to run the queue processor from your server terminal:
# Process all products in content/affiliates/products.txt that don't have posts
npm run generate:affiliate
# Force generation even if posts exist
npm run generate:affiliate -- --force
# Verbose logging of steps
npm run generate:affiliate -- --verbose
Activating the Scheduler
To enable the daily post writer inside the Next.js production server, boot takescake using:
# Enable in-process daily automation
npm run start:auto
Set AUTO_POSTS=1 in your environment to ensure post generation is triggered automatically. The scheduler is configured to run at 10:15 UTC daily, reading new links added via the dashboard and writing reviews to the site automatically.