feat(matrix): add SvelteKit Matrix client (Phase 1)

Implements a minimal self-hosted Matrix chat client with:
- matrix-js-sdk integration with Svelte 5 runes store
- Password login with homeserver discovery
- Room list (DMs and groups) with unread counts
- Message timeline with typing indicators
- Send messages with Enter key
- Responsive chat UI with Tailwind CSS

Project structure:
- apps/matrix/apps/web: SvelteKit client (port 5180)
- apps/matrix/packages/shared: Shared types

Commands: pnpm dev:matrix:web

https://claude.ai/code/session_01RUrt2qN1D3nVh9HcGpwoby
This commit is contained in:
Claude 2026-01-28 20:21:13 +00:00
parent bea066c7f8
commit 4e622a66de
No known key found for this signature in database
36 changed files with 2453 additions and 0 deletions

View file

@ -0,0 +1,2 @@
// Re-export all types
export * from './types';

View file

@ -0,0 +1,42 @@
/**
* Shared types for Matrix client
*/
export type SyncState = 'STOPPED' | 'PREPARED' | 'SYNCING' | 'ERROR' | 'RECONNECTING' | 'CATCHUP';
export interface MatrixCredentials {
homeserver: string;
accessToken: string;
userId: string;
deviceId: string;
}
export type MessageType = 'm.text' | 'm.image' | 'm.file' | 'm.audio' | 'm.video' | 'm.emote' | 'm.notice';
export interface SimpleMessage {
id: string;
sender: string;
senderName: string;
body: string;
formattedBody?: string;
timestamp: number;
type: MessageType;
isOwn: boolean;
replyTo?: string;
edited?: boolean;
}
export interface SimpleRoom {
id: string;
name: string;
topic?: string;
avatar?: string;
lastMessage?: string;
lastMessageSender?: string;
lastMessageTime?: number;
unreadCount: number;
highlightCount: number;
isDirect: boolean;
isEncrypted: boolean;
memberCount: number;
}