Summary: 4myanmar (obviously a copied naming style from 4chan.org) is an imageboard where users can anonymously create account, create posts, save posts, add photos, give upvotes and downvotes in any board or whatever category that the user likes. I built this because Facebook and many social media sites are blocked in my country Myanmar. I also wanted to build this to allow information flow without the influence of any person's fame or popularity which could potentially drive misinformation even further, reduce balance in opinions, reduce freedom and negatively affect free speech. To achieve this, I didn't even add the option to describe "Anonymous" on my site to stay completely anonymous. I do store UUID and cookies to identify users' posts, saved posts, replies, upvotes and downvotes but nothing more personal information is stored.
0. Any user can browse boards, create posts and replies. But they will not be able to upvote, downvote, and save posts. Users can create an account with a passkey but they will remain anonymous (not even showing the name "anonymous"). The passkey is used to create or sign in with only one button. If the user that has already created an account provides a wrong passkey, a new account is created. Only if the user provides the correct passkey will they be able to view their posts, saved posts and replies. Any user with an account can create, save, upvote, downvote, and reply to posts in any board. Long posts are automatically truncated but if the users click on "read more", the full post is shown. Users can also add photos and videos when posting or replying. Users can see saved posts and posts that they have replied to in separate pages.
1. I used sqlite3 because that's the easiest. All schemas that I used for database are in schema.sql and schema2.sql. To create a database for this application, you only need to run as follow.
sqlite3 [name].db < schema.sql
sqlite3 [name].db < schema2.sql
I used schema2.sql for the final version. I looked up online and went to the wrong site and thought sqlite3 supports boolean data type. Turns out that it doesn't but it assumes 0 as False and 1 as True as per their site. See more sqlite3 supported data types. In schema.sql, I used Bit data type but for the final version, I changed the data type of the boolean fields to INTEGER and sqlite3 can automatically recognize it as True or False.
In the database, there are 6 tables (users, posts, upvoters, downvoters, user_posts, replies). Do not be confused by posts and user_posts: user_posts is for posts that are created by the user whereas posts contain posts created by all users. But you could argue that it's not needed to create user_posts because I could get the user's posts by just passing another condition in the query like the following. But as I started out piece by piece from the scratch, only after creating many posts and done so many things did I realize that I could've done that simply. But I have no intention to fix it, maybe later in the future. (It's only a small thing to fix but I won't... just messing with you. Ha Ha...)
SELECT * FROM posts WHERE user_uuid = [user_uuid];