A lightweight, embeddable Matrix client built with pure HTML, CSS, and vanilla JavaScript. Features real-time messaging, file attachments, typing indicators, presence, and WebRTC voice/video calls.
- Pure Web Technologies: No frameworks, just HTML/CSS/JavaScript
- Matrix Protocol: Full integration with Matrix homeservers
- Direct Messaging: 1-to-1 conversations with real-time sync
- File Attachments: Support for images, documents, and audio files
- WebRTC Calls: Voice and video calls with Matrix signaling
- Presence & Typing: Real-time presence and typing indicators
- Responsive Design: Works on mobile, tablet, and desktop
- Light/Dark Theme: Toggle between light and dark modes
- Embeddable: Can be integrated into any web application
- Minimal Size: Total assets under 200KB
-
Clone or download the files to your local directory:
cd matrix-minimal -
Install the Matrix SDK:
npm install matrix-js-sdk
-
Start a local server:
npx serve .Or using Python:
python3 -m http.server 8000
-
Open in browser:
http://localhost:8000
To embed the Matrix client in your web application:
-
Include the files in your project:
<link rel="stylesheet" href="path/to/style.css"> <script src="https://unpkg.com/matrix-js-sdk@32.5.0/lib/browser-matrix.min.js"></script> <script src="path/to/utils.js"></script> <script src="path/to/matrix.js"></script> <script src="path/to/rtc.js"></script> <script src="path/to/app.js"></script>
-
Add the container HTML:
<div id="matrix-client" class="matrix-client"> <!-- The client will auto-initialize in this div --> </div>
-
Auto-initialization: The client automatically initializes when the DOM loads.
- Homeserver:
https://matrix.orconssystems.net - Theme: Auto-detects system preference (light/dark)
- No Persistence: Credentials are not stored (no localStorage)
You can customize the client by modifying:
- Colors: Edit CSS variables in
style.css - Homeserver: Change default in
index.html - Features: Enable/disable features in
app.js
- Enter your Matrix homeserver URL (defaults to matrix.orconssystems.net)
- Enter your full Matrix user ID (e.g., @user:server.com)
- Enter your password
- Click "Login"
- Click the "+" button in the Direct Messages section
- Enter the Matrix user ID you want to message
- Click "Start Chat"
- Begin messaging in real-time
- Click the attachment button (π) in the message input
- Select one or more files
- Files are uploaded and shared automatically
- Open a direct message conversation
- Click the voice (π) or video (πΉ) call button
- Allow camera/microphone access when prompted
- The other user will receive a call invitation
- Use the hang up button (β) to end calls
- Click the theme toggle button (π) to switch between light and dark modes
- The setting persists for the current session
matrix-minimal/
βββ index.html # Main HTML structure and UI components
βββ style.css # Responsive CSS with light/dark theme support
βββ app.js # Main application logic and event handling
βββ matrix.js # Matrix protocol integration and messaging
βββ rtc.js # WebRTC implementation for voice/video calls
βββ utils.js # Helper functions and utilities
βββ package.json # Dependencies and scripts
βββ README.md # This documentation
- ES6+ JavaScript support
- WebRTC for voice/video calls
- MediaDevices API for camera/microphone access
- Modern CSS (CSS Grid, Flexbox, CSS Variables)
- Chrome 70+
- Firefox 65+
- Safari 12+
- Edge 79+
- Responsive design works on all screen sizes
- Touch-friendly interface
- Mobile camera/microphone access
- Passwords are not stored locally
- No localStorage or sessionStorage usage
- Must login each session for security
- WebRTC calls require HTTPS in production
- Microphone/camera access requires secure context
- Matrix homeservers typically use HTTPS
- All user input is HTML-escaped
- File uploads go through Matrix content repository
- XSS protection throughout the application
The client uses the official matrix-js-sdk for all Matrix protocol interactions:
- Authentication and session management
- Real-time event synchronization
- Message sending and receiving
- File upload and download
- Presence and typing indicators
Native WebRTC APIs are used for voice/video calls:
- getUserMedia for local media access
- RTCPeerConnection for peer connections
- Matrix events for call signaling
- STUN servers for NAT traversal
To extend the client:
- New UI Components: Add HTML structure and CSS styling
- Event Handling: Add event listeners in
app.js - Matrix Integration: Extend
MatrixManagerclass inmatrix.js - WebRTC Features: Extend
WebRTCManagerclass inrtc.js - Utilities: Add helper functions to
utils.js
- Use modern ES6+ JavaScript features
- Follow consistent naming conventions
- Add comprehensive comments for complex logic
- Handle errors gracefully with user feedback
- Maintain responsive design principles
Test the client with:
- Different Matrix homeservers
- Various file types and sizes
- Multiple browsers and devices
- Network conditions (slow, offline)
- WebRTC capabilities
Login Failed
- Verify homeserver URL is correct
- Check username format (@user:server.com)
- Ensure password is correct
- Check network connectivity
Camera/Microphone Not Working
- Allow permissions when prompted
- Use HTTPS for security requirements
- Check device availability
- Verify browser WebRTC support
Messages Not Syncing
- Check internet connection
- Verify Matrix homeserver is online
- Clear browser cache and retry
- Check browser console for errors
File Upload Failed
- Check file size limits
- Verify file type support
- Ensure stable internet connection
- Check Matrix homeserver upload limits
Check the browser console for detailed error messages and debugging information. The client logs all major operations and errors.
To contribute to the Matrix Minimal Client:
- Fork the project
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Please ensure your code follows the existing style and includes appropriate comments.
MIT License - see LICENSE file for details.
For issues and questions:
- Check the browser console for errors
- Review this documentation
- Test with different Matrix homeservers
- Verify WebRTC browser support
- Initial release
- Core Matrix messaging functionality
- WebRTC voice/video calls
- File attachment support
- Responsive design with light/dark themes
- Direct message management
- Real-time presence and typing indicators