DEV Community

Cover image for Running a early SaaS stack for $3.32/month exact breakdown
Guna sheelan
Guna sheelan

Posted on

Running a early SaaS stack for $3.32/month exact breakdown

I've been running Posthive (an open-source social media scheduler) plus two other projects on Railway's hobby plan. Got curious about the actual cost breakdown so here it is.

What's running 24/7

Posthive API - Fastify v4 + BullMQ + SQLite (via Prisma) + TypeScript ESM

  • 136 MB RAM idle
  • Cost: $0.59/month

Redis - BullMQ job queue for scheduled posts

  • Only 12.57 MB RAM (cleanup configured: keep last 100 completed + 200 failed jobs)
  • 300 MB volume (RDB snapshots for persistence)
  • Cost: $0.12/month

Two other projects - $1.63/month combined

Total so far this month: $2.58
Estimated end of month: $3.32

Why costs stay low

Railway bills on memory + CPU time, not requests. Traffic spikes cost nothing extra. Egress is free tier.

The BullMQ cleanup config is important without it, completed jobs accumulate in Redis forever:

defaultJobOptions: {
  attempts: 3,
  backoff: { type: "exponential", delay: 5000 },
  removeOnComplete: 100,
  removeOnFail: 200,
},
Enter fullscreen mode Exit fullscreen mode

Redis stays at 12 MB instead of growing unboundedly.

Docker setup

Multi-arch images (linux/amd64 + linux/arm64) built on GHCR via GitHub Actions with layer caching. Added a paths filter so doc-only commits don't trigger a full rebuild:

on:
  push:
    branches: [main]
    tags: ["v*"]
    paths:
      - "apps/api/**"
      - "apps/web/**"
      - "package.json"
      - "pnpm-lock.yaml"
      - ".github/workflows/docker.yml"
Enter fullscreen mode Exit fullscreen mode

Saves a few minutes of build time per doc commit, adds up over time.

When will costs go up?

Only when there's sustained high CPU from processing lots of jobs concurrently. For a scheduling SaaS, jobs are short bursts negligible monthly impact. I'll stay under $5/month until real user growth hits, then upgrade to the $20 plan

A ⭐ on the repo would mean a lot it's the main way people discover the project.

github.com/AstaBlackClove/posthive

Top comments (0)