← Back

mefriend.ai

AI character platform with persistent memory · scaled to ~300K users.

Co-founder · Backend & Infra

NestJS · FastAPI · Kubernetes · LangGraph · Langfuse · MongoDB · Redis


mefriend.ai is an AI character platform — think Instagram for photos or YouTube for video, but for AI characters you create, share, and build a relationship with. People don't ask it questions so much as roleplay, vent, and hang out with personas that remember them across sessions. I co-founded it in November 2024 and led backend architecture, the AI inference infrastructure, and the LLM agent layer. We shipped the MVP in two months and it went global fast: ~300K users and 10M+ conversations within five months, 95% of them overseas, with the heaviest users spending 8+ hours a day in it. We secured $300K+ in R&D funding along the way.

What it does

You create or pick a character and talk to it in long-running, in-character conversations. Each character holds a distinct personality and keeps long-term memory, so it stays consistent and remembers you across sessions. Most of the catalog is user-generated — thousands of community-created characters, from medieval kings to healing-counselor personas — shared and discovered like any other content platform. Monetization runs on usage-based coins and microtransactions like extended memory and image generation.

Architecture

  • Backend: microservices on NestJS (primary API, TypeScript) and FastAPI (AI-heavy workers, Python), event-driven via Redis Streams and BullMQ.
  • API layer: oRPC contracts with Zod schemas shared client↔server for end-to-end type safety.
  • Data: MongoDB via Prisma for character and chat data; Redis for hot state and rate limiting.
  • Infra: Kubernetes across a hybrid cloud — EKS in production (on startup credits) and bare-metal Kubernetes on GCP for dev — with Jenkins + ArgoCD GitOps and secrets via Infisical.
  • AI agents: dialogue agents built with LangGraph, with explicit state-machine control over retrieval, memory read/write, persona injection, and generation. RAG over a per-user long-term memory store; Langfuse for tracing and eval.

The scaling story

Growth came in spikes, and hitting ~300K users well before the infra was built for it set off a chain of problems:

  1. The infra melted under load. The original setup couldn't take the spikes. Over about a week I moved the whole deployment onto Kubernetes, scaled the hot path out horizontally, and split the AI worker path off from the API path so the two could scale independently. I kept the service up the whole time by shifting traffic over incrementally behind a gateway instead of doing one big cutover.
  2. Inference costs were going to kill us. It was the single biggest line item, and I didn't want to touch memory fidelity, since that was our whole edge. So I went after cost three other ways: RAG over long-term memory, prompt and prefix caching, summarizing the context window. That got inference down about 80% with no quality drop I could measure.
  3. None of that was safe without eval, so I built it first. The harness ran hundreds of scripted multi-turn conversations through LLM-as-judge rubrics that scored in-character consistency, memory recall, and emotional tone. Every prompt or model change had to clear it before shipping. It's the one thing from mefriend I'd carry into anything else.

What I'd do differently

I'd split the AI worker path from the API path on day one; they scale completely differently. And I'd treat eval as day-one infrastructure instead of something I reached for only after the first cost crisis.