"Hilow" is a microblogging social feed where users are able to share they thoughts on different topics
- Docker
- Docker Compose
- Rust
A .env
file is required to run this application. Use the .env.sample
file
to create a .env
file with the desired configuration.
Key | Description | Example |
---|---|---|
RUST_LOG |
Log level | warn,info,error,debug |
POSTGRES_USER |
PostgreSQL User | N/A |
POSTGRES_PASSWORD |
PostgreSQL Password | N/A |
POSTGRES_DB |
PostgreSQL Database Name | N/A |
POSTGRES_HOST |
PostgreSQL Hostname | N/A |
POSTGRES_CONN_TIMEOUT |
PostgreSQL connection timeout in seconds | 2 |
DATABASE_URL |
Database URL used by SQLx | postgres://user:secret@127.0.0.1/dbname |
DB_MAX_CONNECTIONS |
Database max simultaneous connections | 5 |
Theres two ways to run this project:
- Simple: Using your local resources
- Docker: All resources run through Docker with the
docker-compose
file
In order to run the project on it's Simple mode, run the PostgreSQL database using:
docker-compose up --build database
And in another Terminal instance you must run:
cargo run
If you want to use auto reload you must install both executable crates:
cargo-watch
cargo install cargo-watch
Then execute you application using the bin/dev.sh
script:
bin/dev.sh
Docker is ready for execution, run: docker-compose up --build
in order to run
this project all on Docker.
Root Path: api/v1/
URI | Method | Req. Body | Res. Body | Description |
---|---|---|---|---|
login |
POST | Login Req | Login Resp | Update current logged User Info. |
logout |
POST | - | - | Update current logged User Info. |
signup |
POST | Register Request | Register Response | Register a new User. |
URI | Method | Req. Body | Res. Body | Description |
---|---|---|---|---|
users/me |
GET | - | User | Get current Logged User Info. |
users |
PUT | - | User | Update current logged User Info. |
users/:username |
GET | - | User | Get User Info by User name. |
users/:username/posts |
GET | - | Array<Post> | Get User Info by User name. |
users/:username/posts/:id |
GET | - | User | Get User Info by User name. |
users/:username/profile |
PUT | - | User | Update User Profile. |
URI | Method | Req. Body | Res. Body | Description |
---|---|---|---|---|
posts |
POST | - | Post | Create a Post by current logged User. |
posts/:postId |
PATCH | - | Post | Update a Post only if belongs to Logged User. |
posts/:postId |
DELETE | - | - | Delete a Post only if belongs to Logged User. |
URI | Method | Req. Body | Res. Body | Description |
---|---|---|---|---|
feed |
Get | - | Array<Post> | Get feed based on current logged user. |
Property | Type | Optional | Description |
---|---|---|---|
user_id |
string |
No | User id (Email or Username). |
password |
string |
No | User's Password. |
Property | Type | Optional | Description |
---|---|---|---|
email |
string |
No | User's Email. |
username |
string |
No | User's Username. |
name |
string |
No | User's name. |
surname |
string |
yes | User's surname. |
password |
string |
No | User's Password. |
A platform user with unique identification (email).
Property | Type | Optional | Description |
---|---|---|---|
id |
UUID |
No | Unique identifier for registry. |
email |
string |
No | User's Email. |
username |
string |
No | User's Username. |
A User
's secret may contain the password hash used to validate future authentication process
Property | Type | Optional | Description |
---|---|---|---|
id |
UUID |
No | Unique identifier for registry. |
user_id |
UUID |
No | Foreign key for User relationship. |
hash |
string |
No | Password hash stored when signing up or updating password details. |
A User
's profile contains details on the person behind an User
entry
Property | Type | Optional | Description |
---|---|---|---|
id |
UUID |
No | Unique identifier for registry. |
user_id |
UUID |
No | Foreign key for User relationship. |
avatar_id |
UUID |
Yes | Foreign key for File relationship used as Avatar Image. |
name |
string |
No | User's profile name. |
surname |
string |
Yes | User's profile surname. |
Platform file entry used for posting image files and retrieving them as well
Property | Type | Optional | Description |
---|---|---|---|
id |
UUID |
No | Unique identifier for registry. |
mime_type |
string |
No | File's MIME type. Refer to MIME types |
bytes |
Array<u8> |
No | Raw bytes from the file. |
size |
uint |
No | Size of the file in question. |
url |
string |
No | File's public access URL. |
sha256 |
string |
No | File's SHA256 checksum. |
A feed Post
created by any user in the platform.
Post
s may or may not have parent nodes used to achieve comment-like functionality.
Posts may also contain one or more File
s as well.
Property | Type | Optional | Description |
---|---|---|---|
id |
UUID |
No | Unique identifier for registry. |
user_id |
UUID |
No | Foreign key for User relationship. Also refers to the owner of this file, bringing access to File deletion for instance. |
parent_id |
UUID |
Yes | Foreign key for Post relationship. This is a recursive relationship and may not be present if the Post doesn't have a parent. |
files |
Array<File> |
No | An array of File entries which belongs to the Post. A Post may not have File entries related to it, for such cases this array must remain empty instead. |
body |
string |
Yes | Text content for posts, this contents may contain HTML. If thats the case, such HTML must be escaped. |
hashtags |
Array<Hashtag> |
No | A post may or may not contain Hashtag instances related to itself. As well as the files array, the hashtags array must be present always, if theres no Hashtag relationships present then this array must remain empty. |
A Post
's hashtag used to "tag" posts with a unique name/key
Property | Type | Optional | Description |
---|---|---|---|
id |
UUID |
No | Unique identifier for registry |
name |
string |
No | Name for the Hashtag |
Licensed under the GNU License
Contributions of any kind are welcome. Feel free to either open a Pull Request or file an issue to participate in this project.