kChat’s data model is made up of three Postgres tables managed in Supabase: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.
rooms, messages, and profiles. The rooms table holds the available chat channels, messages stores every chat message linked to a room, and profiles is reserved for future user account features tied to Supabase Auth. All three tables live in the public schema and are accessed directly by the Supabase JavaScript client running in the browser.
rooms
The rooms table represents each available chat channel. The index page queries this table to render the list of rooms a user can join, ordered by created_at ascending.
Auto-generated primary key. Assigned automatically by Postgres
GENERATED ALWAYS AS IDENTITY.The display name of the room. Shown on the index page and in the chat header.
Timestamp when the room was created. Defaults to
now(). Rooms are listed ordered by this field ascending.messages
The messages table stores every chat message sent across all rooms. chat.js queries this table filtered by room_id and ordered by created_at ascending to display the conversation, and polls for new messages every second.
Auto-generated primary key.
Foreign key referencing
rooms.id. Defaults to 1. Identifies which room this message belongs to.Display name of the sender. Sourced from
localStorage.username. Defaults to 'secret'.The message body.
Timestamp when the message was inserted. Defaults to
now(). Used for ordering messages chronologically.profiles
The profiles table stores optional user profile information linked to Supabase Auth identities. Each row’s id corresponds to a row in the auth.users table managed by Supabase.
Primary key. References
auth.users(id) from Supabase Auth.Optional first name.
Optional last name.
Unique username for the user. Optional.
The
profiles table is defined for future user account features and is not actively used in the current UI. The app currently sources the sender’s display name from localStorage.username, set via a browser prompt on first visit.Relationships
kChat’s schema has two foreign key relationships:messages.room_id→rooms.id: Every message belongs to a room. Thefk_roomconstraint enforces referential integrity, preventing messages from being inserted with aroom_idthat doesn’t correspond to an existing room.profiles.id→auth.users.id: Theprofiles_id_fkeyconstraint ties each profile row to a Supabase Auth user. This relationship is defined for future authentication integration and is not yet exercised by the current UI.
Full SQL schema
Full SQL schema
Full SQL schema