|  | 
|  | 1 | +--- | 
|  | 2 | +title: "Introduction" | 
|  | 3 | +description: "Overview and quick start to run Kan on your own infrastructure using Docker Compose." | 
|  | 4 | +mode: "wide" | 
|  | 5 | +tag: "NEW" | 
|  | 6 | +--- | 
|  | 7 | + | 
|  | 8 | +This guide introduces how to self-host Kan. It starts with the minimal Docker Compose setup (web + PostgreSQL) and points you to optional features like email and S3-based file storage. | 
|  | 9 | + | 
|  | 10 | +## What you’ll set up | 
|  | 11 | + | 
|  | 12 | +<CardGroup cols={2}> | 
|  | 13 | +  <Card title="Kan" icon="globe" color="#0284c7" horizontal> | 
|  | 14 | +    Next.js application served on port 3000. | 
|  | 15 | +  </Card> | 
|  | 16 | +  <Card title="PostgreSQL 15" icon="database" color="#65a30d" horizontal> | 
|  | 17 | +    Primary database for Kan data. | 
|  | 18 | +  </Card> | 
|  | 19 | +</CardGroup> | 
|  | 20 | + | 
|  | 21 | +<Note> | 
|  | 22 | +  For file uploads (avatars), OAuth, and other advanced options, see the | 
|  | 23 | +  Environment Variables section in the README and the dedicated [S3 | 
|  | 24 | +  guide](/guides/self-hosting/s3). The [full | 
|  | 25 | +  compose](https://github.com/kanbn/kan/blob/main/docker-compose.yml) in the | 
|  | 26 | +  repo includes a richer configuration via <code>.env</code>. | 
|  | 27 | +</Note> | 
|  | 28 | + | 
|  | 29 | +## Prerequisites | 
|  | 30 | + | 
|  | 31 | +- Docker and Docker Compose | 
|  | 32 | +- A long random string for <code>BETTER_AUTH_SECRET</code> (32+ chars) | 
|  | 33 | + | 
|  | 34 | +## Quick start | 
|  | 35 | + | 
|  | 36 | +<Steps> | 
|  | 37 | +  <Step title="Create a docker-compose.yml"> | 
|  | 38 | +    Paste the following minimal configuration into a new <code>docker-compose.yml</code> file: | 
|  | 39 | + | 
|  | 40 | +    ```yaml | 
|  | 41 | +    services: | 
|  | 42 | +      web: | 
|  | 43 | +        image: ghcr.io/kanbn/kan:latest | 
|  | 44 | +        container_name: kan-web | 
|  | 45 | +        ports: | 
|  | 46 | +          - "3000:3000" | 
|  | 47 | +        networks: | 
|  | 48 | +          - kan-network | 
|  | 49 | +        environment: | 
|  | 50 | +          NEXT_PUBLIC_BASE_URL: http://localhost:3000 | 
|  | 51 | +          BETTER_AUTH_SECRET: your_auth_secret | 
|  | 52 | +          POSTGRES_URL: postgresql://kan:your_postgres_password@postgres:5432/kan_db | 
|  | 53 | +          NEXT_PUBLIC_ALLOW_CREDENTIALS: true | 
|  | 54 | +        depends_on: | 
|  | 55 | +          - postgres | 
|  | 56 | +        restart: unless-stopped | 
|  | 57 | + | 
|  | 58 | +      postgres: | 
|  | 59 | +        image: postgres:15 | 
|  | 60 | +        container_name: kan-db | 
|  | 61 | +        environment: | 
|  | 62 | +          POSTGRES_DB: kan_db | 
|  | 63 | +          POSTGRES_USER: kan | 
|  | 64 | +          POSTGRES_PASSWORD: your_postgres_password | 
|  | 65 | +        ports: | 
|  | 66 | +          - 5432:5432 | 
|  | 67 | +        volumes: | 
|  | 68 | +          - kan_postgres_data:/var/lib/postgresql/data | 
|  | 69 | +        restart: unless-stopped | 
|  | 70 | +        networks: | 
|  | 71 | +          - kan-network | 
|  | 72 | + | 
|  | 73 | +    networks: | 
|  | 74 | +      kan-network: | 
|  | 75 | + | 
|  | 76 | +    volumes: | 
|  | 77 | +      kan_postgres_data: | 
|  | 78 | +    ``` | 
|  | 79 | +
 | 
|  | 80 | +    <Tip> | 
|  | 81 | +      The example above is intentionally minimal. The repository provides a more feature-complete compose file at [docker-compose.yml](https://github.com/kanbn/kan/blob/main/docker-compose.yml) if you want environment-based configuration, OAuth, S3, and more. | 
|  | 82 | +    </Tip> | 
|  | 83 | +
 | 
|  | 84 | +  </Step> | 
|  | 85 | +
 | 
|  | 86 | +  <Step title="Start the stack"> | 
|  | 87 | +    Bring everything up in detached mode: | 
|  | 88 | +
 | 
|  | 89 | +    ```bash | 
|  | 90 | +    docker compose up -d | 
|  | 91 | +    ``` | 
|  | 92 | + | 
|  | 93 | +    Once started, open [http://localhost:3000](http://localhost:3000). | 
|  | 94 | + | 
|  | 95 | +  </Step> | 
|  | 96 | + | 
|  | 97 | +  <Step title="Manage the containers"> | 
|  | 98 | +    Useful commands while developing or testing: | 
|  | 99 | + | 
|  | 100 | +    - Stop the containers: <code>docker compose down</code> | 
|  | 101 | +    - View logs: <code>docker compose logs -f</code> | 
|  | 102 | +    - Restart: <code>docker compose restart</code> | 
|  | 103 | + | 
|  | 104 | +  </Step> | 
|  | 105 | + | 
|  | 106 | +  <Step title="Configure environment (optional)"> | 
|  | 107 | +    For a production-like setup and more features (email, OAuth, file uploads, etc.), create a <code>.env</code> file and set the relevant variables shown in the README’s Environment Variables section. | 
|  | 108 | + | 
|  | 109 | +    <Accordion title="Common variables"> | 
|  | 110 | +      ```bash | 
|  | 111 | +      # Required | 
|  | 112 | +      NEXT_PUBLIC_BASE_URL=http://localhost:3000 | 
|  | 113 | +      BETTER_AUTH_SECRET=replace_with_long_random_string | 
|  | 114 | +      POSTGRES_URL=postgresql://kan:your_postgres_password@postgres:5432/kan_db | 
|  | 115 | + | 
|  | 116 | +      # Optional: Email | 
|  | 117 | +      EMAIL_FROM="Kan <hello@mail.kan.bn>" | 
|  | 118 | +      SMTP_HOST=smtp.resend.com | 
|  | 119 | +      SMTP_PORT=465 | 
|  | 120 | +      SMTP_USER=resend | 
|  | 121 | +      SMTP_PASSWORD=re_xxxx | 
|  | 122 | +      SMTP_SECURE=true | 
|  | 123 | + | 
|  | 124 | +      # Optional: Auth toggles | 
|  | 125 | +      NEXT_PUBLIC_ALLOW_CREDENTIALS=true | 
|  | 126 | +      NEXT_PUBLIC_DISABLE_SIGN_UP=false | 
|  | 127 | +      ``` | 
|  | 128 | + | 
|  | 129 | +      <Note type="warning"> | 
|  | 130 | +        If you plan to enable file uploads (avatars, etc.), you’ll also need S3 variables (<code>S3_ENDPOINT</code>, <code>S3_ACCESS_KEY_ID</code>, <code>S3_SECRET_ACCESS_KEY</code>, <code>NEXT_PUBLIC_STORAGE_URL</code>, <code>NEXT_PUBLIC_STORAGE_DOMAIN</code>, …). See the S3 guide linked at the top. | 
|  | 131 | +      </Note> | 
|  | 132 | +    </Accordion> | 
|  | 133 | + | 
|  | 134 | +  </Step> | 
|  | 135 | +</Steps> | 
|  | 136 | + | 
|  | 137 | +## Reference | 
|  | 138 | + | 
|  | 139 | +- [GitHub README](https://github.com/kanbn/kan/blob/main/README.md#self-hosting-) | 
|  | 140 | +- [GitHub docker-compose.yml](https://github.com/kanbn/kan/blob/main/docker-compose.yml) | 
0 commit comments