You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-17Lines changed: 40 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -8,26 +8,49 @@ THIS PROJECT IS A WIP UNTIL v1.0 GETS RELEASED
8
8
### The Plan
9
9
This is a selfhostable chat app meant for small to medium size groups who want to talk to each other with pgp with the convenience of the encryption being integrated into the chat.
10
10
11
-
It will use pocketbase to have a portable small db to hold encrypted messages, public keys/users, and chatroom/dm data such as title of chat etc.
11
+
It will use mongodb to have a database to hold encrypted messages, public keys/users, and chatroom/dm data such as title of chat etc.
12
12
It will use openpgp.js mainly on the client side to handle encryption/decryption, private keys, and other sensitive stuff while the server side will only have functions need for connecting people through websockets, db handling, security challenges with public key etc.
13
13
It will also have tailwindcss for styling and expressjs for a minimal webserver with express handlebars for html templating and all while using typescript
14
14
15
-
Planned db schema:
16
-
Chatroom:
17
-
chatroom_name: string (unique)
18
-
creator: string
19
-
messages: list of dicts (each dict contains content, username, date)
20
-
list of members: list of public keys
21
-
dm: boolean (true if direct message, false if group chat)
22
-
23
-
User:
24
-
public_key: string
25
-
dms: list of chatroom names (for direct messages)
26
-
groups: list of group names (for group chats)
27
-
friends: list of usernames
28
-
created_at: datetime
29
-
updated_at: datetime
30
-
15
+
### Planned Database Schema
16
+
17
+
#### User
18
+
-`username`: string (unique)
19
+
-`public_key`: string (unique, stored server-side, served to clients for encryption)
20
+
-`created_at`: datetime
21
+
-`updated_at`: datetime
22
+
23
+
#### Chatroom
24
+
-`name`: string (unique)
25
+
-`creator_id`: int (foreign key to User)
26
+
-`type`: enum (`dm`, `group`)
27
+
-`created_at`: datetime
28
+
-`updated_at`: datetime
29
+
30
+
#### Membership
31
+
-`user_id`: int (foreign key to User)
32
+
-`chatroom_id`: int (foreign key to Chatroom)
33
+
-`joined_at`: datetime
34
+
35
+
#### Message
36
+
-`chatroom_id`: int (foreign key to Chatroom)
37
+
-`sender_id`: int (foreign key to User)
38
+
-`content`: string (encrypted)
39
+
-`created_at`: datetime
40
+
41
+
#### Friendship
42
+
-`user_id`: int (foreign key to User)
43
+
-`friend_id`: int (foreign key to Other User)
44
+
-`created_at`: datetime
45
+
46
+
**Notes:**
47
+
- The `public_key` field in the User table is stored server-side and served to clients, allowing users to encrypt messages for others and decrypt messages client-side.
48
+
- Membership table efficiently manages users in chatrooms (many-to-many).
49
+
- Friendship table manages user connections.
50
+
- All sensitive data (messages, public keys) remain encrypted or are only public keys.
51
+
- Chatroom type uses an enum for clarity (`dm` for direct message, `group` for group chat).
52
+
- Timestamps help with auditing and ordering.
53
+
- We are using mongodb now because pocketbase has unclear documentation and I am not spending a century learning that
0 commit comments