Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/korynthian/chatroom/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through creating a free Supabase project, setting up the required database tables, wiring in your credentials, and serving kChat locally so you can start chatting straight away. No prior Supabase experience is needed, and you will not need to install Node.js, a bundler, or any other tooling — just a text editor and a way to serve static files.
1

Create a Supabase Project

  1. Go to supabase.com and sign up for a free account (or sign in if you already have one).
  2. Click New project, give it a name, choose a region close to you, and set a database password. Wait about a minute for the project to provision.
  3. Once the project is ready, open Project Settings → API. Note down two values — you will need them in a later step:
    • Project URL (looks like https://<your-project-ref>.supabase.co)
    • Publishable API key (listed under Project API keys as anon / public)
2

Create the Database Tables

In your Supabase project, open the SQL Editor (left sidebar) and run the following schema. This creates the three tables kChat depends on: rooms, messages, and profiles.
CREATE TABLE public.messages (
  id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
  room_id bigint NOT NULL DEFAULT '1'::bigint,
  username text NOT NULL DEFAULT 'secret'::text,
  content text NOT NULL,
  created_at timestamp with time zone NOT NULL DEFAULT now(),
  CONSTRAINT messages_pkey PRIMARY KEY (id),
  CONSTRAINT fk_room FOREIGN KEY (room_id) REFERENCES public.rooms(id)
);
CREATE TABLE public.profiles (
  id uuid NOT NULL,
  first_name text,
  last_name text,
  username text UNIQUE,
  CONSTRAINT profiles_pkey PRIMARY KEY (id),
  CONSTRAINT profiles_id_fkey FOREIGN KEY (id) REFERENCES auth.users(id)
);
CREATE TABLE public.rooms (
  id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
  name text NOT NULL,
  created_at timestamp with time zone NOT NULL DEFAULT now(),
  CONSTRAINT rooms_pkey PRIMARY KEY (id)
);
Click Run to execute the SQL. You should see a success message for each statement.
3

Create a Room

kChat’s index page lists whatever rows exist in the rooms table. Insert at least one room so you have something to chat in. Still in the SQL Editor, run:
INSERT INTO public.rooms (name) VALUES ('general');
You can add as many rooms as you like by repeating the insert with different names.
4

Configure kChat

Clone or download the kChat repository, then open both chat.js and indextablenames.js in your editor. At the top of each file you will find the three lines that initialise the Supabase client. Replace the placeholder URL and key with the values you copied in Step 1:
const supabaseUrl = 'YOUR_SUPABASE_URL';
const supabaseKey = 'YOUR_PUBLISHABLE_KEY';
const supabaseClient = supabase.createClient(supabaseUrl, supabaseKey);
Make the same change in both files — chat.js powers the chatroom page and indextablenames.js powers the room-list page, and each file initialises its own client.
5

Serve the Files

kChat is a static site, so any HTTP server will work. You cannot simply double-click index.html in a file browser because some browsers block local fetch requests made from file:// URLs; use a proper server instead.
python3 -m http.server 8080
Run either command from the root of the kChat directory (the folder that contains index.html).
6

Open kChat

Navigate to http://localhost:8080 in your browser.
  • On your first visit you will be prompted to enter a username. Type anything you like — it is saved to localStorage and reused automatically in future sessions.
  • The index page will display the room (or rooms) you inserted in Step 3. Click a room name to open it.
  • Type a message in the text input and press Enter to send it. New messages from other users appear automatically within one second.
Ready to share kChat with others? See the Self-Hosting guide for step-by-step instructions on deploying to GitHub Pages, Netlify, Vercel, or any other static web host.

Build docs developers (and LLMs) love