# How to Vibe Code Your Own Nabu Casa (and Stop Paying for It)

> Home Assistant Cloud and official hardware for the open smart home

- Site: https://nabucasa.com
- Category: Smart Home / IoT Infrastructure
- Verdict: **Serious undertaking** (35/100 vibecodeable)
- Estimated effort: 4-6 weeks of systems and networking work

## Verdict

Build a personal subset for remote tunneling and backups, but keep paying for the real service. The hardest subsystem—building a globally secure, encrypted zero-config reverse proxy infrastructure that handles persistent WebSockets alongside third-party Alexa/Google OAuth bridges—requires deep systems networking engineering.

You can spin up a Next.js subscription billing wrapper and an R2 backup bucket in a weekend, but replicating Nabu Casa's core value requires running a globally distributed proxy network (such as WireGuard or Tailscale-like infrastructure) that routes encrypted TCP/WebSocket traffic into a local Home Assistant instance behind residential firewalls. Furthermore, dealing with Alexa and Google Assistant OAuth account linking and webhook payload translation involves immense boilerplate and strict developer console approvals. For $6.50/mo, paying for the official service directly funds open-source home automation development and spares you endless networking debugging.

### What you can't replicate

- Native integration baked directly into the Home Assistant core codebase by default
- Certified developer relationships and pre-approved skill publishing pipelines with Amazon Alexa and Google Assistant
- Global low-latency edge relay infrastructure running 24/7 with enterprise uptime guarantees
- Direct support for the Open Home Foundation and core open-source developers

## What it does

Nabu Casa provides managed cloud services for Home Assistant, including secure remote access tunneling, cloud backup and restore, voice assistant integrations (Alexa/Google and local Nabu voice), and official hardware sales.

### Core features

- Encrypted TCP/WebSocket reverse proxy tunneling from local home server to cloud
- OAuth account linking and payload translation for Amazon Alexa and Google Assistant smart home APIs
- Automated encrypted configuration and database backup storage with S3/R2
- Webhooks endpoint management and routing
- Billing subscription lifecycle via Stripe/PayPal
- User license verification token exchange with Home Assistant core integrations

## The business

### Pricing

- Home Assistant Cloud (US): $6.50/mo or $65.00/yr
- Home Assistant Cloud (EU/UK): €7.50/mo / £6.50/mo

Founded 2018.
Team size: 15-20+.

## The hard parts

- Building a globally distributed, low-latency secure NAT-traversal tunneling infrastructure that handles thousands of persistent WebSocket connections without dropping frames or compromising end-to-end encryption
- Implementing bidirectional protocol translation between external third-party voice cloud agents (Alexa Smart Home Skill API, Google Actions) and internal Home Assistant WebSocket schemas
- Maintaining zero-knowledge encryption guarantees so the cloud proxy cannot inspect or decrypt sensitive home automation telemetry payloads

## How to vibe code Nabu Casa

### Prerequisites

- Node.js (free): Required for running the Next.js control panel and API routes.
- Fly.io account (free): Required for deploying persistent Docker-based TCP proxy servers across global regions.
- Cloudflare account (free): Used for hosting the static web dashboard on Pages and storing encrypted backups in R2.
- GitHub (free): Repository hosting and CI/CD deployment pipelines.

### Recommended AI tools

- Claude Code: Best-in-class agentic coding tool for scaffolding full-stack apps, database schemas, and networking configuration scripts.
- Cursor: Ideal for fine-tuning frontend dashboard components and reviewing multi-file diffs.

### Stack

- Frontend: Next.js
- Backend: Node.js / Express with raw TCP sockets on Fly.io
- Database: Turso (SQLite at the edge)
- Auth: better-auth
- Payments: Stripe
- Other: Cloudflare R2 for encrypted backups, Tailscale/WireGuard protocol primitives for tunneling

### Hosting

- Vercel (Hosting the Next.js user dashboard and customer billing portal): $0/mo (Hobby tier)
- Fly.io (Running the persistent global TCP/WebSocket proxy tunnel server nodes): ~$5/mo
- Cloudflare (Storing user backup archives in R2 object storage): $0/mo

### Build guide

1. **Scaffold Next.js Dashboard and Database Schema** — Initialize a Next.js project with Tailwind CSS and configure Turso with better-auth for user management, subscription state tracking, and device token generation.

```
Scaffold a new Next.js 16 project using TypeScript, App Router, and Tailwind CSS. Integrate better-auth with Turso (libSQL) to handle user accounts, password authentication, and a subscription status table (fields: id, userId, active, expiresAt, licenseKey). Create a user dashboard page that displays account status, generated Home Assistant long-lived access token mappings, and a button to register a new tunnel instance.
```

2. **Build the Encrypted TCP Tunnel Server** — Deploy a Go or Node.js WebSocket/TCP proxy server on Fly.io that accepts persistent inbound connections from local home servers and routes authenticated external web traffic.

```
Write a lightweight TCP/WebSocket proxy server in Node.js (or Go) designed to run on Fly.io. The server must listen for incoming client connections from local Home Assistant instances using a unique bearer token. When an external HTTP request arrives at [subdomain].yourdomain.com, the proxy server must forward the payload securely over the established persistent WebSocket tunnel to the local home server, wrap all data in TLS encryption, handle reconnection drops gracefully, and return the response to the external caller without logging payload contents.
```

3. **Implement Encrypted Cloud Backups via Cloudflare R2** — Create backend API endpoints that receive gzipped configuration archives from Home Assistant, encrypt them with user-specific keys, and store them securely in Cloudflare R2.

```
Implement API routes in Next.js that receive encrypted backup archives (.tar.gz) from Home Assistant instances. Validate the user's active subscription token via the Turso database, stream the incoming archive payload directly into a Cloudflare R2 bucket with server-side encryption, and maintain a metadata table tracking backup timestamps, file sizes, and checksums. Include a restore endpoint that streams the encrypted archive back to the authenticated instance.
```

4. **Build Billing and Subscription Lifecycle with Stripe** — Integrate Stripe webhooks and checkout sessions to automate monthly and annual subscription provisioning and license key generation.

```
Set up Stripe checkout integration for monthly ($6.50) and annual ($65.00) subscription tiers. Implement a webhook handler endpoint in Next.js that listens for 'checkout.session.completed' and 'invoice.payment_succeeded' events. Upon successful payment, automatically provision or extend the user's active license in the Turso database, generate a unique Home Assistant cloud connection token, and handle subscription cancellations or payment failures by revoking tunnel access.
```

5. **Create Home Assistant Client Integration Module** — Write a Python integration snippet that runs inside Home Assistant to authenticate with your custom cloud backend, establish the persistent tunnel, and upload scheduled backups.

```
Write a Python custom component script for Home Assistant that communicates with your custom cloud backend. The script must authenticate using the user's license key, establish a secure persistent WebSocket connection to your Fly.io proxy server to route incoming remote requests, and implement a scheduled weekly background job that packages the /config directory into a tarball, encrypts it locally, and uploads it to your Next.js backup endpoint.
```

### Cost vs paying

**Starting costs (one-time):**

- Custom domain name: $12/yr
- Total: ~$12 one-time

**Ongoing costs (monthly):**

- Fly.io proxy server VM: $5/mo
- Cloudflare R2 storage: $0/mo
- Total: ~$5/mo

- Paying for the SaaS instead: $6.50/mo
- Build time: 40-60 hours
- AI tool credits: $20 (Claude Pro)
- Break-even: Not economically viable (built solely for learning systems networking)

## Sources

- [Nabu Casa Official Website](https://nabucasa.com)
- [Nabu Casa Pricing Page](https://nabucasa.com/pricing)
- [Nabu Casa About Us Page](https://nabucasa.com/about)