# Terminal Shop — Coffee Subscription Over SSH > SST team's coffee subscription you order via SSH terminal. Audacious demo of how far serverless TypeScript + a terminal UI takes a real business. ## Install Copy the content below into your project: ## Quick Use 1. `ssh terminal.shop` — order coffee, see the TUI in action 2. Read `github.com/terminaldotshop/terminal` source 3. Use their `sst.config.ts` as a template for your own SST + Stripe app --- ## Intro Terminal Shop is a working coffee subscription business that you place orders for by SSH-ing into the shop — `ssh terminal.shop` literally drops you into a TUI checkout. Built by the SST team as proof that serverless TypeScript + Bun + Stripe + a creative TUI can ship a real consumer business. Read the source to see how SST's primitives compose in production. Best for: founders looking for a wild SST reference architecture, devs curious about terminal-as-storefront UX, anyone who wants coffee. Works with: any SSH client. Read time: 30 minutes for the source code tour. --- ### Try it now ```bash ssh terminal.shop ``` That's the whole onboarding. The TUI handles product browsing, cart, payment via Stripe, and shipping address — all over SSH. ### What it teaches about SST 1. **SSH as a frontend.** Custom SSH server in TypeScript using `ssh2` + Bun, routed through Cloudflare. Demonstrates that SST + TS is general enough to host non-HTTP protocols. 2. **Stripe Connect integration.** Real money flows; Stripe webhooks update SST DynamoDB tables. 3. **Edge auth.** Cloudflare Worker validates SSH key fingerprints against the user table before terminating to the SST backend. 4. **Audit + observability.** Every TUI key event logs to CloudWatch via SST's `Realtime` primitive. ### Source code highlights ```typescript // packages/functions/src/ssh-server.ts import { Server } from "ssh2"; import { handleSession } from "./session"; const server = new Server({ hostKeys: [process.env.HOST_KEY!], }, (client) => { client.on("authentication", (ctx) => ctx.accept()); client.on("session", (accept) => handleSession(accept())); }); server.listen(2222, "0.0.0.0"); ``` ### Why founders should read it It's a 5-figure-revenue business that ships from one repo with under 2,000 lines of glue code. Whatever you think your MVP needs, Terminal Shop probably ships it with less. Studying the SST infrastructure file (`sst.config.ts`) is the most useful 10 minutes you'll spend learning SST. ### Replicate this for your project ```typescript // sst.config.ts (skeleton from Terminal Shop) export default $config({ app(input) { return { name: "my-shop", removal: input?.stage === "production" ? "retain" : "remove", home: "aws", providers: { cloudflare: true, stripe: true }, }; }, async run() { const products = new sst.aws.Dynamo("Products", { fields: { id: "string" }, primaryIndex: { hashKey: "id" } }); const checkout = new sst.aws.Function("Checkout", { link: [products], handler: "src/checkout.handler" }); return { checkoutUrl: checkout.url }; }, }); ``` --- ### FAQ **Q: Is the whole source actually public?** A: Yes — github.com/terminaldotshop/terminal. They open-source the full stack including SST config, SSH server, TUI components, Stripe webhooks. Great reading material. **Q: Could I copy this exact pattern?** A: Yes for the SST/Stripe/Cloudflare stack. The SSH-as-storefront UX is unusual — works because the audience self-selects (devs who SSH for fun). Replicating SSH retail without a tech-savvy audience won't move the needle. **Q: How much does it actually cost to run?** A: AWS bills under $100/mo at their volume thanks to serverless + DynamoDB scaling. Most cost is Stripe fees + actual coffee + shipping. The infra footprint is famously small for the revenue. --- ## Source & Thanks > Built by [Terminal](https://github.com/terminaldotshop) (SST team side project). Source open. > > [terminaldotshop/terminal](https://github.com/terminaldotshop/terminal) — ⭐ 2,000+ --- ## 快速使用 1. `ssh terminal.shop` —— 下单咖啡,看 TUI 真跑 2. 读 `github.com/terminaldotshop/terminal` 源码 3. 用他们的 `sst.config.ts` 当自己 SST + Stripe app 模板 --- ## 简介 Terminal Shop 是个真在卖咖啡订阅的电商业务 —— 通过 SSH 下单:`ssh terminal.shop` 把你直接送进 TUI 结账。SST 团队建造,证明 serverless TypeScript + Bun + Stripe + 创意 TUI 可以做真实消费业务。读源码看 SST 的 primitive 在生产怎么组合。适合找 SST 极端参考架构的创始人、好奇「终端做店面」UX 的开发者、想喝咖啡的人。任何 SSH 客户端可用。读源码时长 30 分钟。 --- ### 现在就试 ```bash ssh terminal.shop ``` 整个上手流程就这一行。TUI 处理浏览商品、购物车、Stripe 支付、收货地址 —— 全在 SSH 里。 ### 它教 SST 什么 1. **SSH 当前端。** TypeScript 自定义 SSH server,用 `ssh2` + Bun,通过 Cloudflare 路由。证明 SST + TS 足够通用,可以承载非 HTTP 协议。 2. **Stripe Connect 集成。** 真钱在流动;Stripe webhook 更新 SST DynamoDB 表。 3. **边缘鉴权。** Cloudflare Worker 在转给 SST 后端之前对 SSH key 指纹校验用户表。 4. **审计 + 观测。** 每个 TUI 按键事件通过 SST 的 `Realtime` primitive 入 CloudWatch。 ### 源码亮点 ```typescript // packages/functions/src/ssh-server.ts import { Server } from "ssh2"; import { handleSession } from "./session"; const server = new Server({ hostKeys: [process.env.HOST_KEY!], }, (client) => { client.on("authentication", (ctx) => ctx.accept()); client.on("session", (accept) => handleSession(accept())); }); server.listen(2222, "0.0.0.0"); ``` ### 创始人为啥应该读它 这是个五位数收入的真实业务,单仓库 <2,000 行胶水代码就发布上线。无论你以为 MVP 需要什么,Terminal Shop 大概率用更少东西就发了。研究 SST 基建文件(`sst.config.ts`)是学 SST 最有用的 10 分钟。 ### 复制到你自己的项目 ```typescript // sst.config.ts(Terminal Shop 骨架) export default $config({ app(input) { return { name: "my-shop", removal: input?.stage === "production" ? "retain" : "remove", home: "aws", providers: { cloudflare: true, stripe: true }, }; }, async run() { const products = new sst.aws.Dynamo("Products", { fields: { id: "string" }, primaryIndex: { hashKey: "id" } }); const checkout = new sst.aws.Function("Checkout", { link: [products], handler: "src/checkout.handler" }); return { checkoutUrl: checkout.url }; }, }); ``` --- ### FAQ **Q: 整个源码真公开吗?** A: 公开 —— github.com/terminaldotshop/terminal。整套栈包括 SST 配置、SSH server、TUI 组件、Stripe webhook 都开源。绝佳阅读材料。 **Q: 能照搬这模式吗?** A: SST/Stripe/Cloudflare 栈能。SSH 当店面 UX 很特别 —— 受众自选(爱玩 SSH 的开发者)让它成立。没有技术受众的话 SSH 零售不会起量。 **Q: 跑下来实际多少钱?** A: AWS 账单在他们的量级下 <$100/月,靠 serverless + DynamoDB 扩缩。大部分成本是 Stripe 费 + 真咖啡 + 邮费。基建占用相比营收出名地小。 --- ## 来源与感谢 > Built by [Terminal](https://github.com/terminaldotshop) (SST team side project). Source open. > > [terminaldotshop/terminal](https://github.com/terminaldotshop/terminal) — ⭐ 2,000+ --- Source: https://tokrepo.com/en/workflows/terminal-shop-coffee-subscription-over-ssh Author: SST