### Verify Tako installation Source: https://tako.sh/docs/quickstart Checks that the Tako CLI is installed and accessible. ```bash tako --version ``` -------------------------------- ### Install vips for image optimization on macOS Source: https://tako.sh/docs/quickstart Required only if you install Tako another way and use image optimization locally on macOS. ```bash brew install vips ``` -------------------------------- ### Initialize and deploy with Tako Source: https://tako.sh/blog/image-optimization-for-tanstack-start-apps/ Run `tako init` to detect the app and offer the `tanstack-start` preset, then `tako deploy` to deploy. The server installer also installs libvips for image optimization. ```bash tako init tako deploy ``` -------------------------------- ### Install and register Tako server Source: https://tako.sh/blog/how-to-host-wildcard-subdomains-with-automatic-https-on-a-vps/ Quick setup commands to install Tako and register a server. Run these on the VPS before deploying wildcard subdomains. ```bash curl -fsSL https://tako.sh/install.sh | sh sudo sh -c "$(curl -fsSL https://tako.sh/install-server.sh)" tako servers add prod.example-tailnet.ts.net --name prod ``` -------------------------------- ### Install Echo with go get Source: https://tako.sh/blog/how-to-deploy-a-go-gin-echo-or-chi-app-to-a-vps-without-docker/ Command to install the Echo framework v4 package. ```bash go get github.com/labstack/echo/v4 ``` -------------------------------- ### Install and run tako dev Source: https://tako.sh/blog/local-dev-with-real-https/ Commands to install tako via Homebrew and start the development server in a project. ```bash brew install takoserver/tap/tako cd your-project tako dev ``` -------------------------------- ### Install Chi with go get Source: https://tako.sh/blog/how-to-deploy-a-go-gin-echo-or-chi-app-to-a-vps-without-docker/ Command to install the Chi router v5 package. ```bash go get github.com/go-chi/chi/v5 ``` -------------------------------- ### Initialize Go module and install dependencies for Gin app Source: https://tako.sh/blog/how-to-deploy-a-go-gin-echo-or-chi-app-to-a-vps-without-docker/ Commands to create a Go module, install the Gin framework, and install the Tako SDK. ```bash mkdir gin-on-tako cd gin-on-tako go mod init example.com/gin-on-tako go get github.com/gin-gonic/gin go get tako.sh ``` -------------------------------- ### Register a server with tako servers add Source: https://tako.sh/blog/deploy-tanstack-start-to-a-vps-in-five-minutes/ Registers a server for deployment. Replace `ubuntu` with your admin SSH user and `prod` with the server's Tailscale MagicDNS name. The admin-user form can install or repair the server. ```bash tako servers add ubuntu@prod ``` -------------------------------- ### Install Tako CLI and initialize project Source: https://tako.sh/blog/how-to-deploy-a-vite-ssr-app-to-a-vps-without-docker/ Run these commands to install the Tako CLI and initialize the project. The install script is fetched from tako.sh and then `tako init` sets up the project. ```bash curl -fsSL https://tako.sh/install.sh | sh tako init ``` -------------------------------- ### Install Tako server and add server Source: https://tako.sh/blog/full-stack-nextjs-app-one-5-vps-https-jobs-websockets-images/ Install the Tako server once and add a server to the tailnet. The first command downloads and runs the install script; the second adds the server by its tailnet address. ```bash sudo sh -c "$(curl -fsSL https://tako.sh/install-server.sh)" tako servers add prod-a.tailnet.ts.net --install ``` -------------------------------- ### Add a server by MagicDNS name Source: https://tako.sh/docs/quickstart Adds a remote server using its Tailscale MagicDNS name. The admin-user@host form tells Tako which admin SSH user to use if install or repair is needed. ```bash tako servers add admin-user@my-server ``` -------------------------------- ### Install Tako CLI on laptop Source: https://tako.sh/blog/how-to-deploy-a-bun-hono-app-to-a-vps-without-docker/ Installs the Tako CLI on your local machine. Run this on your laptop before proceeding. ```bash curl -fsSL https://tako.sh/install.sh | sh ``` -------------------------------- ### Install and deploy Tako with shell commands Source: https://tako.sh/blog/hello-world/ Commands to install Tako, initialize a project, and deploy. Requires a Linux server and a tako.toml configuration file. ```bash curl -fsSL https://tako.sh/install.sh | sh tako init tako deploy ``` -------------------------------- ### Vite plugin configuration for TanStack Start Source: https://tako.sh/docs/framework-guides Install the Tako Vite plugin so the build emits the SSR wrapper. This is used for TanStack Start and other Vite SSR frameworks. ```javascript import { defineConfig } from "vite";import { tako } from "tako.sh/vite";export default defineConfig({ plugins: [tako()],}); ``` -------------------------------- ### Run tako init Source: https://tako.sh/blog/deploy-tanstack-start-to-a-vps-in-five-minutes/ Initializes Tako configuration. It detects Bun and the TanStack Start preset, and generates a configuration file. Keep any runtime version pin generated by init in the `runtime` field. ```bash tako init ``` -------------------------------- ### Install and deploy with Tako CLI Source: https://tako.sh/blog/self-hosted-nextjs-image-optimization-vps/ Run these commands to install the Tako SDK, initialize the project, and deploy to the VPS. The `tako init` command sets up the configuration, and `tako deploy` deploys the app. ```bash bun add tako.sh tako init tako deploy ``` -------------------------------- ### Initialize a new Tako project Source: https://tako.sh/blog/the-go-sdk-is-here/ Creates a new directory and runs 'tako init'. Tako detects Go from go.mod, installs the tako.sh module, and scaffolds the project. ```bash mkdir my-app && cd my-app tako init ``` -------------------------------- ### Scaffold the app with TanStack CLI Source: https://tako.sh/blog/deploy-tanstack-start-to-a-vps-in-five-minutes/ Creates a new TanStack Start app and navigates into its directory. Choose Bun as the package manager when prompted, though Node also works. ```bash npx @tanstack/cli@latest create my-app cd my-app ``` -------------------------------- ### tako.toml for TanStack Start preset Source: https://tako.sh/docs/framework-guides Set the runtime and preset in tako.toml. The tanstack-start preset sets main, assets, and dev automatically. ```toml runtime = "bun"preset = "tanstack-start" ``` -------------------------------- ### Example .test URL output Source: https://tako.sh/blog/how-to-deploy-a-go-gin-echo-or-chi-app-to-a-vps-without-docker/ Example output showing the local HTTPS URL for the app, useful for testing cookies, OAuth callbacks, and browser APIs. ```text https://gin-on-tako.test/ ``` -------------------------------- ### Next.js config with withTako Source: https://tako.sh/docs/framework-guides Wrap your Next config with the Tako helper. This enables standalone output, installs the adapter, and generates the entry file. ```javascript import { withTako } from "tako.sh/nextjs";export default withTako({}); ``` -------------------------------- ### Run tako dev and see the output Source: https://tako.sh/blog/local-dev-with-real-https/ Shows the command to start the development server and the expected output, including the URL and available commands (r, b, ctrl+c). ```bash $ tako dev ✓ dev daemon running ✓ local CA trusted ✓ routes ready https://myapp.test/ r restart · b background · ctrl+c stop ``` -------------------------------- ### Next.js Image component with Tako optimizer Source: https://tako.sh/docs/framework-guides Example of using next/image with Tako's public optimizer. withTako() configures next/image to use Tako's optimizer globally. ```jsx import Image from "next/image";export function Hero() { return ( Hero );} ``` -------------------------------- ### Start or attach to a dev session with tako dev Source: https://tako.sh/docs/cli Starts or attaches to a local dev session behind trusted HTTPS and real hostnames. --variant foo uses a variant hostname such as myapp-foo.test; --restart restarts the process with the current config instead of attaching. It starts the dev daemon, prepares DNS/proxy/CA setup, generates files, injects secrets and storage through fd 3, waits for fd-4 readiness, and registers routes. ```bash tako dev ``` ```bash tako dev vite dev ``` ```bash tako dev --variant preview ``` ```bash tako dev --var preview ``` ```bash tako dev --tunnel ``` ```bash tako dev --restart ``` -------------------------------- ### Using imageUrl for a single URL Source: https://tako.sh/blog/image-optimization-for-tanstack-start-apps/ Use imageUrl from tako.sh when you need exactly one URL, such as for an avatar image. This example generates a URL for a 640px wide image. ```tsx import { imageUrl } from "tako.sh"; const avatar = imageUrl("/avatars/u_123.png", { width: 640, }); ``` -------------------------------- ### Multi-server environment configuration in tako.toml Source: https://tako.sh/blog/self-hosted-websockets-workflows-multiple-vps-postgres/ Example `tako.toml` configuration for a multi-server environment with routes and servers. This is the starting point for setting up shared Postgres runtime state. ```toml runtime = "bun" preset = "nextjs" app_root = "." [envs.production] routes = ["app.example.com"] servers = ["lax", "nrt", "fra"] ``` -------------------------------- ### Install Tako SDK with bun Source: https://tako.sh/blog/full-stack-nextjs-app-one-5-vps-https-jobs-websockets-images/ Install the Tako SDK using bun. This is the first step to enable Tako's Next.js integration. ```bash bun add tako.sh ``` -------------------------------- ### Install Tako and start a tunnel with tako dev --tunnel Source: https://tako.sh/blog/open-source-ngrok-alternative-local-https-dev-tunnels/ Install Tako via Homebrew, then run your app with `tako dev --tunnel` to enable tunnel mode. Inside an interactive session, press `t` to toggle the tunnel. Use `tako dev list` to see registered apps and tunnel URLs. ```bash brew install takoserver/tap/tako cd your-project tako dev --tunnel ``` -------------------------------- ### Deploy with tako deploy Source: https://tako.sh/blog/deploy-tanstack-start-to-a-vps-in-five-minutes/ Deploys the app to the configured server. Follow any deployment prompts, then open the URL for your configured domain. ```bash tako deploy ``` -------------------------------- ### Generated URL for constrained image Source: https://tako.sh/blog/image-optimization-for-tanstack-start-apps/ The imageSrcSet function returns URLs that point to Tako's reserved public endpoint. This example shows the URL format for a constrained 1200px image. ```text /_tako/image?src=/images/product-hero.jpg&w=1200 ``` -------------------------------- ### Tako app configuration with routes Source: https://tako.sh/blog/cloudflare-pingora-architecture-diagram/ Example tako.toml configuration for an app named 'docs' using the Bun runtime, with production routes and servers. The routes include a path-prefixed route and an exact hostname. ```toml name = "docs" runtime = "bun" [envs.production] routes = [ "example.com/docs/*", "docs.example.com" ] servers = ["prod"] ```