• 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
1
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: v82
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

  • ✅ 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.