惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LINUX DO - 最新话题
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Security Archives - TechRepublic
Security Archives - TechRepublic
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
TaoSecurity Blog
TaoSecurity Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Attack and Defense Labs
Attack and Defense Labs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
小众软件
小众软件
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
F
Fortinet All Blogs
T
Threatpost
Security Latest
Security Latest
V
Vulnerabilities – Threatpost
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
WordPress大学
WordPress大学
Forbes - Security
Forbes - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
CERT Recently Published Vulnerability Notes
AI
AI
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Schneier on Security
I
Intezer
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
V2EX
aimingoo的专栏
aimingoo的专栏
量子位
NISL@THU
NISL@THU
N
News and Events Feed by Topic
O
OpenAI News
Microsoft Azure Blog
Microsoft Azure Blog
C
Check Point Blog
Schneier on Security
Schneier on Security
S
Secure Thoughts
The Cloudflare Blog
J
Java Code Geeks

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How I Built an AI Emoji Generator with Next.js 15 & Cloudflare Workers AI
xiangbin zhu · 2026-05-09 · via DEV Community

Every emoji tool I could find did the same thing: let you pick from a fixed set of combos.

Emoji Kitchen has 50K+ monthly visitors exactly because people love emoji combinations. But it's just a lookup table — Google pre-rendered ~40,000 combinations and serves them as static images. There's no AI, no creativity, no support for combinations that don't exist in the dataset.

I wanted to build something different: type two emoji, get a brand-new AI-generated image that's never existed before, with a transparent background so you can actually use it anywhere.

Here's how Forgemoji works under the hood.

A quick note on scope: I'm a UI/UX designer by trade, so I handled the full product — interface design, interaction design, and the engineering. The stack choices below reflect someone who thinks in user flows first and infrastructure second.


The Architecture: Three Layers

I ended up with a three-layer generation system, each progressively more capable (and more expensive):

Layer 1 — Static lookup     ← REMOVED (copyright risk)
Layer 2 — Text-to-image     ← Primary path (free, ~30s)
Layer 3 — Image-to-image    ← Upload your photo, fuse it with an emoji (~120s, async)

Enter fullscreen mode Exit fullscreen mode

Layer 1 was the original plan — use Google's pre-rendered emoji kitchen images. I killed it on day 5 after reading Google's image attribution policy more carefully. The risk wasn't worth it.


Layer 2: Text-to-Image with a Provider Fallback Chain

The core challenge with T2I emoji generation is: how do you make the model output something that actually looks like an emoji?

The naive approach — "🐱 + 🔥" — produces whatever the model thinks a cat fire is. Usually it's a realistic cat on fire. Not what you want.

Prompt Engineering: Descriptions > Unicode

I built a mapping table (emoji-prompt-map.ts) that translates emoji into concrete visual descriptions:

const EMOJI_DESCRIPTIONS: Record<string, string> = {
  '😀': 'round yellow face, wide open grin showing teeth, simple oval dot eyes',
  '🔥': 'bright orange and red flame, cartoon style, rounded base',
  '🐱': 'cute round cat face, large eyes, small pink nose, whiskers',
  // 200+ entries...
}

Enter fullscreen mode Exit fullscreen mode

Then the full prompt looks like:

function buildLayer2Prompt(emoji1: string, emoji2: string): string {
  const desc1 = EMOJI_DESCRIPTIONS[emoji1] ?? emoji1
  const desc2 = EMOJI_DESCRIPTIONS[emoji2] ?? emoji2
  return [
    `A single emoji character that fuses: [${desc1}] merged with [${desc2}].`,
    'Flat cartoon illustration style. Centered on pure white background.',
    'One single character only, no text, no multiple objects side by side.',
    'Clean vector-like look, bold outlines, vivid saturated colors.',
  ].join(' ')
}

Enter fullscreen mode Exit fullscreen mode

The "one single character only" constraint is critical. Without it, models love to render two separate objects next to each other — a cat on the left, a flame on the right — which defeats the whole point.

The Provider Chain

No single free provider is reliable enough to use alone. I set up a priority fallback chain:

T2I: Cloudflare Workers AI (flux-1-schnell)
       → ModelScope Z-Image-Turbo
         → MiniMax image-01

Enter fullscreen mode Exit fullscreen mode

Cloudflare's Workers AI gives ~230 free generations per day. For a bootstrapped side project, that's more than enough to handle organic traffic without paying anything. When it's exhausted or errors out, the request automatically falls to the next provider.

// Simplified provider selection
async function generateImage(opts: GenerateOptions): Promise<string> {
  const providers = isI2I(opts)
    ? ['gemini-proxy', 'gpt-proxy', 'modelscope-i2i', 'minimax-i2i']
    : ['cloudflare', 'modelscope-t2i', 'minimax-t2i']

  for (const provider of providers) {
    try {
      return await callProvider(provider, opts)
    } catch (err) {
      logProviderError(provider, err)
      // try next
    }
  }
  throw new Error('All providers failed')
}

Enter fullscreen mode Exit fullscreen mode

Each provider failure fires a Discord webhook alert, so I can see in real time if a provider is down.


The Transparent Background Problem

This is where most emoji tools stop. They return a white or colored background, which makes the result useless for Discord stickers, Telegram emoji, or overlay use.

I run every generated image through rembg, hosted on my own server:

async function removeBackground(imageBase64: string): Promise<string> {
  const response = await fetch(process.env.REMBG_API_URL!, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': process.env.REMBG_API_KEY!,
    },
    body: JSON.stringify({ image_base64: imageBase64 }),
  })
  const { result } = await response.json()
  return result // base64 PNG with alpha channel
}

Enter fullscreen mode Exit fullscreen mode

But here's the UX problem: rembg takes 2–4 seconds. If you wait for it before showing anything, the whole generation feels slow.

Solution: Show the image immediately with the background, then swap to the transparent version once rembg finishes. The user gets visual feedback fast, and the "better" version appears a few seconds later without any loading state.

// In the API route: fire rembg async, don't await it before responding
const rembgPromise = removeBackground(rawImageBase64).catch(() => null)

// Return raw image first, rembg result comes via a separate /api/rembg call
// triggered client-side after the initial image loads

Enter fullscreen mode Exit fullscreen mode


Layer 3: Image-to-Image (Upload Your Face)

The I2I mode lets users upload a photo and fuse it with an emoji style. This is the "Genmoji" experience — without requiring an Apple device.

The challenge here is latency. I2I models take 60–120 seconds. A synchronous API call times out on Vercel (max function timeout is 300s, and 120s is cutting it close).

I solved it with a submit/poll architecture:

POST /api/generate/submit    { task_id }
GET  /api/generate/poll?id=xxx    { status: 'pending' | 'done' | 'error', result? }

Enter fullscreen mode Exit fullscreen mode

The client submits the job, gets a task_id, then polls every 3 seconds until done. The UI shows a countdown timer so users know roughly how long to wait.

For I2I, prompt engineering gets trickier. The model needs to clearly understand which elements to keep from the photo (the person's face) and which to replace with emoji style. I use a "dual prompt" strategy:

function buildLayer3DualPrompt(userEmoji: string, photoContext: string): string {
  const emojiDesc = EMOJI_DESCRIPTIONS[userEmoji] ?? userEmoji
  return [
    `Transform the person in the photo into a single emoji character.`,
    `Emoji style: ${emojiDesc}.`,
    `Keep the person's facial features and expression. Apply flat cartoon illustration style.`,
    `Result must be ONE centered emoji character. No background, no text.`,
  ].join(' ')
}

Enter fullscreen mode Exit fullscreen mode


Rate Limiting Without a Database

I didn't want to add a database just for rate limiting. Solution: IP-based limits stored in a Vercel KV-compatible in-memory map (good enough for the current traffic level, will migrate when needed):

  • 5 generations per IP per day
  • 3 generations per IP per minute (burst protection)
  • 500 total generations per day across all users
// In-memory store — resets on each Vercel function cold start
// Good enough for <1K daily users, not suitable for horizontal scaling
const ipDayMap = new Map<string, number>()
const ipMinuteMap = new Map<string, number>()
let globalDailyCount = 0

Enter fullscreen mode Exit fullscreen mode

Is this production-grade? No. But for a side project at <500 daily users, it works perfectly and avoids adding infrastructure complexity before you need it.


The Animated Emoji Feature

Static emoji are fine. Animated emoji are shareable.

I added 6 preset animations (Bounce, Float, Wiggle, Pulse, Rubber, Spin) using Canvas frame-by-frame rendering, then encoding to GIF or WebP.

The browser-side approach (gif.js) is the fallback — it works but is slow on low-end devices. The real implementation sends the PNG to my server and uses FFmpeg:

Client: PNG + animation_name + size + format
  → POST /api/animate (my rembg server also handles this)
  → FFmpeg palettegen + paletteuse with reserve_transparent=1
  → Return GIF / WebP bytes

Enter fullscreen mode Exit fullscreen mode

For transparent GIFs (critical for Discord/Telegram stickers), the FFmpeg command is:

ffmpeg -i frames_%03d.png \
  -filter_complex "[0:v] palettegen=reserve_transparent=1 [p]; [0:v][p] paletteuse=alpha_threshold=128" \
  output.gif

Enter fullscreen mode Exit fullscreen mode

Getting the transparency right took way longer than I expected. The reserve_transparent=1 + alpha_threshold=128 combination is the key — without both flags, you get either a black background or jagged edges.


What's Next

The tool is live at forgemoji.com — free to use, no account required.

Current stats after ~2 weeks:

  • 261 pre-generated combo pages for SEO long-tail
  • 3-provider T2I fallback chain (zero paid cost for up to ~230 daily generations)
  • Full animated export: 6 effects × 3 sizes × 2 formats (GIF/WebP)

Things I'm still working on:

  • AdSense monetization (applied, pending review)
  • Product Hunt launch (waiting for stable UV baseline)
  • More emoji in the mapping table (currently ~200 entries, want 500+)

If you're building something similar and ran into the same "how do I make AI output something that actually looks like an emoji" problem, I hope this helps. Happy to answer questions in the comments.