This guide is for developers who want to contribute to Mezon, build integrations, or understand the technical architecture.
- Prerequisites
- Getting Started
- Architecture Overview
- Development Setup
- Project Structure
- Development Workflow
- Testing
- Contributing
- API Documentation
- Troubleshooting
Before you begin development, ensure you have the following installed:
- Node.js 18.17.0 or higher
- Yarn 1.22.17 or higher
- Git Bash (for Windows users)
- Nx CLI: Install globally with
npm install --global nx@latest
git clone https://github.com/mezonai/mezon.git
cd mezonyarn installCreate a .env file in the apps/chat directory with the necessary environment variables.
yarn dev:chatThe application will be available at http://localhost:4200/
Mezon uses a monorepo architecture managed by Nx, providing efficient code sharing and build optimization.
Located in the apps directory:
- chat: Main chat application (React)
- admin: Administration panel
- desktop: Electron desktop wrapper
Located in the libs directory:
- ui: Stateless UI components
- components: Stateful smart components
- core: Core business logic
- transports: Server communication layer (mezon-js)
- store: Redux state management
- assets: Shared assets
- logger: Logging utilities
- utils: Utility functions
✅ Allowed Dependencies:
apps←libslibs←libscomponents←uicomponents←storestore←transportsstore←utils
❌ Forbidden Dependencies:
apps←appslibs←appsui←componentsstore←componentstransports←store- Cross-platform lib dependencies
# Linting
yarn lint
yarn lint:fix
# Formatting
yarn format
yarn format:fix# Build chat application
nx build chat
# Build all projects
nx run-many --target=build --allVisualize project dependencies:
npx nx graphMezon follows Redux one-way data flow pattern:
- Single Source of Truth: All application state in Redux store
- Unidirectional Data Flow: Actions → Reducers → State → UI
- Immutable Updates: State is never mutated directly
Key components:
- mezon-js: WebSocket and REST API communication
- Redux Store: State management with slices
- React Router: Application routing
- Custom Hooks: Encapsulated business logic
Follow the guidelines in STYLE_GUIDE.md. Key principles:
- One purpose per component
- Smart and dumb component separation
- Compute data first, avoid inline callbacks
- Use TypeScript for type safety
- Follow ESLint and Prettier configurations
# Run tests
yarn test
# Run tests in watch mode
yarn test:watch
# Generate coverage report
yarn test:coverageMezon provides comprehensive APIs for building integrations:
- Authentication and user management
- Channel and message operations
- File uploads and media handling
- Real-time messaging
- Presence updates
- Voice/video signaling
- Event-driven architecture
- Rich messaging capabilities
- Custom commands and interactions
See full API documentation at https://mezon.ai/docs/api
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Provide clear description of changes
- Include screenshots for UI changes
- Ensure all tests pass
- Follow coding standards
- Update documentation as needed
- Build and package:
nx build desktop - Run with debugging:
./dist/executables/win-unpacked/mezon.exe --remote-debugging-port=8315 - Open Chrome:
chrome://inspect - Configure and add
localhost:8315 - Click "inspect" to open DevTools
Module not found errors
- Run
yarn installto ensure all dependencies are installed - Check import paths and tsconfig paths
Build failures
- Clear cache:
nx reset - Rebuild:
nx build <project> --skip-nx-cache
Type errors
- Run
yarn typecheckto identify issues - Ensure TypeScript version matches project requirements
Key factors affecting performance:
- Routing structure and re-renders
- Memoization with
memoanduseMemo - Memory leak prevention with cleanup functions
- Function reference stability with
useCallback - API call caching and memoization
Managed through the policies slice:
- Permission-based component rendering
UserRestrictionZonecomponentuseUserRestrictionhook
- Slices: Modular state organization
- Selectors: Efficient state access
- Async Thunks: API integration
- RTK Query: Data fetching and caching
For non-technical information about Mezon, please refer to the main README.md.


