An AI-powered blog platform that automatically generates and publishes blog posts using Google Cloud Run, Cloud Run Jobs, Cloud Scheduler, Firebase Hosting, and Gemini API.
It scrapes trending topics from Dev.to, generates blog content with Gemini AI, stores it in MongoDB, and serves it via a modern frontend deployed on Firebase.
This project mostly runs within Google Cloud free tier:
-
Cloud Run
- 2 million vCPU-seconds, 1 million GiB-seconds, and 2 million requests per month free
- 1 GB egress per month free
- After free tier, very low costs (your test run was ~₹0.94)
-
Cloud Scheduler
- 3 jobs per month free
- After that: $0.10 per job per month (~₹8 INR)
-
Firebase Hosting
- Free tier: 1 GB storage, 10 GB/month bandwidth
- Beyond that: ~$0.15/GB storage, ~$0.15/GB bandwidth
-
Secret Manager
- 10,000 secret access operations per month free
- Storage: first 10 secrets free, then $0.06/secret/month
👉 With weekly automation and light frontend usage, you’ll stay well inside the free tier.
Actual monthly costs should remain ~₹0 unless traffic spikes heavily.
AUTOMATED BLOG MACHINE
├── automation # Automation job (auto-generate blogs)
│ ├── autoGenerateBlog.js
│ ├── Dockerfile
│ ├── package.json
│ └── package-lock.json
│
├── client # React frontend (Firebase Hosting)
│ ├── public
│ ├── src
│ ├── dist
│ ├── firebase.json
│ ├── vite.config.js
│ ├── package.json
│ └── README.md
│
└── server # Backend API (Cloud Run)
├── server.js
├── Dockerfile
├── package.json
├── .dockerignore
└── .env- Node.js (v18+)
- Google Cloud SDK
- Firebase CLI
- A MongoDB database (Atlas or self-hosted)
- Enabled APIs in Google Cloud:
- Cloud Run
- Cloud Scheduler
- Secret Manager
Create a .env file in the server and automation folders with the following variables:
# MongoDB connection string
MONGODB_URI=your-mongodb-uri
# Gemini API key (Google Generative AI)
GEMINI_API_KEY=your-gemini-api-key
# Server port (default 5000)
PORT=5000-
Build & push Docker image:
cd server gcloud builds submit --tag gcr.io/automated-blog-machine/blog-backend .
-
Deploy to Cloud Run:
gcloud run deploy automated-blog-backend --image gcr.io/automated-blog-machine/blog-backend:latest --platform managed --region asia-south1 --allow-unauthenticated --port 5000 --set-env-vars="GOOGLE_CLOUD_PROJECT=automated-blog-machine" --update-secrets="MONGODB_URI=mongodb-uri:latest,GEMINI_API_KEY=gemini-api-key:latest"
-
Note down the Cloud Run URL (you’ll need it for the client).
-
Go to client folder:
cd client -
Update API endpoints to use your Cloud Run backend URL.
-
Build project:
npm install npm run build
-
Deploy to Firebase Hosting:
firebase login firebase init hosting firebase deploy
-
Your app will be available at:
https://<your-project>.web.app
-
Build automation image:
cd automation gcloud builds submit --tag gcr.io/automated-blog-machine/automation .
-
Deploy as Cloud Run Job:
gcloud run jobs create automation-job --image gcr.io/automated-blog-machine/automation:latest --region asia-south1 --memory 512Mi --cpu 1 --task-timeout 300 --max-retries 3 -
Run manually (test):
gcloud run jobs execute automation-job --region asia-south1
-
Create weekly job (runs every Monday 9AM IST):
gcloud scheduler jobs create http weekly-blog-generator --location=asia-south1 --schedule="0 9 * * 1" --uri="https://asia-south1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/automated-blog-machine/jobs/automation-job:run" --http-method=POST --oauth-service-account-email="[email protected]" --description="Generates a new blog post every Monday at 9 AM"
-
Manually trigger to test:
gcloud scheduler jobs run weekly-blog-generator --location=asia-south1 -
Check last execution:
gcloud run jobs executions list --job=automation-job --region=asia-south1 --limit=1
You can manage and test your Cloud Run Job and Scheduler with the following commands:
gcloud run jobs execute automation-job --region=asia-south1gcloud scheduler jobs list --location=asia-south1gcloud scheduler jobs pause weekly-blog-generator --location=asia-south1gcloud scheduler jobs resume weekly-blog-generator --location=asia-south1- Logs → Google Cloud Console → Logging
- Executions →
gcloud run jobs executions list - Scheduler → Google Cloud Console → Cloud Scheduler
- ✨ Auto-generates blogs from trending Dev.to topics
- ✨ Powered by Gemini API for AI content
- ✨ Fully serverless: Cloud Run, Firebase Hosting, MongoDB Atlas
- ✨ Weekly automation with Cloud Scheduler
- ✨ Zero-cost on free tier (with trial credits)
Built with:
For support, questions, or collaboration:
Your Name
📧 Email: [email protected]
🌐 GitHub: ATHARVA262005