The Okku CLI offers a terminal based interface for sending and receiving text messages.
For development purposes you require Rust installed in your system and
Docker with docker-compose
as well.
It's recomended to install Rust using rustup.rs solution.
Environment variables specified on .env.sample
file are required by both,
the database and the server.
Create a .env
file with a copy of the contents available on the .env.sample
file and fill the relevant values.
Please make sure you have a
.env
file ready before going any further
The PostgreSQL database must be running in order for the server to run. Please issue the following command:
docker volume create --name okku-database && docker-compose up --build
This command will create a new volume to store database files with the name
okku-database
. And then will run docker-compose up --build
using the
docker-compose.yml
file available in the project's root directory.
In order to run the server you must issue:
cargo run
Name | Description | Method | URI | HTTP Headers | HTTP Req. Body | HTTP Res. Body |
---|---|---|---|---|---|---|
Login | Authenticates an existing user and retrieves a JWT token | GET | /api/v1/auth/login |
|
N/A |
{
"token": ":JWT Token"
}
|
Me | Retrieve Profile and User details for the authenticated user | GET | /api/v1/auth/me |
|
N/A |
{
"user": {
"id": "52933f2f-2a2f-4942-8398-a8aee83569c6",
"name": "foo"
},
"profile": {
"id": "0bc1eefd-6dd1-48dc-be2d-73c94ba7f984",
"first_name": null,
"email": "[email protected]",
"avatar": null,
"surname": null,
"birthday": null,
"contacts": null,
"bio": null
}
}
|
Sign Up | Registers a new user and retrieves a token | POST | /api/v1/auth/signup |
N/A |
{
"name": "foobar",
"password": "root",
"email": "[email protected]"
}
|
{
"token": ":Token",
"user": {
"id": "705c0c8f-9fc7-424d-a9c7-edc9df9146e0",
"name": "foobar"
}
}
|
Find User Chats | Retrive authenticated user chats | GET | /api/v1/chats |
|
N/A |
{
"chats": [
{
"id": "10c941f5-f2cc-4f74-890b-34ad5c24fadd",
"participants_ids": [
"56851552-eb2b-478b-8401-4abcd6754380",
"52933f2f-2a2f-4942-8398-a8aee83569c6"
]
}
]
}
|
Fetch Chat Messages | Retrieve chat's message history | GET | /api/v1/chats/:chat_id/messages |
|
N/A |
{
"messages": [
{
"id": "9fee900b-d92e-4e1e-ad35-b2593a7a53cb",
"body": "Hello world!",
"chat": {
"id": "10c941f5-f2cc-4f74-890b-34ad5c24fadd",
"participants_ids": [
"56851552-eb2b-478b-8401-4abcd6754380",
"52933f2f-2a2f-4942-8398-a8aee83569c6"
]
},
"author": {
"id": "56851552-eb2b-478b-8401-4abcd6754380",
"name": "foobar"
},
"created_at": "2021-02-13T02:12:39.235418Z"
}
]
}
|
Create Chat | Creates a new chat and specify its participants | POST | /api/v1/chats |
|
{
"participants_ids": [
"56851552-eb2b-478b-8401-4abcd6754380",
"52933f2f-2a2f-4942-8398-a8aee83569c6"
]
}
|
{
"id": "10c941f5-f2cc-4f74-890b-34ad5c24fadd",
"messages": [],
"participants_ids": [
"56851552-eb2b-478b-8401-4abcd6754380",
"52933f2f-2a2f-4942-8398-a8aee83569c6"
]
}
|
If you look closely to domain directory, you will notice that theres logic available for more features which is not exposed to the API.
These logic includes file management and profile details which used to be part of a release of this server on a Web Application.
Those features are now deprecated in order to focus on main functionality before going any further.
This project is part of my learning journey with Rust and implementing this features helped me understand more how the language works and what it has to offer.
If you are interested on working on some of these features, from the server side or the client side, feel free to reach me via an issue I will be happy to help!
This project is licensed under the MIT license
All contributions are welcome! Feel free to open a pull request or an issue