• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
loading

loading

matrix

simple matrix client
Public
Like
matrix
Home
Code
4
backend
1
frontend
3
shared
2
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/29/2025
Viewing readonly version of main branch: v67
View latest version
README.md

Matrix Client

A beautiful web-based Matrix client built with React and TailwindCSS featuring dark mode support.

Features

  • Connect to any Matrix homeserver
  • Login with username/password
  • View and join rooms
  • Send and receive messages
  • Real-time message updates
  • Beautiful dark/light mode toggle
  • Responsive design with improved UI
  • Enhanced message display with better grouping
  • Smooth animations and transitions

Project Structure

β”œβ”€β”€ backend/
β”‚   └── index.ts             # Proxy server for Matrix API (CORS handling)
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ App.tsx          # Main application component
β”‚   β”‚   β”œβ”€β”€ Login.tsx        # Login form
β”‚   β”‚   β”œβ”€β”€ RoomList.tsx     # List of joined rooms
β”‚   β”‚   β”œβ”€β”€ ChatView.tsx     # Chat interface
β”‚   β”‚   β”œβ”€β”€ MessageList.tsx  # Message display
β”‚   β”‚   └── MessageInput.tsx # Message composition
β”‚   β”œβ”€β”€ index.html           # Main HTML template
β”‚   └── index.tsx            # Frontend entry point
β”œβ”€β”€ shared/
β”‚   └── types.ts             # Shared TypeScript types
└── README.md

Usage

  1. Open the application
  2. Enter your Matrix homeserver URL (e.g., https://matrix.org)
  3. Login with your Matrix credentials
  4. Browse rooms and start chatting!

Features Implemented

  • βœ… End-to-End Encryption: Basic message encryption support with visual indicators
  • βœ… Encryption Detection: Automatically detects encrypted rooms and shows status
  • βœ… Visual Security Indicators: Lock icons and encryption badges throughout the UI
  • βœ… Encrypted Message Handling: Decrypt incoming messages and encrypt outgoing ones
  • βœ… Fallback Support: Graceful degradation when encryption is unavailable
  • βœ… Enhanced Dark/Light Mode: Intelligent theme system with system preference detection
  • βœ… Smooth Theme Transitions: Beautiful animated icon transitions and smooth color changes
  • βœ… No Flash Loading: Theme applied before page render to prevent white flash
  • βœ… System Integration: Automatically follows system dark/light mode preference
  • βœ… Persistent Preferences: Remembers manual theme selection across sessions
  • βœ… Responsive Design: Works perfectly on desktop and mobile
  • βœ… Enhanced Login: Gradient background with improved form styling
  • βœ… Tabbed Interface: Separate tabs for public rooms and direct messages
  • βœ… Private Messages: Full support for direct message conversations
  • βœ… Smart Room Detection: Automatically categorizes rooms vs DMs
  • βœ… Advanced Chat View: Enhanced message bubbles with better grouping
  • βœ… Smart Message Display: Date separators and time grouping
  • βœ… Fixed Input Box: No more scrolling issues, proper auto-resize
  • βœ… Duplicate Prevention: Smart filtering to prevent message repetition
  • βœ… Real-time Sync: Live message updates with optimized polling
  • βœ… Session Persistence: Automatic login restoration
  • βœ… Error Handling: Comprehensive error states with retry options
  • βœ… Optimistic Sending: Messages appear instantly with proper fallback
  • βœ… Smooth Animations: CSS transitions and message animations
  • βœ… Custom Scrollbars: Styled for both light and dark modes

Technical Details

  • Backend: Hono-based proxy server to handle CORS issues with Matrix homeservers
  • Frontend: React SPA with TailwindCSS for styling
  • Real-time: Polling-based sync for new messages
  • Storage: LocalStorage for session persistence
  • API: Matrix Client-Server API v1.0
  • Encryption: Simplified end-to-end encryption using Web Crypto API (demonstration purposes)

Encryption Implementation

The encryption system is now a working simplified implementation for demonstration purposes.

How it works:

  • Only encrypts messages sent by our client (prefixed with MATRIX_ENCRYPTED:)
  • Uses Web Crypto API with AES-GCM encryption
  • Generates room-specific encryption keys
  • Automatically detects and decrypts our own encrypted messages
  • Leaves other messages (from other clients) as plaintext
  • Visual indicators show which messages are encrypted

Key Features:

  • βœ… Working encryption/decryption for messages sent by this client
  • βœ… Visual feedback with lock icons and status indicators
  • βœ… Debug tools to test encryption functionality
  • βœ… Graceful fallback when encryption fails
  • βœ… Room-specific keys for better security

Testing Encryption:

  1. Join an encrypted room (shows green "Encrypted" badge)
  2. Send a message - it will be encrypted before sending to Matrix
  3. Your encrypted messages show a lock icon
  4. Use the debug button (πŸ”) in encrypted rooms to test encryption
  5. Check browser console for detailed encryption logs

Production Considerations:

  • This is a demonstration only - use official Matrix SDK for production
  • Real Matrix encryption uses Olm/Megolm protocols
  • Proper key verification and device management needed
  • Cross-signing and key backup required for production use
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2026 Val Town, Inc.