Top Related Projects
Telegram Desktop messaging app
Telegram web application, GPL v3
Experimental Telegram web client with tdlib, webassembly and react js under the hood
Telegram Web A, GPL v3
Source code of Telegram for macos on Swift 5.0
Quick Overview
Tweb is an open-source web client for Telegram, a popular messaging platform. It aims to provide a feature-rich, responsive, and user-friendly interface for accessing Telegram services through web browsers, offering an alternative to the official web client.
Pros
- Customizable and feature-rich interface
- Open-source, allowing for community contributions and improvements
- Responsive design, suitable for various devices and screen sizes
- Regular updates and active development
Cons
- May lack some features available in the official Telegram clients
- Potential for compatibility issues with future Telegram API changes
- Requires self-hosting for full control and customization
- Learning curve for developers unfamiliar with the project structure
Getting Started
To set up and run the Tweb project locally:
-
Clone the repository:
git clone https://github.com/morethanwords/tweb.git
-
Install dependencies:
cd tweb npm install
-
Create a
.env
file in the root directory and add your Telegram API credentials:API_ID=your_api_id API_HASH=your_api_hash
-
Start the development server:
npm run start
-
Open your browser and navigate to
http://localhost:8080
to access the Tweb client.
For more detailed instructions and configuration options, refer to the project's documentation on GitHub.
Competitor Comparisons
Telegram Desktop messaging app
Pros of tdesktop
- Native desktop application with better performance and system integration
- More comprehensive feature set, including voice calls and secret chats
- Supports a wider range of platforms, including Windows, macOS, and Linux
Cons of tdesktop
- Larger codebase and more complex architecture
- Slower development cycle and release frequency
- Higher resource usage compared to web-based alternatives
Code Comparison
tweb (JavaScript):
export function getHeavyAnimationPromise() {
return new Promise((resolve) => {
window.requestAnimationFrame(() => {
window.requestAnimationFrame(resolve);
});
});
}
tdesktop (C++):
QPixmap App::pixmapFromImageInPlace(QImage &&image) {
return QPixmap::fromImage(std::move(image), Qt::ColorOnly);
}
The tweb repository is a web-based Telegram client written in JavaScript, while tdesktop is a native desktop application written in C++. tweb offers a lighter, more accessible solution that can run in any modern web browser, making it easier to deploy and update. However, tdesktop provides a more robust and feature-rich experience with better performance for desktop users.
tweb's codebase is generally more concise and easier to understand for web developers, while tdesktop's C++ code allows for deeper system integration and optimization. The choice between the two depends on the specific use case and target platform.
Telegram web application, GPL v3
Pros of Webogram
- Longer development history and more established codebase
- Supports a wider range of legacy browsers and devices
- Simpler architecture, potentially easier for newcomers to understand
Cons of Webogram
- Less active development and fewer recent updates
- Older UI design that may feel less modern compared to Tweb
- Limited support for newer Telegram features
Code Comparison
Webogram (Angular.js):
$scope.openUser = function (userID) {
$rootScope.$broadcast('history_focus', {
peerString: AppUsersManager.getUserString(userID)
});
};
Tweb (TypeScript):
public openUser(userId: UserId) {
this.appUsersManager.openUser(userId).then(() => {
this.appChatsManager.selectTab(0);
});
}
Both projects aim to provide web-based Telegram clients, but Tweb is more modern and actively maintained. Webogram uses Angular.js, while Tweb is built with TypeScript and a custom framework. Tweb offers a more feature-rich experience with support for newer Telegram functionality, whereas Webogram may be more suitable for older devices or browsers. The code comparison shows differences in syntax and structure, reflecting the different technologies and approaches used in each project.
Experimental Telegram web client with tdlib, webassembly and react js under the hood
Pros of telegram-react
- Built with React, offering a familiar and widely-used framework for web developers
- Supports more platforms, including web browsers and desktop environments
- Potentially easier to contribute to for developers with React experience
Cons of telegram-react
- May have slower performance compared to tweb's custom framework
- Less optimized for mobile devices and touch interfaces
- Potentially larger bundle size due to React dependencies
Code Comparison
telegram-react:
const ChatInfo = ({ chatId, onClose }) => {
const chat = useChatStore(chatId);
return (
<div className="chat-info">
<h2>{chat.title}</h2>
<button onClick={onClose}>Close</button>
</div>
);
};
tweb:
export class ChatInfo extends Component<{chatId: number}> {
private chat = appChatsManager.getChat(this.props.chatId);
public render() {
return (
<div class="chat-info">
<h2>{this.chat.title}</h2>
<Button onClick={this.close}>Close</Button>
</div>
);
}
}
Both repositories aim to create web-based Telegram clients, but they differ in their approach and technology stack. tweb uses a custom framework optimized for performance and mobile devices, while telegram-react leverages the popular React ecosystem. The choice between them depends on specific project requirements and developer preferences.
Telegram Web A, GPL v3
Pros of telegram-tt
- More active development with frequent updates and commits
- Larger community with more contributors and forks
- Better documentation and project structure
Cons of telegram-tt
- Slightly larger codebase, potentially more complex to maintain
- Less focus on performance optimizations compared to tweb
- Fewer custom UI components, relying more on standard elements
Code Comparison
tweb:
export function wrapEmojiText(text: string) {
return text.replace(/[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/gu, (match) => {
return `<emoji>${match}</emoji>`;
});
}
telegram-tt:
function wrapEmoji(text) {
return text.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g, (match) => {
return `<span class="emoji">${match}</span>`;
});
}
Both projects implement emoji wrapping, but tweb uses TypeScript and custom tags, while telegram-tt uses JavaScript and spans with CSS classes.
Source code of Telegram for macos on Swift 5.0
Pros of TelegramSwift
- Native macOS and iOS app, providing better performance and integration with Apple platforms
- Written in Swift, offering type safety and modern language features
- Supports more platform-specific features and UI elements
Cons of TelegramSwift
- Limited to Apple platforms, reducing cross-platform compatibility
- Smaller community and potentially slower development compared to web-based alternatives
- May require more platform-specific knowledge for contributors
Code Comparison
TelegramSwift (Swift):
class ChatListController: GenericViewController<ChatListView> {
private let context: AccountContext
private let mode: ChatListControllerMode
init(context: AccountContext, mode: ChatListControllerMode) {
self.context = context
self.mode = mode
super.init(frame: .zero)
}
}
tweb (TypeScript):
export default class AppChatListsContainer extends AppChatListContainer {
constructor(
public tabs: ChatlistSlice[],
public onTabChange?: (index: number) => void
) {
super({
avatarSize: 54
});
}
}
The code snippets show different approaches to implementing chat list controllers. TelegramSwift uses Swift's class-based structure, while tweb utilizes TypeScript with a more web-oriented architecture. TelegramSwift's code is more focused on native app development, whereas tweb's code is tailored for web applications.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Telegram Web K
Based on Webogram, patched and improved. Available for everyone here: https://web.telegram.org/k/
Developing
Install dependencies with:
pnpm install
This will install all the needed dependencies.
Running web-server
Just run pnpm start
to start the web server and the livereload task.
Open http://localhost:8080/ in your browser.
Running in production
Run node build
to build the minimized production version of the app. Copy public
folder contents to your web server.
Dependencies
- BigInteger.js (Unlicense)
- pako (MIT License)
- cryptography (Apache License 2.0)
- emoji-data (MIT License)
- twemoji-parser (MIT License)
- rlottie (MIT License)
- fast-png (MIT License)
- opus-recorder (BSD License)
- Prism (MIT License)
- Solid (MIT License)
- TinyLD (MIT License)
- libwebp.js
- fastBlur
Debugging
You are welcome in helping to minimize the impact of bugs. There are classes, binded to global context. Look through the code for certain one and just get it by its name in developer tools. Source maps are included in production build for your convenience.
Additional query parameters
- test=1: to use test DCs
- debug=1: to enable additional logging
- noSharedWorker=1: to disable Shared Worker, can be useful for debugging
- http=1: to force the use of HTTPS transport when connecting to Telegram servers
Should be applied like that: http://localhost:8080/?test=1
Troubleshooting & Suggesting
If you find an issue with this app or wish something to be added, let Telegram know using the Suggestions Platform.
Licensing
The source code is licensed under GPL v3. License is available here.
Top Related Projects
Telegram Desktop messaging app
Telegram web application, GPL v3
Experimental Telegram web client with tdlib, webassembly and react js under the hood
Telegram Web A, GPL v3
Source code of Telegram for macos on Swift 5.0
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot