parthmax24 commited on
Commit
6594069
·
1 Parent(s): 72b9211
Files changed (3) hide show
  1. README.md +122 -114
  2. docs/images/README.md +1 -7
  3. test.py +0 -110
README.md CHANGED
@@ -15,15 +15,32 @@ pinned: false
15
 
16
  ### Temporary anonymous rooms for quick file sharing between devices.
17
 
18
- No account. No phone login. No personal messenger on office PCs.
19
 
20
  **Open a room. Share what you need. Everything clears after 5 hours.**
21
 
22
- [Live Demo](#) . [Quick Start](#quick-start) . [Why It Exists](#the-little-office-problem) . [Architecture](#how-it-works)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  </div>
25
 
26
- ![TriChat hero banner](docs/images/trichat-hero-banner.png)
 
 
27
 
28
  ```text
29
  [ PC-1 ] ---- room: project-drop ---- [ PC-2 ]
@@ -33,62 +50,41 @@ No account. No phone login. No personal messenger on office PCs.
33
  temporary by design: 5 hours
34
  ```
35
 
36
- > Screenshot/GIF idea: add a short demo here showing two browser windows joining the same room and sharing a file.
 
 
 
 
 
 
 
37
 
38
  ---
39
 
40
  ## The Little Office Problem
41
 
42
- ![The little office problem](docs/images/office-problem-scene.png)
43
-
44
- Scene: three friends at work. Three computers. One tiny task.
45
-
46
- > "Can you send me that file?"
47
-
48
- > "Sure. Wait... should I log into WhatsApp Web on your PC?"
49
-
50
- > "Maybe email?"
51
-
52
- > "No no, I don't want my personal account open here."
53
-
54
- And suddenly, sharing one small file becomes a weird little ritual:
55
-
56
- - open personal messenger
57
- - scan QR code
58
- - wait for sync
59
- - remember to log out
60
- - hope nothing private stays open
61
 
62
  So TriChat started as a tiny escape hatch.
63
 
64
- Not a social network.
65
- Not a permanent chat app.
66
- Just a quick temporary room where teammates can drop files, links, and notes without logging into personal accounts.
67
 
68
  ---
69
 
70
  ## The Idea
71
 
72
- ![The idea moment](docs/images/glowing-room-idea.png)
73
-
74
- ```text
75
- What if sharing between office PCs felt like passing a sticky note?
76
-
77
- 1. Create a room
78
- 2. Tell your friend the room name
79
- 3. Drop files, links, or text
80
- 4. Leave
81
- 5. History disappears after 5 hours
82
- ```
83
 
84
  That is TriChat.
85
 
86
- It is made for quick, low-friction sharing:
87
-
88
  | Need | TriChat Answer |
89
  | --- | --- |
90
  | Move a file from one PC to another | Join the same room and upload it |
91
- | Avoid logging into personal WhatsApp/email | No account needed |
92
  | Share quick links or notes | Send them as messages |
93
  | Avoid long-term clutter | Auto-clears after 5 hours |
94
  | Use any device | Works in a browser |
@@ -97,21 +93,26 @@ It is made for quick, low-friction sharing:
97
 
98
  ## Features
99
 
100
- - Anonymous rooms
101
- - No signup, no phone, no QR login
102
- - Text, links, images, and file sharing
103
- - Real-time WebSocket chat
104
- - Works across laptops, office PCs, lab machines, and phones
105
- - 5-hour message and file expiry
106
- - Small in-memory history cache for faster room loading
107
- - Supabase-backed storage and database
108
- - Docker-ready and self-hostable
 
 
 
109
 
110
  ---
111
 
112
- ## Story Mode Flow
113
 
114
- ![TriChat sharing flow](docs/images/temp-room-flow.png)
 
 
115
 
116
  ```mermaid
117
  flowchart LR
@@ -122,12 +123,22 @@ flowchart LR
122
  E --> F[History clears after 5 hours]
123
  ```
124
 
125
- If GitHub does not render Mermaid in your environment, replace this with an image from `docs/flow.png`.
 
 
 
 
 
 
126
 
127
  ---
128
 
129
  ## Quick Start
130
 
 
 
 
 
131
  ```bash
132
  git clone https://github.com/parthmax2/TriChat.git
133
  cd TriChat
@@ -164,11 +175,15 @@ Open:
164
  http://127.0.0.1:7860
165
  ```
166
 
 
 
167
  ---
168
 
169
  ## Setup
170
 
171
- ### 1. Create The Database
 
 
172
 
173
  In your Supabase SQL editor, run:
174
 
@@ -182,7 +197,11 @@ This creates the `messages` table and adds:
182
  - `file_path` so uploaded files can be deleted from storage
183
  - indexes for faster room history
184
 
185
- ### 2. Create The File Bucket
 
 
 
 
186
 
187
  Create a public storage bucket named:
188
 
@@ -192,16 +211,26 @@ chat-files
192
 
193
  TriChat stores uploaded files there and deletes expired file objects during cleanup.
194
 
195
- ### 3. Add Environment Variables
 
 
 
 
196
 
197
  Use `.env.example` as your guide.
198
 
199
  Never commit your real `.env` file.
200
 
 
 
201
  ---
202
 
203
  ## How It Works
204
 
 
 
 
 
205
  ```text
206
  Browser
207
  |
@@ -218,19 +247,17 @@ Supabase Postgres
218
  Supabase Storage
219
  ```
220
 
221
- ### Temporary Cleanup
222
-
223
- Every message gets an expiry time:
224
-
225
- ```text
226
- created_at + 5 hours = expires_at
227
- ```
228
 
229
- The app cleanup task runs every `CLEANUP_INTERVAL_SECONDS` and removes:
230
 
231
- - expired database messages
232
- - expired uploaded files
233
- - stale cached history
 
 
 
 
234
 
235
  ---
236
 
@@ -251,48 +278,18 @@ Inserted, read, and deleted test row id: ...
251
 
252
  ---
253
 
254
- ## Screenshots
255
-
256
- Add these before launch:
257
-
258
- | Screen | Preview |
259
- | --- | --- |
260
- | Join room | `docs/screenshots/join-room.png` |
261
- | Two users chatting | `docs/screenshots/chat-room.png` |
262
- | File upload | `docs/screenshots/file-share.png` |
263
- | Mobile view | `docs/screenshots/mobile.png` |
264
-
265
- > Tip: a 10-second GIF is more powerful than four static screenshots.
266
-
267
- ---
268
-
269
- ## Image Prompts
270
-
271
- Use this shared visual style for every image so the README matches the app theme:
272
-
273
- ```text
274
- dreamy anime-style illustration, soft sky-blue and white glassy UI glow, pastel pink highlights, tiny mint-green accents, cozy modern office, clean rounded shapes, gentle bloom, cinematic lighting, professional but cute, no readable text, no watermark
275
- ```
276
-
277
- | File name | Where it appears | Prompt |
278
- | --- | --- | --- |
279
- | `docs/images/trichat-hero-banner.png` | Top hero banner | Three young office friends at separate computers in a cozy modern workplace, their screens connected by a soft glowing temporary chat room, floating files and notes moving between devices, white glass panels, sky-blue glow, pastel pink highlights, mint-green status dots, wide cinematic banner composition |
280
- | `docs/images/office-problem-scene.png` | The Little Office Problem | One coworker hesitating before logging into a personal messenger on someone else's office PC, two friends waiting with a file, privacy concern shown with subtle lock shapes and a phone silhouette, awkward but cute expressions, soft blue-white office lighting, pastel pink monitor glow |
281
- | `docs/images/glowing-room-idea.png` | The Idea | A small magical chat-room portal appearing between three computer screens, files, links, sticky notes, and image cards floating through it, coworkers smiling with relief, glassy white interface elements, blue glow, mint accents, dreamy startup energy |
282
- | `docs/images/temp-room-flow.png` | Story Mode Flow | Two office computers connected through a temporary room bubble, files and messages traveling safely between screens, a gentle hourglass symbol showing 5-hour expiry, calm blue-white workspace, pastel pink rim light, clean readable composition with no text |
283
- | `docs/images/auto-delete-scene.png` | Optional cleanup section image | A temporary chat room gently dissolving into sparkling light after 5 hours, old files and message cards fading like soft particles, hourglass glow, peaceful night office, blue-white base colors, pink highlights, mint safety accents |
284
- | `docs/images/friends-success-scene.png` | Optional final CTA image | Three office friends smiling around glowing computer screens after sharing files successfully, calm satisfied mood, sunrise light, clean desks, blue-white glass UI, pastel pink warmth, tiny mint-green online indicators |
285
-
286
- ---
287
-
288
  ## Perfect For
289
 
290
- - Office teammates sharing files across PCs
291
- - Students in computer labs
292
- - Hackathon teams
293
- - Support desks
294
- - Temporary project rooms
295
- - People who do not want to log into personal messengers on shared machines
 
 
 
 
296
 
297
  ---
298
 
@@ -304,7 +301,7 @@ Do not share passwords, private keys, confidential company documents, or anythin
304
 
305
  ---
306
 
307
- ## The Short Story For GitHub
308
 
309
  I built TriChat because my coworkers and I often needed to move files between office PCs.
310
 
@@ -316,16 +313,27 @@ TriChat is a temporary anonymous room: open a room, share files or links, and th
316
 
317
  ## Roadmap
318
 
319
- - Copy invite link button
320
- - Room expiry countdown in the UI
321
- - Drag-and-drop file upload
322
- - Dark mode
323
- - Optional room password
324
- - Admin cleanup dashboard
325
- - One-click deploy buttons
 
 
 
 
 
 
 
326
 
327
  ---
328
 
 
 
 
 
329
  <div align="center">
330
 
331
  ### If TriChat saved you from logging into WhatsApp on a random PC, give it a star.
 
15
 
16
  ### Temporary anonymous rooms for quick file sharing between devices.
17
 
18
+ No account. No phone login. No personal messenger on shared PCs.
19
 
20
  **Open a room. Share what you need. Everything clears after 5 hours.**
21
 
22
+ <p>
23
+ <a href="https://huggingface.co/spaces/parthmax/TriChat"><img alt="Live Demo" src="https://img.shields.io/badge/Live%20Demo-Hugging%20Face-ffcc4d?style=for-the-badge" /></a>
24
+ <img alt="FastAPI" src="https://img.shields.io/badge/FastAPI-009688?style=for-the-badge&logo=fastapi&logoColor=white" />
25
+ <img alt="WebSockets" src="https://img.shields.io/badge/WebSockets-Realtime-3b82f6?style=for-the-badge" />
26
+ <img alt="Temporary" src="https://img.shields.io/badge/Auto%20Delete-5%20Hours-f472b6?style=for-the-badge" />
27
+ </p>
28
+
29
+ <p>
30
+ <a href="https://huggingface.co/spaces/parthmax/TriChat"><b>Live Demo</b></a>
31
+ ·
32
+ <a href="#quick-start"><b>Quick Start</b></a>
33
+ ·
34
+ <a href="#the-little-office-problem"><b>Story</b></a>
35
+ ·
36
+ <a href="#how-it-works"><b>Architecture</b></a>
37
+ </p>
38
 
39
  </div>
40
 
41
+ <p align="center">
42
+ <img src="docs/images/trichat-hero-banner.png" alt="TriChat hero banner" width="100%" />
43
+ </p>
44
 
45
  ```text
46
  [ PC-1 ] ---- room: project-drop ---- [ PC-2 ]
 
50
  temporary by design: 5 hours
51
  ```
52
 
53
+ <table>
54
+ <tr>
55
+ <td align="center"><b>No Login</b><br />Open a room instantly.</td>
56
+ <td align="center"><b>Share Fast</b><br />Drop files, links, and notes.</td>
57
+ <td align="center"><b>Temporary</b><br />History clears after 5 hours.</td>
58
+ <td align="center"><b>Any Device</b><br />Works in a browser.</td>
59
+ </tr>
60
+ </table>
61
 
62
  ---
63
 
64
  ## The Little Office Problem
65
 
66
+ | | |
67
+ | --- | --- |
68
+ | <img src="docs/images/office-problem-scene.png" alt="The little office problem" width="100%" /> | **Scene: three friends at work. Three computers. One tiny task.**<br><br>> "Can you send me that file?"<br><br>> "Sure. Wait... should I log into WhatsApp Web on your PC?"<br><br>> "Maybe email?"<br><br>> "No no, I don't want my personal account open here."<br><br>And suddenly, sharing one small file becomes a whole ritual: open a personal messenger, scan a QR code, wait for sync, remember to log out, and hope nothing private stays open. |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  So TriChat started as a tiny escape hatch.
71
 
72
+ Not a social network. Not a permanent chat app. Just a quick temporary room where teammates can drop files, links, and notes without logging into personal accounts.
 
 
73
 
74
  ---
75
 
76
  ## The Idea
77
 
78
+ | | |
79
+ | --- | --- |
80
+ | **What if sharing between office PCs felt like passing a sticky note?**<br><br>1. Create a room<br>2. Tell your friend the room name<br>3. Drop files, links, or text<br>4. Leave<br>5. History disappears after 5 hours | <img src="docs/images/glowing-room-idea.png" alt="The TriChat idea moment" width="100%" /> |
 
 
 
 
 
 
 
 
81
 
82
  That is TriChat.
83
 
 
 
84
  | Need | TriChat Answer |
85
  | --- | --- |
86
  | Move a file from one PC to another | Join the same room and upload it |
87
+ | Avoid logging into WhatsApp or email | No account needed |
88
  | Share quick links or notes | Send them as messages |
89
  | Avoid long-term clutter | Auto-clears after 5 hours |
90
  | Use any device | Works in a browser |
 
93
 
94
  ## Features
95
 
96
+ <table>
97
+ <tr>
98
+ <td><b>Anonymous rooms</b><br />Join with a name and room. No account ceremony.</td>
99
+ <td><b>Quick sharing</b><br />Send text, links, images, and files between devices.</td>
100
+ <td><b>Realtime chat</b><br />WebSocket-powered messages feel instant.</td>
101
+ </tr>
102
+ <tr>
103
+ <td><b>5-hour expiry</b><br />Messages and uploaded files are temporary by design.</td>
104
+ <td><b>Room cache</b><br />Small in-memory cache keeps recent room loading snappy.</td>
105
+ <td><b>Self-hostable</b><br />Run it locally, in Docker, or on Hugging Face Spaces.</td>
106
+ </tr>
107
+ </table>
108
 
109
  ---
110
 
111
+ ## Sharing Flow
112
 
113
+ <p align="center">
114
+ <img src="docs/images/temp-room-flow.png" alt="TriChat sharing flow" width="82%" />
115
+ </p>
116
 
117
  ```mermaid
118
  flowchart LR
 
123
  E --> F[History clears after 5 hours]
124
  ```
125
 
126
+ ---
127
+
128
+ ## Temporary By Design
129
+
130
+ | | |
131
+ | --- | --- |
132
+ | <img src="docs/images/auto-delete-scene.png" alt="TriChat auto delete scene" width="100%" /> | Every saved message and uploaded file gets an expiry time.<br><br>`created_at + 5 hours = expires_at`<br><br>The cleanup worker runs in the background and removes expired database messages, uploaded files, and stale cached history.<br><br>TriChat is intentionally short-lived. It is for quick exchange, not forever storage. |
133
 
134
  ---
135
 
136
  ## Quick Start
137
 
138
+ <details open>
139
+ <summary><b>Run TriChat locally</b></summary>
140
+ <br />
141
+
142
  ```bash
143
  git clone https://github.com/parthmax2/TriChat.git
144
  cd TriChat
 
175
  http://127.0.0.1:7860
176
  ```
177
 
178
+ </details>
179
+
180
  ---
181
 
182
  ## Setup
183
 
184
+ <details open>
185
+ <summary><b>1. Create The Database</b></summary>
186
+ <br />
187
 
188
  In your Supabase SQL editor, run:
189
 
 
197
  - `file_path` so uploaded files can be deleted from storage
198
  - indexes for faster room history
199
 
200
+ </details>
201
+
202
+ <details open>
203
+ <summary><b>2. Create The File Bucket</b></summary>
204
+ <br />
205
 
206
  Create a public storage bucket named:
207
 
 
211
 
212
  TriChat stores uploaded files there and deletes expired file objects during cleanup.
213
 
214
+ </details>
215
+
216
+ <details open>
217
+ <summary><b>3. Add Environment Variables</b></summary>
218
+ <br />
219
 
220
  Use `.env.example` as your guide.
221
 
222
  Never commit your real `.env` file.
223
 
224
+ </details>
225
+
226
  ---
227
 
228
  ## How It Works
229
 
230
+ <details open>
231
+ <summary><b>Architecture map</b></summary>
232
+ <br />
233
+
234
  ```text
235
  Browser
236
  |
 
247
  Supabase Storage
248
  ```
249
 
250
+ </details>
 
 
 
 
 
 
251
 
252
+ Core stack:
253
 
254
+ | Layer | Tool |
255
+ | --- | --- |
256
+ | Backend | FastAPI |
257
+ | Realtime | WebSockets |
258
+ | Database | Supabase Postgres |
259
+ | File storage | Supabase Storage |
260
+ | Deployment | Docker / Hugging Face Spaces |
261
 
262
  ---
263
 
 
278
 
279
  ---
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  ## Perfect For
282
 
283
+ <table>
284
+ <tr>
285
+ <td><b>Office teammates</b><br />Move files across shared PCs without personal logins.</td>
286
+ <td><b>Computer labs</b><br />Share notes and files between lab machines.</td>
287
+ </tr>
288
+ <tr>
289
+ <td><b>Hackathon teams</b><br />Drop links, screenshots, builds, and quick notes.</td>
290
+ <td><b>Support desks</b><br />Create a temporary room for fast exchange.</td>
291
+ </tr>
292
+ </table>
293
 
294
  ---
295
 
 
301
 
302
  ---
303
 
304
+ ## The Short Story
305
 
306
  I built TriChat because my coworkers and I often needed to move files between office PCs.
307
 
 
313
 
314
  ## Roadmap
315
 
316
+ <table>
317
+ <tr>
318
+ <td>Copy invite link button</td>
319
+ <td>Room expiry countdown in the UI</td>
320
+ </tr>
321
+ <tr>
322
+ <td>Drag-and-drop file upload</td>
323
+ <td>Dark mode</td>
324
+ </tr>
325
+ <tr>
326
+ <td>Optional room password</td>
327
+ <td>One-click deploy buttons</td>
328
+ </tr>
329
+ </table>
330
 
331
  ---
332
 
333
+ <p align="center">
334
+ <img src="docs/images/friends-success-scene.png" alt="TriChat friends success scene" width="100%" />
335
+ </p>
336
+
337
  <div align="center">
338
 
339
  ### If TriChat saved you from logging into WhatsApp on a random PC, give it a star.
docs/images/README.md CHANGED
@@ -1,6 +1,6 @@
1
  # TriChat README Images
2
 
3
- Generate the README images with the prompts in the main `README.md`, then save them here:
4
 
5
  - `trichat-hero-banner.png`
6
  - `office-problem-scene.png`
@@ -8,9 +8,3 @@ Generate the README images with the prompts in the main `README.md`, then save t
8
  - `temp-room-flow.png`
9
  - `auto-delete-scene.png`
10
  - `friends-success-scene.png`
11
-
12
- Recommended sizes:
13
-
14
- - Hero banner: `1600x700`
15
- - Story scenes: `1200x800`
16
- - Flow/CTA images: `1200x700`
 
1
  # TriChat README Images
2
 
3
+ These images are used by the main `README.md` and are tracked with Git LFS.
4
 
5
  - `trichat-hero-banner.png`
6
  - `office-problem-scene.png`
 
8
  - `temp-room-flow.png`
9
  - `auto-delete-scene.png`
10
  - `friends-success-scene.png`
 
 
 
 
 
 
test.py DELETED
@@ -1,110 +0,0 @@
1
- from datetime import datetime, timedelta, timezone
2
- from pathlib import Path
3
- from uuid import uuid4
4
- import os
5
- import sys
6
-
7
- import httpx
8
-
9
-
10
- def load_env_file(path: str) -> None:
11
- env_path = Path(path)
12
- if not env_path.exists():
13
- return
14
-
15
- for raw_line in env_path.read_text(encoding="utf-8").splitlines():
16
- line = raw_line.strip()
17
- if not line or line.startswith("#") or "=" not in line:
18
- continue
19
-
20
- key, value = line.split("=", 1)
21
- key = key.strip()
22
- value = value.strip().strip('"').strip("'")
23
- os.environ.setdefault(key, value)
24
-
25
-
26
- def require_env(name: str) -> str:
27
- value = os.getenv(name, "").strip()
28
- if not value:
29
- raise RuntimeError(f"Missing {name}. Add it to .env or .env.example.")
30
- return value
31
-
32
-
33
- def main() -> int:
34
- load_env_file(".env")
35
- load_env_file(".env.example")
36
-
37
- supabase_url = require_env("SUPABASE_URL").rstrip("/")
38
- supabase_key = require_env("SUPABASE_SERVICE_ROLE_KEY")
39
-
40
- headers = {
41
- "apikey": supabase_key,
42
- "Authorization": f"Bearer {supabase_key}",
43
- "Content-Type": "application/json",
44
- }
45
-
46
- test_room = f"test-{uuid4().hex}"
47
- test_text = f"Supabase integration test {datetime.now(timezone.utc).isoformat()}"
48
- payload = {
49
- "room": test_room,
50
- "username": "integration-test",
51
- "message_type": "text",
52
- "text": test_text,
53
- "created_at": datetime.now(timezone.utc).isoformat(),
54
- "expires_at": (datetime.now(timezone.utc) + timedelta(hours=5)).isoformat(),
55
- }
56
-
57
- with httpx.Client(timeout=20) as client:
58
- insert_response = client.post(
59
- f"{supabase_url}/rest/v1/messages",
60
- headers={**headers, "Prefer": "return=representation"},
61
- json=payload,
62
- )
63
- insert_response.raise_for_status()
64
-
65
- inserted = insert_response.json()
66
- if not inserted:
67
- raise RuntimeError("Insert succeeded, but Supabase did not return a row.")
68
-
69
- inserted_id = inserted[0]["id"]
70
-
71
- select_response = client.get(
72
- f"{supabase_url}/rest/v1/messages",
73
- headers=headers,
74
- params={
75
- "select": "id,room,username,message_type,text,expires_at,file_path",
76
- "id": f"eq.{inserted_id}",
77
- },
78
- )
79
- select_response.raise_for_status()
80
- rows = select_response.json()
81
-
82
- if not rows or rows[0]["text"] != test_text:
83
- raise RuntimeError("Inserted test row could not be read back correctly.")
84
-
85
- if not rows[0].get("expires_at") or "file_path" not in rows[0]:
86
- raise RuntimeError("Expiry columns are missing. Run supabase_schema.sql again.")
87
-
88
- delete_response = client.delete(
89
- f"{supabase_url}/rest/v1/messages",
90
- headers=headers,
91
- params={"id": f"eq.{inserted_id}"},
92
- )
93
- delete_response.raise_for_status()
94
-
95
- print("Supabase database integration successful.")
96
- print(f"Inserted, read, and deleted test row id: {inserted_id}")
97
- return 0
98
-
99
-
100
- if __name__ == "__main__":
101
- try:
102
- raise SystemExit(main())
103
- except httpx.HTTPStatusError as exc:
104
- response_body = exc.response.text[:500]
105
- print(f"Supabase database integration failed: {exc}", file=sys.stderr)
106
- print(f"Response body: {response_body}", file=sys.stderr)
107
- raise SystemExit(1)
108
- except Exception as exc:
109
- print(f"Supabase database integration failed: {exc}", file=sys.stderr)
110
- raise SystemExit(1)