{"id":29376483,"url":"https://github.com/geek-fun/serverlessinsight","last_synced_at":"2026-04-01T19:44:24.573Z","repository":{"id":218341569,"uuid":"746172674","full_name":"geek-fun/serverlessinsight","owner":"geek-fun","description":"Full life cycle cross providers serverless application management for your fast-growing business.","archived":false,"fork":false,"pushed_at":"2026-03-25T07:27:59.000Z","size":23529,"stargazers_count":87,"open_issues_count":14,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-03-25T09:57:21.550Z","etag":null,"topics":["aws-serverless","cloudnative","infrastructure-as-code","serverless","serverless-framework","serverless-offline"],"latest_commit_sha":null,"homepage":"http://serverlessinsight.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geek-fun.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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2024-01-21T09:33:10.000Z","updated_at":"2026-03-25T07:24:45.000Z","dependencies_parsed_at":"2025-12-18T14:02:34.130Z","dependency_job_id":null,"html_url":"https://github.com/geek-fun/serverlessinsight","commit_stats":null,"previous_names":["geek-fun/hostsless","geek-fun/serverlessinsight"],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/geek-fun/serverlessinsight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geek-fun%2Fserverlessinsight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geek-fun%2Fserverlessinsight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geek-fun%2Fserverlessinsight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geek-fun%2Fserverlessinsight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geek-fun","download_url":"https://codeload.github.com/geek-fun/serverlessinsight/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geek-fun%2Fserverlessinsight/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"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":["aws-serverless","cloudnative","infrastructure-as-code","serverless","serverless-framework","serverless-offline"],"created_at":"2025-07-09T22:43:08.294Z","updated_at":"2026-04-01T19:44:24.564Z","avatar_url":"https://github.com/geek-fun.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ServerlessInsight\n\n\u003cdiv align=\"center\"\u003e\n\n[![Node.js CI](https://github.com/geek-fun/serverlessinsight/actions/workflows/node.yml/badge.svg)](https://github.com/geek-fun/serverlessinsight/actions/workflows/node.yml)\n[![release](https://github.com/geek-fun/serverlessinsight/actions/workflows/release.yml/badge.svg)](https://github.com/geek-fun/serverlessinsight/actions/workflows/release.yml)\n[![npm version](https://badge.fury.io/js/@geek-fun%2Fserverlessinsight.svg)](https://badge.fury.io/js/@geek-fun%2Fserverlessinsight)\n[![Known Vulnerabilities](https://snyk.io/test/github/geek-fun/serverlessinsight/badge.svg)](https://snyk.io/test/github/geek-fun/serverlessinsight)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![codecov](https://codecov.io/gh/geek-fun/serverlessinsight/graph/badge.svg?token=ISW7MFuSlf)](https://codecov.io/gh/geek-fun/serverlessinsight)\n\n**Full life cycle cross-provider serverless application management for your fast-growing business**\n\n[Website](https://serverlessinsight.geekfun.club) • [Documentation](https://serverlessinsight.geekfun.club) • [Examples](./samples) • [中文文档](./README.zh-CN.md)\n\n\u003c/div\u003e\n\n---\n\nServerlessInsight is a powerful serverless framework for managing serverless applications across multiple cloud providers. It provides a unified interface to deploy, manage, and debug serverless functions and resources using Infrastructure as Code (IaC) principles.\n\nWhether you're building on AWS, Alibaba Cloud, Huawei Cloud, or other providers, ServerlessInsight simplifies your development workflow with:\n\n- **Multi-cloud support** - Work with multiple cloud providers using a single tool\n- **Infrastructure as Code** - Define your serverless infrastructure in YAML\n- **Local development** - Test your functions locally before deploying\n- **Type-safe templates** - Validate your configurations before deployment\n\n---\n\n## ✨ Features\n\n- 🌍 **Multi-Cloud Provider Support** - Deploy to Alibaba Cloud, Huawei Cloud, and more\n- 📦 **Unified Configuration** - Single YAML format for all providers\n- 🚀 **Quick Deployment** - Deploy serverless applications with a single command\n- 🔍 **Template Validation** - Validate your IaC templates before deployment\n- 🏠 **Local Testing** - Run and debug serverless functions locally\n- 🔄 **Template Generation** - Generate provider-specific IaC templates\n- 🌐 **API Gateway Integration** - Configure HTTP endpoints for your functions\n- 🌐 **Custom Domain Binding** - Automatic domain binding with DNS verification for OSS and API Gateway\n- 💾 **Resource Management** - Manage storage, databases, and other cloud resources\n- 🔐 **Security First** - Built-in validation and security best practices\n- 📊 **Comprehensive Logging** - Debug and monitor your applications\n\n---\n\n## ☁️ Supported Providers\n\nServerlessInsight supports the following cloud providers:\n\n| Provider          | Functions        | API Gateway    | Storage        | Databases        | Status  |\n| ----------------- | ---------------- | -------------- | -------------- | ---------------- | ------- |\n| **Alibaba Cloud** | ✅ FC3           | ✅ API Gateway | ✅ OSS         | ✅ RDS, OTS, ESS | Stable  |\n| **Tencent Cloud** | ✅ SCF           | 🚧 Coming Soon | ✅ COS         | ✅ TDSQL-C       | Stable  |\n| **Huawei Cloud**  | ✅ FunctionGraph | 🚧 Coming Soon | 🚧 Coming Soon | 🚧 Coming Soon   | Beta    |\n| **AWS**           | 🔜 Planned       | 🔜 Planned     | 🔜 Planned     | 🔜 Planned       | Planned |\n| **Azure**         | 🔜 Planned       | 🔜 Planned     | 🔜 Planned     | 🔜 Planned       | Planned |\n| **Google Cloud**  | 🔜 Planned       | 🔜 Planned     | 🔜 Planned     | 🔜 Planned       | Planned |\n\n---\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- **Node.js** 16.x or higher\n- Cloud provider credentials (Alibaba Cloud AccessKey, Huawei Cloud credentials, etc.)\n\n### Installation\n\nInstall ServerlessInsight globally using npm:\n\n```bash\nnpm install -g @geek-fun/serverlessinsight\n```\n\nVerify the installation:\n\n```bash\nsi --version\n```\n\n---\n\n## 📚 Usage\n\n```bash\n# Validate your serverless configuration\nsi validate -f serverless.yml\n\n# Generate deployment plan (see what will change)\nsi plan -f serverless.yml\n\n# Deploy your serverless application\nsi deploy -f serverless.yml -s dev\n\n# Run your application locally for debugging\nsi local -f serverless.yml -s local\n\n# Show deployed resource information\nsi show -f serverless.yml\n\n# Destroy the deployed stack\nsi destroy -f serverless.yml\n```\n\n---\n\n## 💡 Examples\n\nServerlessInsight uses a simple YAML format to define your serverless infrastructure:\n\n```yaml\nversion: 0.0.1\nprovider:\n  name: aliyun\n  region: cn-hongkong\n\nservice: my-api-service\n\nfunctions:\n  hello_function:\n    name: hello-world-fn\n    code:\n      runtime: nodejs18\n      handler: index.handler\n      path: ./src\n    memory: 512\n    timeout: 10\n    environment:\n      NODE_ENV: production\n\nevents:\n  api_gateway:\n    type: API_GATEWAY\n    name: my-api-gateway\n    triggers:\n      - method: GET\n        path: /api/hello\n        backend: ${functions.hello_function}\n```\n\nFor more examples, check out the [samples](./samples) directory:\n\n- [API Gateway Example](./samples/aliyun-poc-api.yml) - Deploy functions with HTTP endpoints\n- [Storage Example](./samples/aliyun-poc-bucket.yml) - Configure OSS buckets\n- [Custom Domain Example](./samples/aliyun-poc-domain.yml) - Configure OSS static website with custom domain binding\n- [Database Example](./samples/aliyun-poc-rds.yml) - Set up RDS databases\n- [Table Store Example](./samples/aliyun-poc-table.yml) - Configure OTS table storage\n- [Elasticsearch Example](./samples/aliyun-poc-es.yml) - Deploy Elasticsearch Serverless\n- [GPU Functions Example](./samples/aliyun-poc-fc-gpu.yml) - Deploy GPU-enabled functions\n- [Huawei Cloud Example](./samples/huawei-poc-fc.yml) - Deploy to Huawei Cloud FunctionGraph\n\n---\n\n## 🔧 Local Development\n\n```bash\n# Clone and setup\ngit clone https://github.com/geek-fun/serverlessinsight.git\ncd serverlessinsight\nnpm install\n\n# Build and link for development\nnpm run build\nnpm link\n\n# Run local development server\nsi local -f serverless.yml -s local\n\n# Run tests\nnpm test\n\n# Lint code\nnpm run lint:check\n```\n\n### Local Testing with Buckets\n\nWhen running the local development server, you can test bucket operations by accessing files through the LocalStack server:\n\n```bash\n# List all files in a bucket\ncurl http://localhost:4567/si_buckets/\u003cbucket_key\u003e/\n\n# Access a specific file from a bucket\ncurl http://localhost:4567/si_buckets/\u003cbucket_key\u003e/path/to/file.html\n\n# List files in a subdirectory\ncurl http://localhost:4567/si_buckets/\u003cbucket_key\u003e/subdir/\n```\n\nThe bucket handler serves files from the directory specified in your bucket's `website.code` configuration.\n\n### Architecture\n\nServerlessInsight follows a **functional client architecture** that cleanly separates cloud provider SDKs from business logic:\n\n#### Layered Design\n\n```\n┌─────────────────────────────────────────┐\n│   Resource / Planner / Executor Layer   │  ← Provider-agnostic business logic\n│   (Pure functions, no SDK imports)       │\n└─────────────────────────────────────────┘\n                    ↓\n┌─────────────────────────────────────────┐\n│         Functional Client Layer          │  ← Encapsulated SDK operations\n│   (aliyunClient.ts, tencentClient.ts)   │\n└─────────────────────────────────────────┘\n                    ↓\n┌─────────────────────────────────────────┐\n│      Cloud Provider SDKs                 │  ← @alicloud/*, tencentcloud-*\n└─────────────────────────────────────────┘\n```\n\n#### Key Principles\n\n- **Functional \u0026 Pure**: All business logic uses pure functions with immutable data\n- **SDK Encapsulation**: Provider SDKs are accessed ONLY through client modules\n- **Operation Functions**: Clients expose high-level operation functions (e.g., `createFunction`, `getFunction`)\n- **No Classes**: Prefer `type` over `interface`, and functional patterns over classes\n- **Minimal Side Effects**: File I/O and other side effects are isolated at boundaries\n\n#### Client Pattern Example\n\n```typescript\n// ✅ Client exposes operation functions, not raw SDKs\nexport type AliyunClient = {\n  fc3: {\n    createFunction: (config: Fc3FunctionConfig, codeBase64: string) =\u003e Promise\u003cvoid\u003e;\n    getFunction: (functionName: string) =\u003e Promise\u003cFc3FunctionInfo | null\u003e;\n    // ... other operations\n  };\n  // ... other services\n};\n\n// ✅ Resource layer uses clean client API\nconst client = createAliyunClient(context);\nconst codeBase64 = readFileAsBase64(codePath);\nawait client.fc3.createFunction(config, codeBase64);\n```\n\nThis architecture enables:\n\n- **Better Testing**: Mock client operations instead of SDKs\n- **Maintainability**: Provider changes isolated to client layer\n- **Type Safety**: Strong typing throughout the stack\n- **Code Reuse**: Shared client operations across resources\n\n---\n\n## 🌐 Custom Domain Binding\n\nServerlessInsight provides automatic custom domain binding for OSS buckets and API Gateway with built-in DNS verification.\n\n### OSS Custom Domain Binding\n\nWhen you configure a custom domain for an OSS bucket (static website hosting), ServerlessInsight automatically:\n\n1. **Binds the domain** to your OSS bucket\n2. **Creates DNS CNAME records** pointing to the correct OSS endpoint\n3. **Handles domain ownership verification** via DNS TXT records when required by the cloud provider\n4. **Manages retry logic** with DNS propagation polling for reliable binding\n\n```yaml\nbuckets:\n  my_website:\n    name: my-website-bucket\n    security:\n      acl: PUBLIC_READ\n    website:\n      code: ./dist\n      domain: www.example.com # Custom domain binding\n      index: index.html\n      error_page: 404.html\n```\n\n### Domain Ownership Verification Flow\n\nWhen binding a custom domain that requires ownership verification:\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                    OSS Custom Domain Binding                     │\n└─────────────────────────────────────────────────────────────────┘\n                               │\n                               ▼\n                   ┌───────────────────────┐\n                   │   PutCname (Attempt)   │\n                   └───────────────────────┘\n                               │\n           ┌───────────────────┴───────────────────┐\n           │                                       │\n           ▼                                       ▼\n   ┌───────────────┐                    ┌─────────────────┐\n   │   Success     │                    │ NeedVerifyDomain│\n   └───────────────┘                    │    Ownership    │\n                                        └─────────────────┘\n                                                  │\n                                                  ▼\n                                    ┌─────────────────────────┐\n                                    │  CreateCnameToken API   │\n                                    │  (Get TXT record value) │\n                                    └─────────────────────────┘\n                                                  │\n                                                  ▼\n                                    ┌─────────────────────────┐\n                                    │  Check existing TXT     │\n                                    │  records (avoid dupes)  │\n                                    └─────────────────────────┘\n                                                  │\n                                                  ▼\n                                    ┌─────────────────────────┐\n                                    │  Add DNS TXT Record     │\n                                    │  (_dnsauth.domain)      │\n                                    └─────────────────────────┘\n                                                  │\n                                                  ▼\n                                    ┌─────────────────────────┐\n                                    │  Poll DNS Propagation   │\n                                    │  (up to 10 × 1 min)     │\n                                    └─────────────────────────┘\n                                                  │\n                                                  ▼\n                                    ┌─────────────────────────┐\n                                    │  Retry PutCname         │\n                                    │  (up to 5 × 30 sec)     │\n                                    └─────────────────────────┘\n```\n\n### Supported Domain Types\n\nFor OSS static website hosting, ServerlessInsight supports:\n\n| Domain Type       | CNAME Target                  | Use Case                                       |\n| ----------------- | ----------------------------- | ---------------------------------------------- |\n| Root domain (`@`) | `bucket.region.taihangcda.cn` | Bypasses DNS CNAME restriction on root domains |\n| Subdomain (`www`) | `bucket.region.taihangcda.cn` | Standard CNAME for all subdomains              |\n| Any subdomain     | `bucket.region.taihangcda.cn` | Unified CNAME endpoint for all domain types    |\n\n\u003e 💡 **Note**: All domain types now use the recommended `taihangcda.cn` CNAME endpoint, which is derived automatically from your bucket's actual extranet endpoint via the `GetBucketInfo` API.\n\nFor detailed configuration, see [OSS Custom Domain Binding Guide](./docs/oss-custom-domain-binding.md).\n\n---\n\n## 🗄️ State Management\n\nServerlessInsight uses a state-based deployment model that tracks all deployed resources in a local state file (`.serverlessinsight/state-{app}-{service}.json` in the project directory). This enables:\n\n- **Incremental deployments** - Only changed resources are updated\n- **Drift detection** - Identifies differences between local state and cloud resources\n- **Safe destruction** - Knows which resources to clean up\n\n### Partial Failure Recovery\n\nWhen deploying multiple resources, if one fails, ServerlessInsight ensures that:\n\n1. **Successfully deployed resources are always saved to state** - Even if subsequent resources fail, your state file will contain all resources that were successfully created/updated/deleted\n2. **Clear error reporting** - You'll see which resources succeeded and which failed\n3. **Easy retry** - Simply run `deploy` again to continue from where you left off\n\nExample partial failure output:\n\n```\n⚠️  PARTIAL DEPLOYMENT FAILURE: 2 resource(s) succeeded, but functions.api_handler failed.\nState has been saved for successfully deployed resources. Run deploy again to retry failed resources.\nNext steps: 1) Review the error above, 2) Fix any configuration issues, 3) Run deploy again to continue.\n```\n\n### State File Location\n\nThe state file is stored as `.serverlessinsight/state-{app}-{service}.json` in your project directory (e.g., `.serverlessinsight/state-myapp-myservice.json`). This file:\n\n- Should be committed to version control for team collaboration\n- Contains resource metadata and identifiers\n- Is automatically updated after each successful operation\n\n### State Recovery\n\nIf you encounter state drift (cloud resources exist that aren't in your state file):\n\n1. **Manual import** - Currently, resources must be manually added to the state file\n2. **Clean start** - Delete the state file and resources in the cloud, then redeploy\n\n\u003e 💡 **Tip**: Always backup your state file before making manual modifications.\n\n---\n\n## 📘 Documentation\n\nFor comprehensive documentation, visit [serverlessinsight.geekfun.club](https://serverlessinsight.geekfun.club)\n\nAdditional resources:\n\n- [Quick Start Guide](https://serverlessinsight.geekfun.club)\n- [Configuration Reference](https://serverlessinsight.geekfun.club)\n- [API Documentation](https://serverlessinsight.geekfun.club)\n- [Best Practices](https://serverlessinsight.geekfun.club)\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions from the community! Here's how you can help:\n\n1. **Fork the repository**\n2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)\n3. **Commit your changes** (`git commit -m 'Add amazing feature'`)\n4. **Push to the branch** (`git push origin feature/amazing-feature`)\n5. **Open a Pull Request**\n\n---\n\n## 👥 Community\n\nJoin our community to get help, share ideas, and contribute:\n\n- **GitHub Issues** - [Report bugs or request features](https://github.com/geek-fun/serverlessinsight/issues)\n- **Website** - [serverlessinsight.geekfun.club](https://serverlessinsight.geekfun.club)\n\n---\n\n## 📄 License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## 🙏 Acknowledgments\n\nServerlessInsight is built with these amazing technologies:\n\n- [Node.js](https://nodejs.org/) - JavaScript runtime\n- [TypeScript](https://www.typescriptlang.org/) - Type-safe JavaScript\n- [Commander.js](https://github.com/tj/commander.js/) - CLI framework\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Made with ❤️ by the [geek-fun](https://github.com/geek-fun) team**\n\n[⬆ Back to Top](#serverlessinsight)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeek-fun%2Fserverlessinsight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeek-fun%2Fserverlessinsight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeek-fun%2Fserverlessinsight/lists"}