Bit is a simple, web-based, self-hostable text sharing platform written in Java and Spring.
You can access it [from here](https://bt.marcocetica.com)(no frontend, yet).
## General
**Bit** can be used both from the frontend(not yet available) and through the REST API.
Before using it, read the following technical notices:
1. By default, each new _"text"_(from now on: **post**) added to the platform is anonymous and does not expire.
In order to associate a new post to an identity, you first need to register a new user account.
The registration process requires a unique **username**, a unique **email address** and a **password**.
User accounts can **NOT** be modified or recovered; therefore if you lose your password, you will need
to create a new account using a new email address.
2. Posts published with a valid user identity can be altered or deleted. In order to do that, you
need to authenticate yourself with your credentials within the update/delete request. Anonymous
posts, on the other hand, can **NOT** be altered or removed; if you think that a certain content
goes against the terms of service, you can email the owner of the **bit** instance.
3. The expiration date controls whether the post can be showed or not, once the current date
is greater or equal than the expiration date, the post is classified as **expired** and thus
shall not be showed. Expired posts are **NOT** deleted but may be manually removed by the
instance owner.
4. The **bit** platform is _stateless_, hence there is no such thing as user session. Every time
you need to use your user account for a certain operation(e.g., create a new post with an identity
or delete an existing, non-anonymous post) you will need to provide your user credentials.
5. Deleting an existing user, will result in a [cascade delete](https://learn.microsoft.com/en-us/ef/core/saving/cascade-delete#:~:text=Cascading%20deletes%20are%20needed%20when%20a%20dependent/child%20entity%20can%20no%20longer%20be%20associated%20with%20its%20current%20principal/parent.%20This%20can%20happen%20because%20the%20principal/parent%20is%20deleted%2C%20or%20it%20can%20happen%20when%20the%20principal/parent%20still%20exists%20but%20the%20dependent/child%20is%20no%20longer%20associated%20with%20it.)
of any existing post associated with that user.
## Database
New posts are stored on a relational database(PostgreSQL) using the Spring ORM system(Hibernate).
The architecture of the bit platform consists of two tables: **bt_users** and **bt_posts**.
The former stores the user accounts, and it's defined as follows:
| Column | Data Type | Nullable |
|----------|-----------|----------|
| user ID | `String` | `false` |
| email | `String` | `false` |
| password | `BCrypt` | `false` |
| username | `String` | `false` |
The latter, instead, stores the posts, and it's defined as follows: