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 K, GPL v3
Telegram-iOS
Cross-platform library for building Telegram clients
Quick Overview
Telegram-tt is an alternative web client for Telegram, built with React and TypeScript. It aims to provide a fast, feature-rich, and customizable experience for Telegram users directly in their web browsers.
Pros
- Built with modern web technologies (React, TypeScript) for improved performance and maintainability
- Offers a customizable user interface with various themes and settings
- Supports most Telegram features, including voice and video calls
- Open-source, allowing for community contributions and transparency
Cons
- May not always be in sync with the latest official Telegram features
- Requires users to trust a third-party client with their Telegram account
- Potential for bugs or security issues not present in the official client
- Limited support compared to official Telegram clients
Getting Started
To run telegram-tt locally:
-
Clone the repository:
git clone https://github.com/Ajaxy/telegram-tt.git
-
Install dependencies:
cd telegram-tt npm install
-
Create a
.env
file in the root directory and add your Telegram API credentials:TELEGRAM_API_ID=your_api_id TELEGRAM_API_HASH=your_api_hash
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:1234
to use the client.
Competitor Comparisons
Telegram Desktop messaging app
Pros of tdesktop
- Official Telegram desktop client with full feature support
- Native performance and integration with desktop operating systems
- Larger community and more frequent updates
Cons of tdesktop
- Heavier resource usage due to native implementation
- Steeper learning curve for contributors due to C++ codebase
Code Comparison
telegram-tt (JavaScript):
const handleMessage = (message) => {
if (message.type === 'text') {
renderTextMessage(message);
} else if (message.type === 'photo') {
renderPhotoMessage(message);
}
};
tdesktop (C++):
void handleMessage(const Message &message) {
if (message.type() == MessageType::Text) {
renderTextMessage(message);
} else if (message.type() == MessageType::Photo) {
renderPhotoMessage(message);
}
}
Summary
telegram-tt is a web-based Telegram client written in JavaScript, offering cross-platform compatibility and easier contribution for web developers. tdesktop, on the other hand, is the official native desktop client with full feature support and better performance on desktop systems. While telegram-tt may be more accessible for web developers, tdesktop provides a more integrated desktop experience with potentially better performance for resource-intensive tasks.
Telegram web application, GPL v3
Pros of webogram
- Longer development history and more established codebase
- Supports a wider range of browsers, including older versions
- Simpler architecture, potentially easier for newcomers to understand
Cons of webogram
- Less frequent updates and maintenance
- Older technology stack, which may not leverage modern web capabilities
- Potentially slower performance due to older architecture
Code Comparison
webogram:
function TelegramApiModule(api, serverConfig) {
var options = {dcID: 2, createNetworker: true}
var networkerFactory = new NetworkerFactory(api.invokeNetworker)
var networker = networkerFactory.getNetworker(dcID, options)
// ...
}
telegram-tt:
class ApiClient {
private dcId: number;
private networker: Networker;
constructor(dcId: number) {
this.dcId = dcId;
this.networker = new Networker(dcId);
}
// ...
}
The code comparison shows that telegram-tt uses TypeScript and a more modern class-based approach, while webogram uses older JavaScript patterns. telegram-tt's code appears more structured and type-safe, which can lead to better maintainability and fewer runtime errors.
Experimental Telegram web client with tdlib, webassembly and react js under the hood
Pros of telegram-react
- Built with React, offering a more familiar ecosystem for many web developers
- Potentially easier to contribute to for developers with React experience
- May have better performance for complex UI updates due to React's virtual DOM
Cons of telegram-react
- Less actively maintained, with fewer recent updates compared to telegram-tt
- May have a steeper learning curve for developers not familiar with React
- Potentially larger bundle size due to React dependencies
Code Comparison
telegram-react:
class MessageStore extends EventEmitter {
constructor() {
super();
this.reset();
this.addTdLibListener();
}
// ...
}
telegram-tt:
class MessagesStore {
private messagesById = new Map<number, ApiMessage>();
private localMessages = new Map<string, ApiMessage>();
private threadsById = new Map<number, Thread>();
// ...
}
The code snippets show different approaches to message storage. telegram-react uses an event-based system with EventEmitter, while telegram-tt employs TypeScript with more explicit type definitions and data structures.
Both repositories aim to create web-based Telegram clients, but they differ in their tech stacks and implementation details. The choice between them may depend on the developer's familiarity with React or TypeScript, as well as the specific project requirements.
Telegram Web K, GPL v3
Pros of tweb
- More active development with frequent updates and commits
- Larger community with more contributors and stars on GitHub
- Supports a wider range of Telegram features and customization options
Cons of tweb
- Steeper learning curve due to more complex codebase
- Potentially higher resource usage due to additional features
- May have more bugs or instability due to rapid development
Code Comparison
tweb (TypeScript):
export function getHeavyAnimationPromise() {
return new Promise<void>((resolve) => {
if(liteMode.isAvailable('animations')) {
return resolve();
}
setTimeout(resolve, 500);
});
}
telegram-tt (JavaScript):
export function pause(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
The code snippets demonstrate different approaches to handling animations and timing. tweb uses a more sophisticated method considering lite mode settings, while telegram-tt employs a simpler pause function.
Both projects aim to provide web-based Telegram clients, but tweb offers more features and active development at the cost of increased complexity. telegram-tt may be easier to understand and modify for developers new to the project.
Telegram-iOS
Pros of Telegram-iOS
- Native iOS development using Swift, providing better performance and integration with iOS features
- Official repository maintained by Telegram, ensuring up-to-date features and security updates
- Extensive documentation and well-structured codebase for easier contribution and understanding
Cons of Telegram-iOS
- Limited to iOS platform, reducing cross-platform compatibility
- Larger codebase and more complex setup compared to web-based alternatives
- Requires more resources for development and maintenance
Code Comparison
Telegram-iOS (Swift):
class TGModernConversationTitleView: UIView {
private let titleNode: ASTextNode
private let subtitleNode: ASTextNode
override init(frame: CGRect) {
super.init(frame: frame)
// Implementation details
}
}
telegram-tt (JavaScript):
class ChatTitleComponent extends React.Component {
render() {
const { title, subtitle } = this.props;
return (
<div className="chat-title">
<h3>{title}</h3>
<span>{subtitle}</span>
</div>
);
}
}
The code comparison shows the difference in language and approach between the native iOS implementation and the web-based React component. Telegram-iOS uses Swift with a more complex structure, while telegram-tt utilizes JavaScript with a simpler React component.
Cross-platform library for building Telegram clients
Pros of td
- Written in C++, offering better performance and lower-level control
- More comprehensive API coverage of Telegram's features
- Supports multiple programming languages through bindings
Cons of td
- Steeper learning curve due to its low-level nature
- Requires more setup and configuration compared to telegram-tt
- Less suitable for quick prototyping or simple applications
Code Comparison
td (C++):
auto send_message = td_api::make_object<td_api::sendMessage>();
send_message->chat_id_ = chat_id;
send_message->input_message_content_ = td_api::make_object<td_api::inputMessageText>();
send_message->input_message_content_->as_input_message_text()->text_ = td_api::make_object<td_api::formattedText>();
send_message->input_message_content_->as_input_message_text()->text_->text_ = "Hello, World!";
send_query(std::move(send_message), {});
telegram-tt (JavaScript):
await callApi('sendMessage', {
chat_id: chatId,
text: 'Hello, World!',
});
Summary
td is a powerful, low-level library offering extensive control and performance, but with a steeper learning curve. telegram-tt provides a more user-friendly, JavaScript-based approach, ideal for web applications and rapid development. The choice between them depends on the specific project requirements, development expertise, and performance needs.
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 A
This project won the first prize ð¥ at Telegram Lightweight Client Contest and now is an official Telegram client available to anyone at web.telegram.org/a.
According to the original contest rules, it has nearly zero dependencies and is fully based on its own Teact framework (which re-implements React paradigm). It also uses a custom version of GramJS as an MTProto implementation.
The project incorporates lots of technologically advanced features, modern Web APIs and techniques: WebSockets, Web Workers and WebAssembly, multi-level caching and PWA, voice recording and media streaming, cryptography and raw binary data operations, optimistic and progressive interfaces, complicated CSS/Canvas/SVG animations, reactive data streams, and so much more.
Feel free to explore, provide feedback and contribute.
Local setup
mv .env.example .env
npm i
Obtain API ID and API hash on my.telegram.org and populate the .env
file.
Dev mode
npm run dev
Invoking API from console
Start your dev server and locate GramJS worker in console context.
All constructors and functions available in global GramJs
variable.
Run npm run gramjs:tl full
to get access to all available Telegram requests.
Example usage:
await invoke(new GramJs.help.GetAppConfig())
Electron
Electron allows building a native application that can be installed on Windows, macOS, and Linux.
NPM scripts
npm run dev:electron
Run Electron in development mode, concurrently starts 3 processes with watch for changes: main (main Electron process), renderer (FE code) and Webpack for Electron (compiles main Electron process from TypeScript).
npm run electron:webpack
The main process code for Electron, which includes preload functionality, is written in TypeScript and is compiled using the webpack-electron.config.js
configuration to generate JavaScript code.
npm run electron:build
Prepare renderer (FE code) build, compile Electron main process code, install and build native dependencies, is used before packaging or publishing.
npm run electron:staging
Create packages for macOS, Windows and Linux in dist-electron
folders with APP_ENV
as staging
(allows to open DevTools, includes sourcemaps and does not minify built JavaScript code), can be used for manual distribution and testing packaged application.
npm run electron:production
Create packages for macOS, Windows and Linux in dist-electron
folders with APP_ENV
as production
(disabled DevTools, minified built JavaScript code), can be used for manual distribution and testing packaged application.
npm run deploy:electron
Create packages for macOS, Windows and Linux in dist-electron
folder and publish release to GitHub, which allows supporting autoupdates. See GitHub release workflow for more info.
Code signing on MacOS
To sign the code of your application, follow these steps:
- Install certificates from
/certs
folder tologin
folder of your Keychain. - Download and install
Developer ID - G2
certificate from the Apple PKI page. - Under the Keychain application, go to the private key associated with your developer certificate. Then do
key > Get Info > Access Control
. Down there, make sure your application (Xcode) is in the listAlways allow access by these applications
and make sureConfirm before allowing access
is turned on. - A valid and appropriate identity from your keychain will be automatically used when you publish your application.
More info in the official documentation.
Notarize on MacOS
Application notarization is done automatically in electron-builder module, which requires APPLE_ID
and APPLE_APP_SPECIFIC_PASSWORD
environment variables to be passed.
How to obtain app-specific password:
- Sign in to appleid.apple.com.
- In the "Sign-In and Security" section, select "App-Specific Passwords".
- Select "Generate an app-specific password" or select the Add button, then follow the steps on your screen.
GitHub release
GitHub access token
In order to publish new release, you need to add GitHub access token to .env
. Generate a GitHub access token by going to https://github.com/settings/tokens/new. The access token should have the repo scope/permission. Once you have the token, assign it to an environment variable:
# .env
GH_TOKEN="{YOUR_TOKEN_HERE}"
Publish settings
Publish configuration in src/electron/config.yml
config file allows to set GitHub repository owner/name.
Release workflow
- Run
npm run electron:publish
, which will create new draft release and upload build artefacts to newly reated release. Version of created release will be the same as inpackage.json
. - Once you are done, publish the release. GitHub will tag the latest commit.
Dependencies
- GramJS (MIT License)
- pako (MIT License)
- cryptography (Apache License 2.0)
- emoji-data (MIT License)
- twemoji-parser (MIT License)
- rlottie (MIT License)
- opus-recorder (Various Licenses)
- qr-code-styling (MIT License)
- croppie (MIT License)
- mp4box (BSD-3-Clause license)
- music-metadata-browser (MIT License)
- lowlight (MIT License)
- idb-keyval (Apache License 2.0)
- fasttextweb
- webp-wasm
- fastblur
Bug reports and Suggestions
If you find an issue with this app, let Telegram know using the Suggestions Platform.
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 K, GPL v3
Telegram-iOS
Cross-platform library for building Telegram clients
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