Unleash Scalability: Build Your Own Vercel-like Platform with Node js and AWS

Jash Agrawal
4 min readMar 15, 2024

--

In today’s fast-paced development landscape, seamless deployment pipelines are crucial for rapid iteration and delivering exceptional user experiences. Vercel has established itself as a popular platform for streamlining front-end deployments. But what if you could build a custom solution that caters to your specific needs and offers greater control?

This article dives into the exciting world of building your own Vercel-like (Only for React Apps) platform using a powerful tech stack: TypeScript, Next.js, Node.js, Docker, AWS ECS, ECR, S3, Kafka, and ClickHouse. We’ll embark on a detailed journey, dissecting each component and understanding how they synergistically empower automated deployments and efficient hosting for your React projects.

System Design for vercel clone

Here’s an System design which we are going to discuss .

A Deep Dive into Automated Deployments and Streamlined Hosting

Breaking Down the Architecture .

  • Request Trigger: The journey begins with a new deployment request. This could be triggered by a push to a Git repository, a manual deployment button, or an external integration.
  • Dynamic Container Creation: Upon receiving the request, a Node.js server built with TypeScript spins up a brand-new Docker container using AWS ECS. This container is dynamically configured with crucial environment variables:
  • GITHUB URL: The URL of the Git repository containing your React project.
  • GITHUB BRANCH: The specific branch to be deployed.
  • DEPLOYMENT ID: A unique identifier for the current deployment, enabling tracking and logging.
  • Git Repository Cloning: Inside the newly minted container, the Docker leverages the power of Git to clone the specified repository and branch, ensuring you’re deploying the exact code you intend to.
  • Log Stream with Kafka: As the deployment process unfolds, Kafka, a distributed streaming platform, comes into play. The Node.js application acts as a producer, sending detailed logs about the deployment process to a Kafka topic. This allows for centralized log management and real-time insights.
  • Log Consumption and ClickHouse Integration: A Kafka consumer, also implemented in Node.js, relentlessly devours messages from the Kafka topic. It meticulously cleanses and transforms the logs, ultimately storing them in a ClickHouse database. ClickHouse excels as a columnar database, offering exceptional performance for massive log data volumes and enabling efficient querying and analysis.
  • Building for the Web with Node.js: Stepping back to the Docker container, the application utilizes Node.js. The build process optimizes the code for lightning-fast browser loading, ensuring your users experience a smooth and snappy website.
  • S3 as Your Reliable Storage Arsenal: Once the build is complete, the application strategically uploads the resulting artifacts to an Amazon S3 bucket. S3 boasts exceptional scalability and durability, making it an ideal choice for storing and serving your static website content.
  • Reverse Proxy: The Gatekeeper to Your Content: Another AWS service, Amazon Elastic Load Balancing (ELB) / Node.Js Server, acts as a robust reverse proxy. It intelligently routes incoming user requests to the appropriate S3 object holding your deployed project, guaranteeing that the correct version is always served.

The End Result: A Frictionless Deployment Pipeline

This intricate dance of technologies coalesces to create a seamless deployment pipeline:

  1. A new deployment request initiates the process.
  2. A Docker container is spawned with the essential environment variables.
  3. The Git repository is cloned, ensuring you deploy the desired code.
  4. Kafka efficiently streams deployment logs, captured for monitoring and analysis.
  5. ClickHouse expertly stores the logs for later exploration.
  6. Node.js meticulously builds your React project for production-grade performance.
  7. AWS S3 securely stores your project’s build artifacts.
  8. ELB/ (Another Node.Js Server) acts as a reliable reverse proxy, serving your project from S3.

Voilà! Your React project is now gracefully hosted and ready to be accessed by the world.

Benefits and Considerations

Building your own Vercel-like platform unlocks several advantages:

  • Customization: Tailor the platform to your specific needs and preferences.
  • Cost Optimization: Potentially manage hosting costs more effectively.
  • Integration with Existing Infrastructure: Seamlessly integrate with your current AWS setup.

Conclusion

By harnessing the power of TypeScript, Next.js, Node.js, Docker, AWS ECS, ECR, S3, Kafka, and ClickHouse, you can build a robust and efficient deployment platform .

Technical Blog With Step by Step Walk Trough Here.

Special thanks to Piyush Garg Tutorial .

( Actively looking for Full-stack Developer Roles hit me up . )

ME | LinkedIn | Github | Contact Me

--

--