atom, a publishing platform for Instagram and YouTube
A client’s video publishing outgrew a hosted automation tool. Lubili designed and delivered atom: a custom platform that reads from Google Drive, schedules in the cloud, publishes to Instagram and YouTube, and can be operated by an AI assistant over MCP. It is live in production, serving an active user base.
- Type
- Custom publishing platform with an MCP server
- Role
- Architecture, engineering and delivery of the full system for a client
- Stack
- Cloudflare Workers, D1, Queues and KV, TypeScript, Hono, Zod, Next.js (static export), Tailwind CSS, WebAuthn passkeys, OAuth 2.1 and MCP, Google Drive API, YouTube Data API, Instagram Graph API, Vitest
Context
The problem: a hosted automation tool was no longer enough
The client publishes short video to Instagram and YouTube from files kept in Google Drive. The workflow ran on a hosted automation tool, and its plan no longer fit the volume.
Publishing to two platforms is more than moving a file. Each has its own upload rules, quotas, scheduling model and ways to fail halfway. The client needed posts to go out on time without a computer switched on, a person in control of what goes live, and a clear record of what happened.
Why a custom platform
A general automation tool is built to connect steps. Scheduling, the state of each post, platform quotas and recovery after a half-finished publish are left to the workflow.
Owning that logic meant limits could come from the platforms’ own rules instead of a plan tier, and controls the client needed, such as an approval step and an AI assistant interface, could be built in.
Lubili’s role
Lubili designed, engineered and delivered atom for the client: the architecture, the scheduler and publishing engine, the Google Drive, YouTube and Instagram integrations, the dashboard, the MCP server, security, and the automated test suite.
The system runs in production on serverless infrastructure and is operated through a dashboard and, optionally, an AI assistant.
What we built
Inside atom: a custom Instagram and YouTube publishing platform
Google Drive media library
Connects through OAuth and syncs from Drive’s change feed, including folders backed up with Drive for desktop. New files arrive as “in review”, duplicates are linked, and files are checked for completeness before they can be approved. Drive access is read-only: atom never changes, moves or deletes a file.
Drafts and composer
Instagram Reels and Stories, and YouTube videos and Shorts, with captions, titles, tags, privacy and thumbnails. Fields are validated against each platform’s rules before anything is submitted, and a draft can be saved, scheduled or published now.
A cloud scheduler
A one-minute cron claims due jobs, hands them to a queue and sweeps for overdue or stuck work, so posts go out with every device switched off. A global pause switch and a dry-run mode stop or rehearse everything without losing a job.
YouTube publishing
Resumable uploads streamed from Drive in windows, with the confirmed offset saved so an interrupted upload resumes instead of restarting. Privacy is always set explicitly, scheduling uses YouTube’s own publish time, and upload, processing and visibility are tracked separately.
Instagram publishing
Creates a Reel or Story container, waits for Meta to finish processing, then publishes exactly once. If the outcome is ever unclear, atom asks Meta what happened instead of sending the request again. The video reaches Meta through a short-lived, single-use link or a resumable upload.
Quota awareness
YouTube’s upload allowance is counted and checked, and Instagram’s publishing limit is read from Meta, not hard-coded. A job that would exceed a limit is deferred and resumes by itself when capacity returns, so it is never lost or failed.
Dashboard
Connections for each account, a schedule with a live execution log for every job, what is currently live on each platform, usage and quotas, and system health. It works on a phone.
MCP server
A remote MCP server with OAuth 2.1 and four scopes (read, draft, schedule, publish) exposes 19 tools, so an AI assistant can find files, prepare drafts, schedule posts and check results. It calls the same services as the dashboard, so both behave identically.
Security and access
Passkeys, owner-only Google sign-in and single-use recovery codes. Platform tokens are encrypted at rest with AES-256-GCM, every API route denies by default, and security-relevant actions go to a separate audit log.
Engineering
Key decisions
The database is the truth, the queue only delivers.
Every state change and its dispatch request are written in one transaction, and the queue is treated as at-least-once. A duplicate delivery finds a newer version or a held lease and does nothing, so a retry cannot publish twice.
Reconcile, never repeat.
After any request that may have succeeded, such as a timeout during publish, atom checks what the platform recorded before it acts again. A post that cannot be confirmed goes to “needs attention” for a person instead of being sent a second time.
Stream, never store.
Video moves from Drive to the platform in bounded windows and is never buffered whole or copied. That keeps memory flat and avoids holding a second copy of the client’s media.
Defer, do not fail.
A used-up quota, a revoked token or a paused switch moves a job to a waiting state with a reason and a resume time. Nothing is marked failed for a cause that will clear.
The assistant prepares, the owner decides.
Publishing straight from an assistant needs the publish scope, an owner switch that is off by default, and a single-use confirmation tied to the exact content previewed. There are no admin tools over MCP, and text from Drive is returned as data, never as instructions.
One module per platform.
Each platform sits behind its own connector with its own state, quota entry and error mapping, so a problem with one cannot stop the other. Adding another platform is a new module, not a rewrite.
Built for tight limits.
The serverless platform’s per-request CPU and outbound-call limits shaped the design: work is bounded, streamed and resumable, and heavy steps run as queued jobs instead of inside a request.
Custom versus off the shelf
Where a custom platform goes further than a no-code tool
Hosted automation tools such as Zapier are a good fit for many workflows. atom exists because this one needed things a tool of that kind is not built to provide.
Scheduling that is part of the system
Jobs have explicit states, overdue work is found and recovered, and publishing can be paused or rehearsed with a switch.
Large files, streamed
Video goes from Drive to the platform in resumable windows, so the limits are those of YouTube and Instagram themselves.
Platform rules built in
Reel format checks before upload, YouTube privacy always explicit, quotas read from the platforms, and unclear results reconciled instead of repeated.
Custom control
An approval step, a live execution log and an MCP interface for AI assistants, designed around how the client works.
Extensible by design
Google Drive, Instagram and YouTube today. Because each platform is a connector behind a common interface, any tool or platform that offers a developer API can be added, subject to its terms and API access.
Results
Results of atom
- Live in production and serving an active user base.
- Posts go out on schedule with no computer switched on.
- Every action is recorded, with a live log for each job and a separate audit trail.
- Duplicate and missed publishes are guarded against: steps are idempotent and unclear results are reconciled.
- An AI assistant can handle the routine work while the owner keeps final control.
- Platform limits, not a plan tier, decide what can be published.
Architecture
The full system
For engineering readers. Everything in the drawing is described in the text above.
One Worker and one source of truth. The dashboard and the AI assistant call the same services, and each platform sits behind its own connector. Three more drawings follow: a post’s life, the streaming path, and the assistant workflow.
The life of a post
Streaming from Drive to the platforms
How an AI assistant works with atom
Stack
Technology
- Cloudflare Workers, D1, Queues and KV
- TypeScript
- Hono
- Zod
- Next.js (static export)
- Tailwind CSS
- WebAuthn passkeys
- OAuth 2.1 and MCP
- Google Drive API
- YouTube Data API
- Instagram Graph API
- Vitest
For your business
Similar problems Lubili can solve
Any workflow that has outgrown a hosted automation tool: scheduled publishing, document or media pipelines, multi-platform integrations, and processes that need approval, quotas, recovery and an audit trail. Lubili also builds the AI assistant interface (MCP) on top of such systems.
Client work. Client details are kept confidential.
Need a system that goes beyond what an automation tool can do?
Book a free consultation, and we will look at what you need, what a custom platform would involve, and whether it is the right choice.
Free. No obligation. You get a one-page written summary.