Cloud-kit is a deployment platform built with TypeScript, Node.js, Redis, and AWS S3. This project demonstrates a complete CI/CD pipeline for deploying React applications with automatic builds and hosting.
This platform enables users to deploy React applications directly from GitHub repositories, similar to Vercel. The system automatically clones repositories, builds projects, and serves them through a custom domain infrastructure.
The project follows a microservices architecture with three primary services:
βββββββββββββββ
β Frontend β
β (React) β
ββββββββ¬βββββββ
β
β GitHub URL
βΌ
βββββββββββββββββββ
β Upload Service β βββΊ Clone Repo βββΊ Upload to S3 βββΊ Push to Redis Queue
βββββββββββββββββββ
β
β deployment-id
βΌ
ββββββββββββββββββββ
β Deploy Service β βββΊ Pull from Queue βββΊ Build Project βββΊ Upload Build to S3
ββββββββββββββββββββ
β
β Build artifacts
βΌ
ββββββββββββββββββββ
β Request Handler β βββΊ Serve from S3 βββΊ Deliver to Browser
ββββββββββββββββββββ
- Purpose: Handles GitHub repository ingestion
- Responsibilities:
- Receives GitHub repository URLs from the frontend
- Clones the repository to a temporary directory
- Uploads the project files to AWS S3
- Generates a unique deployment ID
- Pushes the deployment job to Redis Queue for processing
- Tracks upload status
- Purpose: Builds and deploys projects
- Responsibilities:
- Monitors Redis Queue for new deployment jobs
- Retrieves project files from S3
- Runs concurrent workers to build React projects
- Executes
npm installandnpm run build - Uploads built artifacts (HTML, CSS, JS) back to S3
- Updates deployment status in Redis
- Purpose: Serves deployed applications
- Responsibilities:
- Processes incoming HTTP requests
- Extracts subdomain from request URL
- Fetches corresponding built files from S3
- Serves static files to the browser
- Handles routing for deployed applications
- Purpose: User interface for deployment management
- Technology: React + TypeScript (Vite)
- Features:
- GitHub repository URL input
- Deployment initiation
- Real-time deployment status tracking
- Deployment link generation
- Responsive UI
- Runtime: Node.js
- Language: TypeScript
- Queue: Redis (for job management)
- Storage: AWS S3 (for file storage) and Cloudflare
- Additional:
- Express.js (API framework)
- Bull/BullMQ (Redis queue wrapper)
- Framework: React
- Language: TypeScript
- Build Tool: Vite
- Styling: CSS
- AWS S3 for object storage
- Redis for message queuing
- Potential deployment on AWS EC2/ECS
- Node.js (v16 or higher)
- npm or yarn
- Redis server
- AWS Account with S3 access
- AWS CLI configured
Create a .env file in each service directory:
# AWS Configuration
S3_BUCKET_NAME=your-bucket-name
S3_ACCESS_KEY_ID=your-access-key-id
S3_SECRET_ACCESS_KEY=your-secret-access-key
AWS_REGION=your-region
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your-redis-password
# Service Configuration
PORT=3000
BACKEND_UPLOAD_URL=http://localhost:3000- Clone the repository
git clone https://github.com/hkirat/vercel.git
cd vercel- Install dependencies for each service
# Upload Service
cd vercel-upload-service
npm install
# Deploy Service
cd ../vercel-deploy-service
npm install
# Request Handler
cd ../vercel-request-handler
npm install
# Frontend
cd ../frontend
npm install- Build TypeScript services
# In each service directory
npm run build
# or
npx tsc -bStart each service in separate terminal windows:
# Terminal 1 - Upload Service
cd vercel-upload-service
node dist/index.js
# Terminal 2 - Deploy Service
cd vercel-deploy-service
node dist/index.js
# Terminal 3 - Request Handler
cd vercel-request-handler
node dist/index.js
# Terminal 4 - Frontend
cd frontend
npm run devFor local development, add entries to /etc/hosts:
sudo nano /etc/hosts
# Add entries like:
127.0.0.1 <deployment-id>.localhost- Open the frontend at
http://localhost:5173 - Enter a GitHub repository URL (must be a React project)
- Click "Upload" to start deployment
- Wait for the build process to complete
- Access your deployed site at the provided subdomain
vercel/
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/
β β βββ App.tsx
β β βββ main.tsx
β βββ package.json
β
βββ vercel-upload-service/ # Upload service
β βββ src/
β β βββ aws.ts # S3 operations
β β βββ index.ts # Main server
β β βββ utils.ts
β βββ tsconfig.json
β βββ package.json
β
βββ vercel-deploy-service/ # Build & deploy service
β βββ src/
β β βββ aws.ts # S3 operations
β β βββ index.ts # Queue consumer & builder
β β βββ utils.ts
β βββ tsconfig.json
β βββ package.json
β
βββ vercel-request-handler/ # Request handling service
βββ src/
β βββ aws.ts # S3 retrieval
β βββ index.ts # HTTP server
β βββ utils.ts
βββ tsconfig.json
βββ package.json
Each service uses TypeScript and requires compilation:
npx tsc -b- User submits GitHub URL β Frontend sends request to Upload Service
- Upload Service β Clones repo, uploads to S3, queues deployment job
- Deploy Service β Picks job from queue, builds project, uploads artifacts
- Request Handler β Serves built files from S3 to end users
- Create an S3 bucket for storing projects
- Configure CORS policy:
[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
"AllowedOrigins": ["*"],
"ExposeHeaders": []
}
]- Set appropriate IAM permissions for S3 access
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::your-bucket-name/*",
"arn:aws:s3:::your-bucket-name"
]
}
]
}For production deployment, consider:
- Docker: Containerize each service
- Kubernetes: Orchestrate with K8s for auto-scaling
- AWS ECS/EKS: Deploy on managed container services
- Replace Redis with AWS SQS for managed queuing
- Use AWS Lambda for serverless deployment workers
- Implement AWS Fargate for auto-scaling based on queue size
- CloudFront: CDN for faster content delivery
- AWS Global Accelerator: Optimize routing
- Multi-region S3: Deploy across regions for redundancy
- CloudWatch: Monitor service health and logs
- X-Ray: Distributed tracing
- Prometheus + Grafana: Custom metrics dashboard
Test the deployment locally:
# Using curl to check deployed site
curl -H "Host: <deployment-id>.localhost:3001" http://localhost:3001Build Fails
- Ensure
package.jsonhas proper build script - Check Node.js version compatibility
- Verify all dependencies are installed
Cannot Access Deployed Site
- Update
/etc/hostsfile - Use HTTPS or configure proper DNS
- Check S3 bucket permissions
Redis Connection Issues
- Verify Redis server is running
- Check Redis connection credentials
- Ensure firewall allows Redis port
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available for educational purposes.
- Built as an educational project inspired by Vercel's architecture
- Community contributions and feedback
For questions or suggestions, please open an issue on GitHub.
If you found this project helpful, please give it a star!