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.
POST -> "/api/v1/auth/register"
Request parameters:
NONE
Request body:
{
"name" : "Ivan Ivanov",
"password" : "1",
"email" : "ivanov123@gmail.com",
"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