
How we make sure we offer the best unified social media API
In a typical SaaS setting that our team has worked on and grew to hundreds of thousands of users, we have utilized cloud providers and tools that the best teams on the planet use: AWS, Vercel, GCP and Cloudflare. However, in order to offer a usage-based priced unified social media API, our team had to get back to the drawing board and rethink every piece of infrastructure involved.
The core principles we decided to follow back when we took over the architectural design of Outstand.so:
simple service abstracting all quirks of social media network APIsusage-based pricing99.5% guaranteed availability with 99.9% SLAs for larger use-casesThere was only one way to achieve this combination: by making sure every little detail in the whole system is made as efficient as possible. CPU time in ms matters. Memory usage needs to be tracked and optimized. Networking layer needs to be world-class. And this touches everything from the bottom up - from the codebase to the cloud provider we chose.
After much analysis of the landscape, Cloudflare ticked all the boxes.
Cloudflare has come a long way especially during the last year or so. They have significantly improved the developer experience. The typical argument that "Cloudflare Workers don't run Node.js" has gotten dated as they've spent a year improving compatibility of the Workers with Node.js as well as tackled cold start issues. Proof of that is that our blog, based on Payload CMS, is fully deployed on Cloudflare Workers and their team recently made a writeup about it too. The whole platform is built with the AI agents era in mind, allowing developers to take advantage of simple integrations to add inference-powered actions in their apps. And undoubtedly, as they power 20% of the web, they offer the best global network layer out there.
These all are very important updates that came out recently (during the last few months, at the time of writing) and changed our perspective on committing and deploying a SaaS completely on Cloudflare.
Instead of Vercel, Workers would power up all web and API routesRoute-level worker forwarding allows for scalable deployments across multiple workersOur monorepo structure (shoutout to turbo, another awesome tool in our toolbox) fits perfectly for dependency management across appsThe network spans the globe as we got users in every side of our planet and need to offer sub-50ms latencies across all endpointsThese all would not be possible with any other of the major cloud provider?
Of course they would. AWS, GCP or Azure offer the same level of performance more or less across all fronts.
However, this would come at a price. Eg. why use Amazon's S3 which charges for egress traffic when Cloudflare offers R2, an S3-compatible blob storage service with no egress fees? Cloudfront and Argo have almost comparable pricing for low to medium websites, but for a global SaaS with very-low traffic on the website or the web interfaces and very-high traffic API endpoints, Argo is almost the next best thing after bread and butter.
The tech stack of the best unified social media API
We have no reason to hide it: as Cloudflare works on improving every aspect of the architecture bottom-up to improve efficiency (and cost), we piggy back on their work to offer the best-in-class unified social media API service.
Our tech stack is:
Cloudflare DNS: leverage the high-performance global Cloudflare networkCloudflare Zero Trust: protect, authenticate and authorize routes that need protection. Allow external collaborators to have access only where it's needed. Protect our customer data to the maximum.NeonDB: our serverless PostgreSQL service providerCloudflare Workers: they power all web and API services. Even our NextJS projects are hosted there. Observability is nice but could be improved to be compatible with industry standard monitoring stacks, eg. LGTMShoutout to OpenNext, this project helped us migrate away from Vercel without any major issues.R2: S3-compatible blob storage. Used for static assets as well as ISR Cloudflare Queues: simple and cost-efficient queues for background task processingGCP Cloud Tasks: controllable and punctual task execution serviceHono: our lightweight framework of choice for our high-performant APIsCloudflare Argo: optimal network routing globallyWorkers AI: cost-efficient and performance AI inference endpoints readily available for our Cloudflare Worker workloadsCloudflare Secrets Store: separating and protecting the sensitive build or runtime variables, eg. API keysWorker Builds: a CI/CD system for Cloudflare Workers, with a generous free plan and a very reasonable pricing, even for concurrent builds across multiple workersWe are going to continue being open and transparent around our architecture, in an effort to increase customer trust on our infrastructure. We also welcome audits by Enterprise customers before committing to the long-term use of our unified social media APIs.