Kamui Platform Kamui Platform Docs
EN JA

Databases

Kamui Platform 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
DATABASE_URL PostgreSQL connection URL (complete connection string)
DATABASE_HOST Hostname
DATABASE_PORT Port number (usually 5432)
DATABASE_NAME Database name
DATABASE_USER Username
DATABASE_PASSWORD Password

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
creating Being created
running Running normally
stopped 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.

// ❌ Creating connection per request
const client = new Client({ connectionString: process.env.DATABASE_URL });
await client.connect();

// ✅ Using connection pool
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const result = await pool.query('SELECT * FROM users');

Set Connection Timeouts

Idle connections may be timed out. Implement retry logic.

Don't Use Production Data in Development

For security, don't use production database credentials in development environments.

Next Steps