2025-09-07 20:21:43 +03:30
2025-06-04 19:54:35 +03:30
2025-06-04 19:54:35 +03:30
2025-06-04 20:05:27 +03:30
2025-06-04 19:54:35 +03:30
2025-06-04 19:54:35 +03:30
2025-06-04 19:54:35 +03:30
2025-06-04 19:54:35 +03:30
2025-09-07 20:21:43 +03:30
2025-06-04 19:54:35 +03:30

Telegram-Clone Project

Introduction

This is the final project of our Advanced Programming course at Shahid Beheshti University.
Its a clone of the famous messaging application Telegram, developed in Java and designed with JavaFX.

The project implements both client-side and server-side logic, featuring real-time messaging, saved messages, contacts, groups, and channels.


Objectives

Here is a list of concepts that were practiced and implemented throughout the project:

  • Object-Oriented Programming (OOP) concepts
  • Database design and integration
  • Multithreading and concurrency control
  • Socket programming for client-server communication
  • Designing graphical user interfaces with JavaFX
  • Data handling and persistence with PostgreSQL
  • Real-time events and message synchronization

Pre Requirements

  • Java (JDK 23 or higher)
  • PostgreSQL (for database)
  • JavaFX SDK (for GUI)
  • IntelliJ IDEA
  • Gradle as the build system

Detabase design

photo_2025-09-07_20-10-33


Implementation

The project has 3 main parts:

  1. Telegram Client

    • JavaFX-based UI replicating Telegrams layout (intro, login, chats, sidebar, overlays).
    • Handles sending/receiving requests through sockets.
    • Displays messages, saved chats, groups, and user profiles.
  2. Telegram Server

    • Multithreaded server managing client connections concurrently.
    • Processes requests, accesses the database, and returns structured JSON responses.
    • Includes a server log showing all events and queries in real-time.
  3. Sockets

    • All client-server communication is handled via sockets.
    • Each request/response follows a structured JSON protocol.
    • Supports multiple users communicating simultaneously.

Creating GUI

The GUI was developed entirely with JavaFX, SceneBuilder, and custom CSS.
Features include:

  • Light/Dark theme switching
  • Responsive sidebar navigation
  • Overlays (e.g., Saved Messages, My Profile, Blocked Users)
  • Round avatars and icons styled to match Telegrams UI

Database Structures

Implemented with PostgreSQL. Main tables include:

  • users stores account information
  • messages stores chat messages with sender, receiver, timestamp, and status
  • private_chat for one-on-one conversations (including Saved Messages)
  • group_chat / channel for group and channel features
  • message_receipts to track read/delivery status

(SQL schema files are provided in the project repo)


Presentation

This is the link to the slides used for the project presentation.


How to Run the Code

  1. Clone the repository.
  2. Set up the PostgreSQL database using the provided init.sql.
  3. In IntelliJ IDEA (with Gradle):
    • Run MainServer first. You should see Listening ... in the console.
    • Run TelegramApplication. The intro screen (with “Start Messaging”) will appear.
  4. Login/Register to start chatting.

Contributors


Date/Time

Summer of 2025 (Version 1.0)


Resources

S
Description
A Java desktop messaging app inspired by Telegram – using JavaFX, PostgreSQL, and Java Sockets.
Readme
21 MiB
Languages
Java 94.7%
CSS 5.3%