# ๐ฐ๏ธ P2PChat โ A Peer-to-Peer Encrypted Terminal Chat App
P2PChat is a **fully peer-to-peer, end-to-end encrypted terminal-based chat app** with no servers, no accounts, and no data collection โ just raw sockets, passwords, and secure communication.
---
## ๐ง Key Features
- ๐งโ๐ป **Host-based Rooms**: One user creates a room and shares an invite code in the format: `IP:PORT#password`
- ๐ **Join with Invite Code**: Others join the chat room using that invite code
- โ๏ธ **No Central Server**: No cloud or server dependency โ 100% peer-to-peer
- ๐ฎ **Manual IP & Port Entry**: Allows advanced users to connect directly
- ๐ **.edu Email-Only Rooms** *(future enhancement idea)*
- ๐งญ **Host as Lightweight Relay**: Host handles all connections
- ๐ **Nickname-Only Identity**: IP hidden from peers
- ๐ **AES Encryption**: Messages encrypted using shared room password
- ๐ **Local Message Logging**: Messages stored locally as `.txt` files
- ๐งน **Kick Support**: Hosts can remove users from room
- ๐ฅ๏ธ **Terminal UI via `rich`**: Colorful, responsive terminal experience
- ๐ **No Ngrok / Paid Services**: Fully open and local-first
- ๐ **Optional UPnP Support**: For automatic port forwarding (where available)
---
## ๐ฆ Architecture
> A minimal yet powerful P2P hybrid architecture
- ๐ค **Host** acts as the central relay/server for the room
- ๐งฉ **Peers** connect directly to host via TCP
- ๐ **AES-256 encryption** with shared room password
- ๐๏ธ **Local storage** of configs and message history
- โ No third-party API or cloud involved
---
## ๐ Security Model
| Feature | Description |
|------------------|-------------------------------------------------------|
| ๐ End-to-end Encryption | Using `pycryptodome` and AES-256 |
| ๐ต๏ธ Anonymous Nicknames | Peers only see nicknames, not IPs |
| ๐ซ No Central Logging | No data is stored remotely |
| ๐ Host-only IP Exposure | Only host shares their IP/port to others |
---
## ๐ What You'll Learn (and Show Off)
- ๐ง Python Networking (TCP sockets)
- ๐งต Multithreading for handling clients
- ๐จ Terminal UI with [`rich`](https://github.com/Textualize/rich)
- ๐ AES-based encryption (`pycryptodome`)
- ๐ P2P connection architecture
- ๐ UPnP & NAT traversal basics
- ๐งฉ CLI argument parsing with `argparse`
- ๐ฆ Packaging for `pip` with `setuptools`
- ๐ Open-source development workflows
---
## ๐ Usage & Installation
> Package it for quick installs and use via command-line:
### ๐ฅ Install via pip (in future):
```bash
pip install p2pchatp2pchat --host 7788 --name Alice --password myroomp2pchat --join 1.2.3.4:7788 --name Bob --password myroom- ๐พ Hackerspaces & dev clubs
- ๐ College or LAN group chat
- ๐งโ๐คโ๐ง Friends-only chats (fully local)
- ๐ต๏ธโโ๏ธ Privacy-first communities
- ๐ Chatting across NAT/firewalls (with UPnP enabled)
- ๐ง
.eduemail-based rooms - ๐ Invite codes with expiration
- ๐ WebSocket-based GUI frontends
- ๐ฒ Mobile companion app (via QR invite)
- ๐ Public Room Discovery (optional directory mode)
This is a passion project meant to demonstrate:
- How terminal apps can still be powerful & elegant
- That encrypted, serverless chat is totally possible
- That Python is capable of networking, UI, and encryption together
Want to contribute, fork, or star the project? Join us โ this is open-source privacy, made simple.