{"id":24561525,"url":"https://github.com/dstack-tee/dstack-examples","last_synced_at":"2026-05-20T10:01:22.767Z","repository":{"id":268620388,"uuid":"904954254","full_name":"Dstack-TEE/dstack-examples","owner":"Dstack-TEE","description":"examples and utilities of dstack applications","archived":false,"fork":false,"pushed_at":"2026-05-11T18:44:02.000Z","size":5305,"stargazers_count":24,"open_issues_count":21,"forks_count":24,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-05-11T20:35:10.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/Dstack-TEE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2024-12-17T21:46:07.000Z","updated_at":"2026-04-15T22:35:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"41be16e6-26f3-4f90-a559-3ba7152d6d4f","html_url":"https://github.com/Dstack-TEE/dstack-examples","commit_stats":null,"previous_names":["dstack-tee/dstack-examples"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Dstack-TEE/dstack-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dstack-TEE%2Fdstack-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dstack-TEE%2Fdstack-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dstack-TEE%2Fdstack-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dstack-TEE%2Fdstack-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dstack-TEE","download_url":"https://codeload.github.com/Dstack-TEE/dstack-examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dstack-TEE%2Fdstack-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33254765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-20T04:48:54.280Z","status":"ssl_error","status_checked_at":"2026-05-20T04:48:10.851Z","response_time":356,"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":[],"created_at":"2025-01-23T08:32:11.979Z","updated_at":"2026-05-20T10:01:22.679Z","avatar_url":"https://github.com/Dstack-TEE.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dstack Examples\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub Stars](https://img.shields.io/github/stars/Dstack-TEE/dstack?style=flat-square)](https://github.com/Dstack-TEE/dstack-examples/stargazers)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE)\n[![Telegram](https://img.shields.io/badge/Telegram-Community-blue?style=flat-square\u0026logo=telegram)](https://t.me/+UO4bS4jflr45YmUx)\n[![Documentation](https://img.shields.io/badge/Documentation-Phala%20Network-green?style=flat-square)](https://docs.phala.network/dstack)\n\n**Example applications for [dstack](https://github.com/Dstack-TEE/dstack) - Deploy containerized apps to TEEs with end-to-end security in minutes**\n\n[Getting Started](#getting-started) • [Confidential AI](#confidential-ai) • [Use Cases](#use-cases) • [Core Patterns](#core-patterns) • [Infrastructure](#infrastructure) • [Dev Tools](#dev-scaffolding) • [Starter Packs](#starter-packs) • [Other Use Cases](#other-use-cases)\n\n\u003c/div\u003e\n\n---\n\n## Overview\n\nThis repository contains ready-to-deploy examples demonstrating how to build and run applications on [dstack](https://github.com/Dstack-TEE/dstack), the developer-friendly SDK for deploying containerized apps in Trusted Execution Environments (TEE).\n\n## Getting Started\n\n### Prerequisites\n\n- Docker and Docker Compose\n- Node.js (for Phala CLI)\n- Git\n\n### Setup\n\n```bash\n# Clone the repo\ngit clone https://github.com/Dstack-TEE/dstack-examples.git\ncd dstack-examples\n\n# Install Phala CLI\nnpm install -g phala\n\n# Start the local simulator (no TEE hardware needed)\nphala simulator start\n```\n\n### Run an Example Locally\n\n```bash\ncd tutorial/01-attestation-oracle\ndocker compose run --rm \\\n  -v ~/.phala-cloud/simulator/0.5.3/dstack.sock:/var/run/dstack.sock \\\n  app\n```\n\n### Deploy to Phala Cloud\n\n```bash\nphala auth login\nphala deploy -n my-app -c docker-compose.yaml\n```\n\nSee [Phala Cloud](https://cloud.phala.network) for production TEE deployment.\n\n---\n\n## Confidential AI\n\nRun AI workloads where prompts, model weights, and inference stay encrypted in hardware.\n\n| Example | Description |\n|---------|-------------|\n| [confidential-ai/inference](./confidential-ai/inference) | Private LLM inference with vLLM on Confidential GPU |\n| [confidential-ai/training](./confidential-ai/training) | Confidential fine-tuning on sensitive data using Unsloth |\n| [confidential-ai/agents](./confidential-ai/agents) | Secure AI agent with TEE-derived wallet keys using LangChain and Confidential AI models |\n\nGPU deployments require: `--instance-type h200.small --region US-EAST-1 --image dstack-nvidia-dev-0.5.4.1`\n\nSee [Confidential AI Guide](https://github.com/Dstack-TEE/dstack/blob/master/docs/confidential-ai.md) for concepts and security model.\n\n---\n\n## Tutorials\n\nStep-by-step guides covering core dstack concepts.\n\n| Tutorial | Description |\n|----------|-------------|\n| [01-attestation-oracle](./tutorial/01-attestation-oracle) | Use the guest SDK to work with attestations directly — build an oracle, bind data to TDX quotes via `report_data`, verify with local scripts |\n| [02-persistence-and-kms](./tutorial/02-persistence-and-kms) | Use `getKey()` for deterministic key derivation from a KMS — persistent wallets, same key across restarts |\n| [03-gateway-and-ingress](./tutorial/03-gateway-and-ingress) | Custom domains with automatic SSL, certificate evidence chain |\n| [04-upgrades](./tutorial/04-upgrades) | Extend `AppAuth.sol` with custom authorization logic — NFT-gated clusters, on-chain governance |\n\n---\n\n## Use Cases\n\nReal-world applications you can build with dstack.\n\n| Example | Description | Status |\n|---------|-------------|--------|\n| [8004-agent](./8004-agent) | Trustless AI agent with on-chain attestation and LLM access | Coming Soon |\n| [oracle](./oracle) | TEE oracle returning JSON + signature + attestation bundle | Coming Soon |\n| [mcp-server](./mcp-server) | Attested MCP tool server behind gateway | Coming Soon |\n| [telegram-agent](./telegram-agent) | Telegram bot with TEE wallet and verified execution | Coming Soon |\n\n---\n\n## Core Patterns\n\nKey building blocks for dstack applications.\n\n### Attestation\n\nRequest TEE attestations via the SDK. Mount `/var/run/dstack.sock` in your compose file to access the TEE.\n\n```javascript\nimport { DstackClient } from '@phala/dstack-sdk'\nconst client = new DstackClient()\nconst info = await client.info()              // app_id, instance_id, tcb_info\nconst quote = await client.getQuote(data)     // TDX quote with custom report_data\nconst key = await client.getKey('/my/path')   // deterministic key derivation\n```\n\n```yaml\nvolumes:\n  - /var/run/dstack.sock:/var/run/dstack.sock\n```\n\n| Example | Description | Status |\n|---------|-------------|--------|\n| [timelock-nts](./timelock-nts) | Raw socket usage (what the SDK wraps) | Available |\n| [attestation/configid-based](./attestation/configid-based) | ConfigID-based verification | Available |\n\n### Gateway \u0026 Domains\n\nTLS termination, custom domains, external connectivity.\n\n| Example | Description |\n|---------|-------------|\n| [dstack-ingress](./custom-domain/dstack-ingress) | **Complete ingress solution** — auto SSL via Let's Encrypt, multi-domain, DNS validation, evidence generation with TDX quote chain |\n| [custom-domain](./custom-domain/custom-domain) | Simpler custom domain setup via zt-https |\n\n### Keys \u0026 Persistence\n\nPersistent keys across deployments via KMS.\n\n| Example | Description | Status |\n|---------|-------------|--------|\n| [get-key-basic](./get-key-basic) | `dstack.get_key()` — same key identity across machines | Coming Soon |\n\n### On-Chain Interaction\n\nLight client for reading chain state, anchoring outputs.\n\n| Example | Description |\n|---------|-------------|\n| [lightclient](./lightclient) | Ethereum light client (Helios) running in enclave |\n\n---\n\n## Dev Scaffolding\n\nDevelopment and debugging tools. **Not for production.**\n\n| Example | Description |\n|---------|-------------|\n| [webshell](./webshell) | Web-based shell access for debugging |\n| [ssh-over-gateway](./ssh-over-gateway) | SSH tunneling through dstack gateway |\n| [tcp-port-forwarding](./tcp-port-forwarding) | Arbitrary TCP port forwarding |\n\n---\n\n## Infrastructure\n\nRun infrastructure services inside TEEs.\n\n| Example | Description |\n|---------|-------------|\n| [k3s](./k3s) | Single-node k3s cluster in a TEE with wildcard HTTPS and remote kubectl |\n\n---\n\n## Tech Demos\n\nInteresting demonstrations.\n\n| Example | Description |\n|---------|-------------|\n| [tor-hidden-service](./tor-hidden-service) | Run Tor hidden services in TEEs |\n\n---\n\n## Starter Packs\n\nFull-stack templates with SDK integration. These demonstrate attestation, key derivation, and wallet generation.\n\n| Template | Stack | Link |\n|----------|-------|------|\n| **Next.js Starter** | Next.js + TypeScript | [phala-cloud-nextjs-starter](https://github.com/Phala-Network/phala-cloud-nextjs-starter) |\n| **Python Starter** | FastAPI + Python | [phala-cloud-python-starter](https://github.com/Phala-Network/phala-cloud-python-starter) |\n| **Bun Starter** | Bun + TypeScript | [phala-cloud-bun-starter](https://github.com/Phala-Network/phala-cloud-bun-starter) |\n| **Node.js Starter** | Express + TypeScript | [phala-cloud-node-starter](https://github.com/Gldywn/phala-cloud-node-starter) |\n\nFeatures: `/api/tdx_quote` (attestation), `/api/eth_account` (derived wallet), `/api/info` (TCB info)\n\n---\n\n## Other Use Cases\n\nExternal projects and templates worth exploring. These are maintained elsewhere but demonstrate interesting TEE patterns.\n\n| Project | Description | Link |\n|---------|-------------|------|\n| **Oracle Template** | Price aggregator with verifiable networking (hardened TLS) and multi-source validation | [Gldywn/phala-cloud-oracle-template](https://github.com/Gldywn/phala-cloud-oracle-template) |\n| **VRF Template** | Verifiable Random Function — hardware-backed cryptographic randomness | [Phala-Network/phala-cloud-vrf-template](https://github.com/Phala-Network/phala-cloud-vrf-template) |\n| **Open WebUI** | Self-hosted AI chat interface in TEE | [phala-cloud/templates/openwebui](https://github.com/Phala-Network/phala-cloud/tree/main/templates/prebuilt/openwebui) |\n| **n8n Automation** | Workflow automation (400+ integrations) with OAuth in TEE | [Marvin-Cypher/phala-n8n-template](https://github.com/Marvin-Cypher/phala-n8n-template) |\n| **Primus Attestor** | zkTLS node — TEE + zero-knowledge proofs | [primus-labs/primus-network-startup](https://github.com/primus-labs/primus-network-startup) |\n| **NEAR Shade Agent** | Blockchain oracle/agent for NEAR with TEE attestation | [phala-cloud/templates/near-shade-agent](https://github.com/Phala-Network/phala-cloud/tree/main/templates/prebuilt/near-shade-agent) |\n| **Presidio** | Microsoft's PII de-identification running in TEE | [HashWarlock/presidio](https://github.com/HashWarlock/presidio/tree/phala-cloud) |\n| **ByteBot** | AI desktop agent — computer control in isolated TEE sandbox | [phala-cloud/templates/bytebot](https://github.com/Phala-Network/phala-cloud/tree/main/templates/prebuilt/bytebot) |\n\n\u003e **Note**: These templates use pre-built Docker images. For full auditability, review their source repos before deployment.\n\nSee the full [Phala Cloud templates](https://github.com/Phala-Network/phala-cloud#templates) for more options.\n\n---\n\n## Details\n\nImplementation details and infrastructure patterns.\n\n| Example | Description |\n|---------|-------------|\n| [launcher](./launcher) | Generic launcher pattern for Docker Compose apps |\n| [prelaunch-script](./prelaunch-script) | Pre-launch script patterns (Phala Cloud) |\n| [private-docker-image-deployment](./private-docker-image-deployment) | Using private Docker registries |\n| [attestation/rtmr3-based](./attestation/rtmr3-based) | RTMR3-based attestation (legacy) |\n\n---\n\n## Documentation\n\n- **[dstack Documentation](https://docs.phala.network/dstack)** - Official platform documentation\n- **[Main Repository](https://github.com/Dstack-TEE/dstack)** - Core dstack framework\n- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute\n\n## Development\n\n```bash\n./dev.sh help              # Show available commands\n./dev.sh validate \u003cexample\u003e # Validate a specific example\n./dev.sh validate-all      # Validate all examples\n```\n\n## Community\n\n- **Telegram**: [Join our community](https://t.me/+UO4bS4jflr45YmUx)\n- **Issues**: [GitHub Issues](https://github.com/Dstack-TEE/dstack-examples/issues)\n\n## License\n\nApache 2.0 — see [LICENSE](LICENSE).\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**[⬆ Back to top](#dstack-examples)**\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstack-tee%2Fdstack-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdstack-tee%2Fdstack-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstack-tee%2Fdstack-examples/lists"}