tinykit

repository·main·Indexed 19 days ago

https://github.com/tinykit-studio/tinykit

An open-source agentic app builder and AI development platform for building and deploying web applications. tinykit manages the full stack, including code, deployment, and a PocketBase database, allowing users to focus on prompting and design. It supports deployment via Docker, Railway, and Fly.io, and features domain-based routing to host multiple AI-generated apps on a single server.

Tokens
19.8K
Snippets
76
Records
93
Agent score
66%

What's inside tinykit

  1. Choose a deployment option for tinykit

    main
    tinykit can be deployed to any Node.js host. The recommended approach for the Alpha phase is using Railway for its ease of use and managed infrastructure. If you require full control or already own a VPS, Docker is the universal option for self-hosting on providers like DigitalOcean, AWS, Azure, or GCP.
  2. Configure Persistent Storage Volumes

    main

    Railway services are ephemeral. You must configure volumes to ensure your database and user projects are not lost on restart.

    Required Volumes

    1. Pocketbase Data

      • Mount Path: /app/pocketbase/pb_data
      • Purpose: Stores database, auth, and uploaded files.
      • Recommended Size: 1GB (Minimum 500MB; 5GB+ if handling many file uploads).
    2. Workspace

      • Mount Path: /app/workspace
      • Purpose: Stores source code and compiled HTML output. Note: node_modules are NOT stored here.
      • Recommended Size: 1GB (Minimum 500MB; 2GB+ for heavy use).
  3. Understand Tinykit domain-based routing and access points

    main

    Tinykit uses domain-based routing, allowing you to host multiple apps on a single server by pointing different domains to it. Each domain serves a specific app at the root path, while the Tinykit management tools are accessed via specific sub-paths.

    Routing Example

    • calculator.myserver.com/ → Serves the calculator app
    • calculator.myserver.com/tinykit/studio → Opens the editor for the calculator app

    URL Access Points

    URLDescription
    /Your production app
    /tinykit/studioEdit the app associated with the current domain
    /tinykit/dashboardView all hosted apps
    /tinykit/settingsConfigure LLM settings
  4. Run Tinykit locally using Node.js

    main

    To run Tinykit directly with Node.js, clone the repository, install dependencies via npm, and run the development script. The dev server will automatically download PocketBase. After starting, visit http://localhost:5173/setup to complete the initial configuration.

    # Clone and install
    git clone https://github.com/tinykit-studio/tinykit.git
    cd tinykit
    npm install
    
    # Start dev server (auto-downloads PocketBase)
    npm run dev
  5. Deploy Tinykit to Railway

    main

    The fastest way to deploy Tinykit is using the one-click Railway deployment. This requires no manual configuration. Once deployed, you can configure your LLM directly from the application interface or by adding your API key as an environment variable.

    [![Deploy on Railway](https://railway.app/button.svg)](https://railway.com/deploy/tinykit?referralCode=RCPU7k&utm_medium=integration&utm_source=template&utm_campaign=generic)
  6. Quick Start with Docker Compose

    main

    To get a local instance of tinykit running quickly using Docker Compose, follow these steps:

    1. Clone the repository and enter the directory.
    2. Create your .env file from the example and add your LLM_API_KEY.
    3. Navigate to the docker deployment directory and start the containers.

    Once running, the App is available at http://localhost:3000 and the Builder at http://localhost:3000/tinykit.

    # 1. Clone the repository
    git clone https://github.com/tinykit-studio/tinykit.git
    cd tinykit
    
    # 2. Set environment variables
    cp .env.example .env
    # Edit .env and add your LLM_API_KEY
    
    # 3. Run with Docker Compose
    cd deploy/docker
    docker-compose up -d
  7. Deploy to Fly.io

    main

    Deploy tinykit to Fly.io using the provided Dockerfile. You will need to install flyctl, launch the app, and set your LLM configuration as secrets.

    # Install flyctl
    curl -L https://fly.io/install.sh | sh
    
    # Launch app
    fly launch --dockerfile deploy/docker/Dockerfile
    
    # Set secrets
    fly secrets set LLM_API_KEY=sk-your-key
    fly secrets set LLM_PROVIDER=openai
    fly secrets set LLM_MODEL=gpt-4
    
    # Deploy
    fly deploy
  8. Manual Docker Build and Run

    main

    If you prefer not to use Docker Compose, you can manually build and run the tinykit image. You must provide the required LLM environment variables and mount volumes for data persistence.

    # Build image
    docker build -f deploy/docker/Dockerfile -t crud-one .
    
    # Run container
    docker run -d \
      -p 3000:3000 \
      -e LLM_PROVIDER=openai \
      -e LLM_API_KEY=sk-your-key \
      -e LLM_MODEL=gpt-4 \
      -v crud_pb_data:/app/pocketbase/pb_data \
      -v crud_workspace:/app/workspace \
      --name crud-one \
      crud-one
  9. Run Tinykit locally using Docker

    main

    To run Tinykit locally with Docker, clone the repository, navigate to the docker deployment directory, and use docker-compose. This will start Tinykit on port 5173. After starting, visit http://localhost:5173/setup to complete the initial configuration.

    git clone https://github.com/tinykit-studio/tinykit.git
    cd tinykit/deploy/docker
    docker-compose up -d
  10. Deploy tinykit to Railway via GitHub

    main

    The recommended way to deploy is by connecting your GitHub repository to Railway. Railway will automatically detect the configuration from railway.toml.

    1. Push to GitHub: Ensure your latest code is pushed to your repository.
    2. Create Railway Project: In the Railway dashboard, select 'New Project' and 'Deploy from GitHub repo'.
    3. Add Persistent Volumes (CRITICAL): Because Railway services are ephemeral, you must mount volumes to prevent data loss. Add two volumes in the 'Variables' tab:
      • Pocketbase Data: Mount path /app/pocketbase/pb_data. Size: 1GB recommended (500MB min, 5GB+ for heavy file uploads).
      • Workspace: Mount path /app/workspace. Size: 1GB recommended (500MB min, 2GB+ for heavy use).
    4. Configure Environment Variables: Add your AI provider details and server configuration (see Environment Variables Reference).
    5. Deploy: Wait for the build to complete (~2-3 minutes).
    git add .
    git commit -m "Prepare for Railway deployment"
    git push origin master