DEV Community

MoodFlow
MoodFlow

Posted on

Serving 6 Tools from One FastAPI Server: MoodFlow's Monolith Architecture

Serving 6 Tools from One FastAPI Server: MoodFlow's Monolith Architecture

The Monolith Decision

When you have 6 tools (stock analysis, fortune telling, quiz generator, TikTok scripts, e-commerce copy, auto reply), the natural instinct is microservices. I went the other way.

Why Monolith?

1. Solo Developer Reality

  • One person maintaining 6 microservices = burnout
  • One FastAPI server with 6 route groups = manageable
  • Debug one log file instead of 6

2. Shared Infrastructure

/app.py (FastAPI, port 8000)
├── /api/stocks/*      → Stock analysis engine
├── /api/fortune/*     → Fortune template engine
├── /api/quiz/*        → Quiz generator
├── /api/tiktok/*      → Script generator
├── /api/ecommerce/*   → Product copy generator
├── /api/autoreply/*   → Comment management
├── Shared: moodflow.db (SQLite)
├── Shared: DeepSeek API (LLM calls)
└── Shared: yfinance (stock data)
Enter fullscreen mode Exit fullscreen mode

3. Performance Is Not the Bottleneck

  • Stock analysis: 2-5 seconds (yfinance + scoring)
  • Fortune: <50ms (template engine, no API call)
  • Content generation: 3-8 seconds (DeepSeek API)
  • All async, all concurrent

The database and LLM API are the real bottlenecks — not the server architecture.

The Trade-offs

Pro Con
Single deploy No independent scaling
One codebase Bigger git repo
Easy debugging Coupling risk
Shared auth/session All-or-nothing downtime

When I'd Switch to Microservices

  • 10,000+ concurrent users
  • Stock engine needs GPU inference
  • Fortune goes viral and needs CDN caching
  • Different teams managing different tools

For now? The monolith serves 6 tools, 6 languages, and growing traffic — from a single $24/month VPS in Singapore.

👉 https://getmoodflow.com



🔮 Free Daily Fortune!

One server. Six tools. Fortune telling costs us near-zero to run — so it's free for you forever.

👉 Get your free fortune now →


📊 Free AI Stock Analysis: Get instant buy/sell signals for SG, MY, ID, US stocks — 5 free queries daily on Telegram: https://t.me/MoodFlowStockBot

Top comments (0)