DEV Community

Cover image for I built a fully automated AI party platform that earns passive income — here's the full code
Adam Hawk
Adam Hawk

Posted on

I built a fully automated AI party platform that earns passive income — here's the full code

A few months ago I started wondering: could I build a content platform that runs completely on its own — generates content, publishes it, and earns money — without me touching it after setup?

The answer turned out to be I think so lol. Here's what I built, the interesting engineering problems I ran into, and the full code so you can run it yourself.


**What it does

Every night at 6pm, a cron job fires a Node.js script that creates a party and content for FlashParty.co:

  1. Asks Claude to invent a party theme (seasonal, holiday-aware, never repeats)
  2. Builds 25 unique scenes with varied shot types, camera styles, and subject counts
  3. Generates all 25 captions in a single AI call
  4. Submits a batch image generation job to PartyLab (powered by xAI's Grok)
  5. Uploads each photo to FlashParty as it completes — free photos are public, NSFW photos are behind a $5 Party Pass
  6. Sets a cover photo and the party goes live

Total runtime: 5–10 minutes. Human effort after initial setup: zero.


**The stack

  • Claude (Anthropic) — theme generation and batch caption writing. I use Haiku because it's fast and cheap. Three API calls per party cost less than half a cent.
  • PartyLab — wraps xAI's Grok image model with a party-specific API. You describe scenes and characters, it generates photos in batch and gives you a polling endpoint.
  • FlashParty — the platform that hosts the parties, handles user signups, and processes Party Pass payments. They have a REST API for creating parties and uploading media.

The interesting problems

I'll be honest — the naive version of this looked terrible. Here's what went wrong and how I fixed each thing.

Problem 1: Every photo looked like it was taken by the same person

The first version picked one camera style for the entire party and baked it into the image generation job. 25 photos all with the same cinematic teal-and-orange look. Real parties have people with DSLRs, people with disposable cameras, people with iPhones taking blurry selfies.

Fix: Instead of one job-level camera style, I assign a random style to each individual scene. There are 8 styles: DSLR candid, 35mm film, editorial night, disposable flash cam, cinematic telephoto, iPhone Portrait mode, Google Pixel night mode, and vintage point-and-shoot. Each image picks one independently.

const CAMERA_STYLES = [
  {
    name: 'Film Photography',
    descriptors: 'shot on 35mm Kodak Portra 400 film, warm golden tones, organic film grain, slight halation, nostalgic analog texture'
  },
  {
    name: 'Flash Party Cam',
    descriptors: 'disposable camera aesthetic, direct on-camera flash, overexposed highlights, red-eye effect, Fujifilm disposable lo-fi'
  },
  // ... 6 more
];

// Each scene gets its own randomly selected style
const cam = pick(CAMERA_STYLES);
scene.prompt = `${scene.prompt}, ${cam.descriptors}`;
Enter fullscreen mode Exit fullscreen mode

Problem 2: All NSFW photos clustered at the top

The scene list was built by appending NSFW scenes after all the SFW scenes. PartyLab processes them in order, so they all completed and uploaded together in a block. Users saw a wall of adult content at the top of the party feed.

Fix: Interleave NSFW scenes at evenly-spaced positions within the SFW list before submitting the job. Since PartyLab generates in scene order, the photos now appear distributed naturally across the party.

// Interleave NSFW scenes at evenly-spaced positions
const scenes = [...sfwScenes];
if (nsfwScenes.length > 0) {
  const step = scenes.length / (nsfwScenes.length + 1);
  nsfwScenes.forEach((scene, idx) => {
    scenes.splice(Math.round(step * (idx + 1)) + idx, 0, scene);
  });
}
Enter fullscreen mode Exit fullscreen mode

Problem 3: NSFW photos weren't actually NSFW

About half the "NSFW" photos were just kissing or a hand on a shoulder. Users paid $5 for a Party Pass, unlocked the content, and felt ripped off.

The root cause: prompts like "two people kissing passionately, intense chemistry, R-rated" don't produce NSFW images — they produce a kiss. I rewrote every prompt to explicitly describe nudity rather than implying it. If you want the model to render bare skin, you have to ask for it directly.

Problem 4: The AI kept generating the same party theme

Three nights in a row: "Spring Fling Soirée." Claude Haiku sees "Today is April, Season: spring" and converges on the obvious answer every time. There's no memory between runs.

Fix: A logs/used-themes.json file stores the last 90 theme names. Before each run, the script reads the last 30 and passes them to Claude as an explicit exclusion list.

const recentThemes = readUsedThemes(30);
const exclusionLine = recentThemes.length > 0
  ? `Do NOT use any of these recently used themes:\n${recentThemes.map(t => `- ${t}`).join('\n')}`
  : '';

// Injected into the Claude prompt
const prompt = `...${exclusionLine}
Generate ONE party theme for tonight...`;
Enter fullscreen mode Exit fullscreen mode

Problem 5: Every image had the same framing

The AI was defaulting to 2–3 people in a medium shot, every single time. Real party galleries mix wide crowd shots, tight close-ups, solo portraits, selfies, and detail shots of cocktails or decorations.

Fix: I added two new pools — SHOT_TYPES (10 framing/angle options) and SUBJECT_COUNTS (6 options from "just one person" to "packed crowd") — and assigned them randomly per image. I also added two new scene types: Selfie (with front-facing iPhone camera descriptors) and Atmosphere (detail shots with no people at all).

Scene types are weighted to match what a real party gallery looks like:

const SFW_TEMPLATES = [
  { name: 'Dance Floor',    weight: 4 },  // ~8 of 23 SFW images
  { name: 'Candid Moments', weight: 3 },  // ~6
  { name: 'At the Bar',     weight: 2 },  // ~4
  { name: 'Arrivals',       weight: 1 },  // ~2
  { name: 'Selfie',         weight: 1 },  // ~2
  { name: 'Atmosphere',     weight: 0.5 } // ~1
];
Enter fullscreen mode Exit fullscreen mode

Problem 6: Captions were 7 phrases on repeat

The original caption function had 4 SFW options and 3 NSFW options. With 25 images per party you're guaranteed to see "Party vibes only" four times.

Fix: A single Claude API call generates all 25 captions at once. The model sees the full ordered scene list and the theme name, and writes unique, contextual captions for each one.

const prompt = `Write exactly ${scenes.length} captions for a "${themeName}" party.
Scenes: ${sceneList}
Rules: under 10 words, no hashtags, vary the tone, never repeat.
Respond with ONLY a JSON array of strings.`;
Enter fullscreen mode Exit fullscreen mode

Cost for 25 captions via Claude Haiku: about $0.001. The static fallback pool still runs if the API call fails.


The monetization

The script sets premium_pass_price: 5 when creating the party. FlashParty handles the paywall — NSFW photos are blurred until a user buys a Party Pass.

At a level 2 theme (5–9 NSFW images), each party has enough premium content to make the pass feel worth it. One sale covers roughly a week of nightly generation costs.


Get the code

Everything is on GitHub: github.com/adamhawk-maker/flashparty-party-generator.git](https://github.com/adamhawk-maker/flashparty-party-generator.git)

Setup takes about 5 minutes:

git clone https://github.com/adamhawk-maker/flashparty-party-generator.git
cd ai-party-generator
npm install
cp .env.example .env
# Add your three API keys to .env
node party-generator.js
Enter fullscreen mode Exit fullscreen mode

You'll need API keys from FlashParty, PartyLab, and Anthropic. The README has the full setup guide and a cost breakdown.


What I'd build next

A few things on the roadmap if you want to extend this:

  • User-submitted themes — let your audience vote on tomorrow night's party theme
  • Multi-party batching — generate a week's worth of parties in one run on Sundays
  • Engagement hooks — email or push notification when a new party goes live
  • Dynamic pricing — higher premium_pass_price on higher NSFW level themes

If you build something with it, I'd love to see it. Drop a link in the comments.

Top comments (0)