Back to DevLog

Building a TikTok Creator Tool and Fixing All the Broken Things

3 min read

Had one of those marathon coding sessions where you start fixing "one small thing" and end up rebuilding half your workflow. Today's adventure: getting EpsteinScan's automation back online and building a proper TikTok content creation tool.

The Great Email Alert Disaster

Started the day with broken DOJ monitor alerts. Classic SendGrid 403 error because I'd been using an unverified FROM address. Sometimes the simplest fixes are the most annoying to track down. Switched to a verified domain and boom—alerts flowing again.

But wait, there's more! Discovered the Anthropic API key in the crontab was also expired. Nothing like a cascade failure to keep you on your toes.

Auto-Content Generation Revival

With fresh API keys in place, I tackled the broken blog and social post generation. The social generator was choking on a sqlite3.Row.get() bug—one of those sneaky little runtime errors that only shows up in production.

While I was in there, I added some anti-AI writing rules to the prompts. I'm talking a comprehensive ban list: no em dashes, no "delving" into topics, no "landscape" metaphors. The AI now has to write like a human or get rejected. Contractions are mandatory, corporate buzzwords are banned.

The TikTok Creator Tool

Here's where things got fun. I built a full canvas-based TikTok content editor from scratch:

  • 1080x1920 live preview with HTML5 Canvas
  • Three independent text layers you can drag around
  • Background image selection plus custom uploads
  • Dark overlays, watermarks, the works
  • Exports to both PNG and MP4 (thanks, ffmpeg)

The tool handles everything from composition to export, with copyable sections for titles, descriptions, and hashtags. No more wrestling with external design tools.

Three's Company

Changed the AI to generate three TikTok variants per blog post: Hook (provocative question), Fact (key statistic), and CTA (drive traffic back to the site). More content, more angles, better engagement potential.

Each post uses a four-section format: overlay, title, description, and hashtags. Clean separation means easy copying to different platforms.

Security Paranoia Pays Off

A TikTok user raised concerns about the archived PDFs, so I ran a security audit on all 146,988 files. Scanned for JavaScript, trackers, suspicious URLs, malformed headers—the works.

Results: squeaky clean. No trackers, no embedded scripts, no fake files. Sometimes paranoia leads to peace of mind.

The Canvas Approach

Building the TikTok creator with vanilla HTML5 Canvas was the right call. No external dependencies, full control over rendering, and it handles text positioning beautifully. The drag-to-reposition feature uses simple mouse event handling—sometimes the old ways are the best ways.

The ffmpeg integration on the server side converts static designs to 5-second MP4s. Perfect for platforms that prefer video content over static images.

What's Next

Tomorrow's the real test—monitoring the cron jobs to make sure the entire blog-to-social pipeline works end-to-end with the new API keys and updated code.

Might add text stroke options to the TikTok creator for better readability. But for now, it's a solid v1 that does exactly what it needs to do.

Sometimes the best coding sessions are the ones where you fix everything that's been bugging you and build something genuinely useful along the way.

Share this post