KamuiDash KamuiDash Docs
EN JA

Databases

KamuiDash lets you easily create and manage PostgreSQL databases.

Supported Databases

Currently, only PostgreSQL is supported.

Creating a Database

  1. In the project detail screen, click "New Database"
  2. Enter the following information:
Field Description Example
Database Name Identifier name main-db
Spec Resource size Nano / Small / Medium / Large
  1. Click "Create"

Database creation may take a few minutes. It's available once the status shows "running".

Connecting from Applications

Automatic Environment Variable Injection

When you select a database while creating an application, the following environment variables are automatically set:

Environment Variable Description
DB_HOST Hostname
DB_PORT Port number (usually 5432)
DB_NAME Database name
DB_USER Username
DB_PASSWORD Password
DATABASE_URL Full connection string: postgresql://user:password@host:port/dbname

Use DATABASE_URL for a single connection string. Individual variables (DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD) are also available if your library requires them separately.

Connection Examples

Node.js (pg library)

const { Pool } = require('pg');

const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
});

const result = await pool.query('SELECT NOW()');
console.log(result.rows[0]);

Go

import (
    "database/sql"
    "os"
    _ "github.com/lib/pq"
)

db, err := sql.Open("postgres", os.Getenv("DATABASE_URL"))
if err != nil {
    log.Fatal(err)
}

Python

import os
import psycopg2

conn = psycopg2.connect(os.environ['DATABASE_URL'])
cursor = conn.cursor()
cursor.execute('SELECT NOW()')
print(cursor.fetchone())

Viewing Connection Information

  1. Open the database detail screen
  2. Check the "Connection Info" section for:
  3. Connection URL
  4. Host
  5. Port
  6. Username
  7. Password (click the show button)

Security Note: Keep your password secure.

Database Status

Status Description
success Running normally
stop Stopped
error Error occurred

Editing a Database

  1. Click the "Settings" tab in the database detail screen
  2. Editable fields:
  3. Spec (resource size)
  4. Click "Save"

Note: Changing the spec will restart the database.

Deleting a Database

  1. Click the "Settings" tab in the database detail screen
  2. Click "Delete Database"
  3. Enter the database name in the confirmation dialog
  4. Click "Delete"

Warning: Deleting a database will permanently delete all data. This action cannot be undone. We recommend backing up before deletion.

Best Practices

Use Connection Pooling

Don't keep database connections open. Use connection pools instead.

// Bad: Creating connection per request
const client = new Client({
  host: process.env.DB_HOST,
  port: parseInt(process.env.DB_PORT),
  database: process.env.DB_NAME,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
});
await client.connect();

// Good: Using connection pool
const pool = new Pool({
  host: process.env.DB_HOST,
  port: parseInt(process.env.DB_PORT),
  database: process.env.DB_NAME,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
});
const result = await pool.query('SELECT * FROM users');

Next Steps