{"id":48802687,"url":"https://github.com/shahadot786/lambda-lite","last_synced_at":"2026-04-14T03:33:38.307Z","repository":{"id":331020072,"uuid":"1124647361","full_name":"shahadot786/lambda-lite","owner":"shahadot786","description":"Lambda-Lite is a lightweight, distributed task execution platform inspired by AWS Lambda. It allows users to submit JavaScript functions that are executed securely inside isolated Docker sandboxes, with job queuing, parallel worker distribution, execution logs, and system metrics.","archived":false,"fork":false,"pushed_at":"2025-12-31T12:23:45.000Z","size":331,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-02T02:33:21.241Z","etag":null,"topics":["backend","distributed-systems","docker","function-runtime","job-queue","microservices","nodejs","sandbox","serverless","system-design","task-executor","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shahadot786.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-29T11:21:17.000Z","updated_at":"2025-12-30T09:50:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shahadot786/lambda-lite","commit_stats":null,"previous_names":["shahadot786/lambda-lite"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/shahadot786/lambda-lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahadot786%2Flambda-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahadot786%2Flambda-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahadot786%2Flambda-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahadot786%2Flambda-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahadot786","download_url":"https://codeload.github.com/shahadot786/lambda-lite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahadot786%2Flambda-lite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31781292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","distributed-systems","docker","function-runtime","job-queue","microservices","nodejs","sandbox","serverless","system-design","task-executor","typescript"],"created_at":"2026-04-14T03:33:38.203Z","updated_at":"2026-04-14T03:33:38.299Z","avatar_url":"https://github.com/shahadot786.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lambda-Lite: Distributed Task Executor\n\nA mini AWS Lambda system for learning serverless architecture, distributed processing, and sandboxing. Execute JavaScript code in isolated Docker containers with resource limits and real-time monitoring.\n\n## 🏗️ Architecture\n\n```\n┌─────────────┐      ┌─────────────┐      ┌─────────────┐\n│   Frontend  │─────▶│   Backend   │─────▶│    Redis    │\n│   (React)   │      │  (Node.js)  │      │   (Queue)   │\n└─────────────┘      └─────────────┘      └─────────────┘\n                            │                     │\n                            ▼                     ▼\n                     ┌─────────────┐      ┌─────────────┐\n                     │   MongoDB   │      │   Worker    │\n                     │  (Storage)  │      │  (Executor) │\n                     └─────────────┘      └─────────────┘\n                                                 │\n                                                 ▼\n                                          ┌─────────────┐\n                                          │   Sandbox   │\n                                          │  (Docker)   │\n                                          └─────────────┘\n```\n\n## ✨ Features\n\n- **Serverless Execution**: Submit JavaScript code and execute it in isolated environments\n- **Sandboxing**: Docker containers with resource limits (CPU, memory, timeout)\n- **Distributed Processing**: BullMQ-based job queue with horizontal scaling\n- **Real-time Monitoring**: Live job status updates and log streaming\n- **Analytics Dashboard**: Comprehensive view of system health, success rates, and queue pressure\n- **Premium UI**: Modern, responsive React frontend built with Tailwind CSS v4 and shadcn/ui\n- **Adaptive Design**: Fully optimized for mobile, tablet, and desktop with theme-aware branding\n- **Metrics**: Native Prometheus integration and built-in visual analytics\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- Docker and Docker Compose\n- Node.js 20+ (for local development)\n\n### Run with Docker Compose\n\n```bash\n# Clone the repository\ngit clone \u003crepository-url\u003e\ncd lambda-lite\n\n# Build and start all services\ndocker compose -f infra/docker-compose.yml up --build\n\n# Access the application\n# Frontend: http://localhost:5173\n# Backend API: http://localhost:8000\n# Prometheus: http://localhost:9090\n```\n\n### Local Development (Hybrid Mode)\n\nFor development, it's recommended to run **Databases in Docker** and **Code locally**.\n\n```bash\n# 1. Start only the databases\ncd infra \u0026\u0026 docker compose up -d mongodb redis\n\n# 2. Run your app (see below)\n```\n\n#### Backend\n\n```bash\ncd apps/backend\nyarn install\nyarn dev\n```\n\n#### Worker\n\n```bash\ncd apps/worker\nyarn install\nyarn dev\n```\n\n#### Frontend\n\n```bash\ncd apps/frontend\nyarn install\nyarn dev\n```\n\n## 📝 API Documentation\n\n### Submit Job\n\n```bash\nPOST /api/jobs\nContent-Type: application/json\n\n{\n  \"code\": \"function main(a, b) { return a + b; }\",\n  \"args\": [2, 3],\n  \"timeout\": 30000\n}\n```\n\n### Get Job Status\n\n```bash\nGET /api/jobs/:id\n```\n\n### Get Job Logs\n\n```bash\nGET /api/jobs/:id/logs\n```\n\n### Get System Analytics\n\n```bash\nGET /api/jobs/analytics\n```\n\n### List All Jobs\n\n```bash\nGET /api/jobs?page=1\u0026limit=20\n```\n\n## 🔧 Configuration\n\n### Environment Variables\n\n#### Backend\n\n- `PORT`: Server port (default: 8000)\n- `MONGODB_URI`: MongoDB connection string\n- `REDIS_HOST`: Redis host\n- `REDIS_PORT`: Redis port\n\n#### Worker\n\n- `MONGODB_URI`: MongoDB connection string\n- `REDIS_HOST`: Redis host\n- `REDIS_PORT`: Redis port\n- `SANDBOX_IMAGE`: Docker image for sandbox (default: lambda-lite-sandbox:latest)\n\n#### Frontend\n\n- `VITE_API_URL`: Backend API URL\n\n## 📊 Monitoring\n\nAccess Prometheus metrics at `http://localhost:9090`\n\nAvailable metrics:\n- `lambda_lite_jobs_submitted_total`: Total jobs submitted\n- `lambda_lite_jobs_completed_total`: Total jobs completed (by status)\n- `lambda_lite_job_execution_duration_seconds`: Job execution time histogram\n- `lambda_lite_active_jobs`: Current active jobs\n- `lambda_lite_queue_size`: Jobs in queue\n\n## 🔒 Security\n\n- **Code Validation**: Basic security checks for dangerous operations\n- **Sandboxing**: Isolated Docker containers with:\n  - No network access\n  - Read-only filesystem\n  - CPU and memory limits\n  - Execution timeout\n- **Resource Limits**: Configurable CPU, memory, and timeout constraints\n\n## 🧪 Example Usage\n\n### Simple Addition\n\n```javascript\nfunction main(a, b) {\n  console.log('Adding', a, 'and', b);\n  return a + b;\n}\n```\n\nArguments: `[2, 3]`\n\n### Array Processing\n\n```javascript\nfunction main(numbers) {\n  console.log('Processing array:', numbers);\n  return numbers.reduce((sum, n) =\u003e sum + n, 0);\n}\n```\n\nArguments: `[[1, 2, 3, 4, 5]]`\n\n### Async Operations\n\n```javascript\nasync function main(delay) {\n  console.log('Waiting', delay, 'ms');\n  await new Promise(resolve =\u003e setTimeout(resolve, delay));\n  console.log('Done!');\n  return 'Completed';\n}\n```\n\nArguments: `[1000]`\n\n## 🏗️ Project Structure\n\n```\nlambda-lite/\n├── apps/\n│   ├── backend/          # REST API service\n│   ├── worker/           # Job execution service\n│   └── frontend/         # React UI\n├── docker/\n│   └── sandbox/          # Sandbox Docker image\n├── infra/\n│   ├── docker-compose.yml\n│   ├── prometheus.yml\n│   └── redis.conf\n└── shared/               # Shared TypeScript types\n```\n\n## 🔄 Scaling\n\nScale workers horizontally:\n\n```bash\ndocker compose -f infra/docker-compose.yml up --scale worker=5\n```\n\n## 📚 Tech Stack\n\n- **Backend**: Node.js, Express, TypeScript\n- **Worker**: Node.js, Dockerode, TypeScript\n- **Queue**: Redis, BullMQ\n- **Database**: MongoDB\n- **Monitoring**: Prometheus, prom-client\n- **Frontend**: React, TypeScript, Vite, Tailwind CSS v4, shadcn/ui, Lucide Icons, Monaco Editor\n- **Containerization**: Docker, Docker Compose\n\n## 🤝 Contributing\n\nContributions are welcome! This is a learning project demonstrating:\n- Serverless architecture patterns\n- Distributed job processing\n- Container-based sandboxing\n- Real-time monitoring\n- Microservices communication\n\n## 📄 License\n\nMIT License - feel free to use this project for learning and experimentation.\n\n## 🎯 Learning Objectives\n\nThis project demonstrates:\n1. **Distributed Systems**: Job queue, worker pool, horizontal scaling\n2. **Sandboxing**: Secure code execution in isolated environments\n3. **Microservices**: Backend, worker, and frontend as separate services\n4. **Real-time Updates**: WebSocket-based status and log streaming\n5. **Monitoring**: Prometheus metrics and observability\n6. **Docker**: Multi-stage builds, Docker-in-Docker, resource limits\n7. **Full-stack Development**: React frontend + Node.js backend\n\n## 🐛 Troubleshooting\n\n### Worker can't connect to Docker\n\nEnsure Docker socket is mounted:\n```yaml\nvolumes:\n  - /var/run/docker.sock:/var/run/docker.sock\n```\n\n### Jobs stuck in PENDING\n\nCheck worker logs:\n```bash\ndocker compose -f infra/docker-compose.yml logs worker\n```\n\n### Frontend can't reach backend\n\nCheck API proxy configuration in `nginx.conf` or `vite.config.ts`\n\n---\n\nBuilt with ❤️ for learning distributed systems and serverless architecture","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahadot786%2Flambda-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahadot786%2Flambda-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahadot786%2Flambda-lite/lists"}