{"slug": "optimizing-a-blog-system-by-leveraging-free-tier-infrastructure", "title": "Optimizing a blog system by leveraging free tier infrastructure", "summary": "A developer running a cat-raising management system on free and hobby tiers documented how hitting quota limits on Vercel Hobby, MongoDB Atlas M0, and Upstash Redis forced targeted fixes. Misusing Next.js's cookies() on public pages turned static renders dynamic, and base64-embedded documents pushed Vercel Write Units to roughly 32,000 requests per day; moving files to AWS S3 with slim MongoDB projections and tuning BullMQ's drainDelay and stalledInterval cut Redis command usage that had exhausted Upstash's 500,000-command free limit.", "body_md": "Running a personal system on free or hobby tiers offers significant cost savings, but it also pushes engineers into strict resource limitation challenges. The tech stack includes Next.js deployed on Vercel Hobby, a NestJS backend on Render Hobby, MongoDB Atlas M0 database, and Upstash Redis combined with BullMQ for background tasks.\n\nEverything ran smoothly until the system started experiencing modest growth and free-tier quotas were reached. This article dives into the causes and solutions for each specific bottleneck.\n\nThe Next.js system is currently using Incremental Static Regeneration (ISR) with SSR. But the misuse of the `cookies()` function on pages that appear to be public effectively turns these requests into dynamic renders, forcing Vercel to perform constant recalculations.\n\nAdditionally, the habit of releasing code multiple times a day along with caching bloated objects due to directly embedding base64 data pushed Write Units to a peak of about 32,000 requests per day, exceeding the allowed Vercel Hobby limit.\n\n`cookies()` at the render layer.`.gp` and `.pdf` format documents from the main payload, store them directly on AWS S3, and return only the file path along with slim projection optimization from MongoDB.\nBullMQ defaults to continuous polling mechanisms in Redis to check for new jobs. With default configurations, workers maintain connections and constantly send commands even in an idle state.\n\nAs a result, the free limit of 500,000 commands on Upstash Redis was depleted in a short time, causing a series of background processing pipelines to grind to a halt.\n\n``` php\nflowchart LR\n    A[\"NestJS Worker\"] -->|\"Polling 24/7 (Default)\"| B[\"Upstash Redis\"]\n    B -->|\"Reach 500k commands\"| C[\"Rate Limit Exceeded\"]\n    C --> D[\"System Crash\"]\n```\n\nOptimize BullMQ connection configurations by fine-tuning polling time parameters:\n\n`drainDelay` and `stalledInterval` to reduce the frequency of workers pinging Redis when the queue is empty.\n\n``` js\nconst queue = new Queue('pet-tasks', {\n  connection: redisConnection,\n  defaultJobOptions: {\n    attempts: 3,\n    backoff: {\n      type: 'exponential',\n      delay: 5000,\n    },\n  },\n  settings: {\n    drainDelay: 30,\n    stalledInterval: 60000,\n  },\n});\n```\n\nDistilled from practical experience, here is a quick checklist to help maintain a stable system without spending money:\n\n`headers()` in Next.js to avoid accidentally forcing static pages to become dynamic.\nRunning a system on free/hobby tiers requires great care in architectural design and resource management. By refining the Next.js caching strategy and optimizing the BullMQ polling lifecycle, the cat-raising management system is running smoothly again [add result].", "url": "https://wpnews.pro/news/optimizing-a-blog-system-by-leveraging-free-tier-infrastructure", "canonical_source": "https://dev.to/yunkhngn/optimizing-a-blog-system-by-leveraging-free-tier-infrastructure-11a9", "published_at": "2026-12-04 03:43:44+00:00", "updated_at": "2026-12-04 03:45:41.814504+00:00", "lang": "en", "topics": ["developer-tools", "ai-infrastructure"], "entities": ["Vercel", "Next.js", "NestJS", "Render", "MongoDB Atlas", "Upstash Redis", "BullMQ", "AWS S3"], "also_reported_by": [], "takeaway": "Tuning BullMQ's drainDelay to 30 seconds and stalledInterval to 60 seconds, plus removing base64 documents from MongoDB payloads in favor of S3 paths, kept a free-tier stack under Vercel and Upstash command quotas.", "recommendation": {"advice": "Audit for cookies() and headers() on pages meant to be static, and raise BullMQ drainDelay and stalledInterval so idle workers stop burning Redis commands.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/optimizing-a-blog-system-by-leveraging-free-tier-infrastructure", "markdown": "https://wpnews.pro/news/optimizing-a-blog-system-by-leveraging-free-tier-infrastructure.md", "text": "https://wpnews.pro/news/optimizing-a-blog-system-by-leveraging-free-tier-infrastructure.txt", "jsonld": "https://wpnews.pro/news/optimizing-a-blog-system-by-leveraging-free-tier-infrastructure.jsonld"}}