Twitter Clone using Java 17, Spring Boot, MYSQL, Liquibase, JWT, Gradle. Application is using JWT token to authenticate and authorize users.
This project is always updated with new features.
We have three main classes - User, Tweet and Subscription.
User class represents user in this application. User can register, create, update, delete, get tweets.
We have 2 types of authority: USER and ADMIN.
User can have roles 2 roles - ROLE_USER
and ROLE_ADMIN
, or 1 - ROLE_USER
or ROLE_ADMIN
.
Tweet class represents tweet in this application. Tweet can be created by user. Only authenticated user can create tweets. You can check the time when a tweet was created or updated by looking at the createdTimestamp or updatedTimestamp.
Subscription class represents subscribe/unsubscribe fuction betwen users in this application.
![](https://private-user-images.githubusercontent.com/95149324/270178618-c7a2097e-407b-4d2f-a099-a8daae110251.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2MjE1ODUsIm5iZiI6MTcyNTYyMTI4NSwicGF0aCI6Ii85NTE0OTMyNC8yNzAxNzg2MTgtYzdhMjA5N2UtNDA3Yi00ZDJmLWEwOTktYThkYWFlMTEwMjUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA2VDExMTQ0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ3MjhlNWY1Y2MwNzFkZTI1NzI3NjBjMDRiY2I1ODUyNWY4MzE4OGM1NmNlY2I4NGY3NDA0ZmJjNzI0OWM4ODMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.np4ATONA8rYaP63ZXRAtyujscEDOhbZoMxoqRsRmpiw)
POST -> "/api/v1/auth/register"
Request parameters:
NONE
Request body:
{
"name" : "Ivan Ivanov",
"password" : "1",
"email" : "[email protected]",
"role" :{
"authority" : "ROLE_USER" (by default 'ROLE_USER')
}
}
Authenticated:
NONE
POST -> "/api/v1/auth/login"
Request parameters:
NONE
Request body:
{
"name" : "Ivan Ivanov",
"password" : "1"
}
Authenticated:
NONE
POST -> "/api/v1/auth/refresh"
Request parameters:
NONE
Request body:
{
"refreshtoken": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJPbGVnIFpodWsiLCJpZCI6MywiaWF0IjoxNjk1NTg5MDk2LCJleHAiOjE2OTU1OTI2OTZ9.nK5pZjZS5cuMWq6e8A0UQX_awtSGf8eHGWHypso0NmYkkGna-CXZVbPnQkQsFkeWktONXdGN2WNtQv5mYKIgTA"
}
Authenticated:
NONE
GET -> "/api/v1/accounts/{id}"
Request parameters:
NONE
Request body:
NONE
Authenticated:
USER
,ADMIN
GET -> "/api/v1/roles""
Request parameters:
NONE
Request body: `NONE
Authenticated:
ADMIN
GET -> "/api/v1/roles/create""
Request parameters:
NONE
Request body:
{
"authority" : "NEW_ROLE"
}
Authenticated:
ADMIN
GET -> "/api/v1/tweets/{id}"
Request parameters:
NONE
Request body:
NONE
Authenticated:
USER
,ADMIN
GET -> "/api/v1/tweets/list"
Request parameters:
NONE
Request body:
{
"page" : "1",
"limit" : 10
}
Authenticated:
USER
,ADMIN
POST -> "/api/v1/tweets/create"
Request parameters:
NONE
Request body:
{
"id" : "5",
"message" : "my new tweet"
}
Authenticated:
USER
,ADMIN
PUT -> "/api/v1/tweets"
Request parameters:
NONE
Request body:
{
"id" : "5",
"message" : "i want to change my tweet"
}
Authenticated:
USER
,ADMIN
DELETE -> "/api/v1/tweets/{id}"
Request parameters:
NONE
Request body:
{
"id" : "5"
}
Authenticated:
USER
,ADMIN
POST -> "/api/v1/subscriptions/subscribe"
Request parameters:
NONE
Request body:
{
"followerId" : "3"
}
Authenticated:
USER
,ADMIN
POST -> "/api/v1/subscriptions/unsubscribe"
Request parameters:
NONE
Request body:
{
"followerId" : "2"
}
Authenticated:
USER
,ADMIN