This project is a Twitter-like backend application built using Spring Boot and Maven. It provides RESTful APIs to perform various Twitter-like functionalities such as posting tweets, following/unfollowing users, and fetching timelines.
- the main branch uses local db and stores images in project folder
- the another branch built used cloud db to store images and data
- Java (version : JDK 21 LTS)
- Spring Boot (version 3.4.1)
- Dependencies
- Spring Web
- Spring Security
- Spring Data Jpa
- MySQL Driver
- Lombok
- JJWT (JWT Authentication)
- Maria DB
Step 1 : Clone the Repo.
Step 2 : rename the ".env.example" file to ".env"
Step 3 : Setup the Environment variables using .env file by Your db url and password
Example :
DB_URL= "Write Your DB URL starts With JDBC"
DB_USERNAME= "username here"
DB_PASSWORD= "password here"
JWT_SECRET="enter the secret"
step 4 : Run the application
- Creating Accounts
- Deleting Accounts
- Following Users
- Followers
- Posts
- Tweets
- Likes
- comments
- Authentication and Authorization ( username and password )
- JWT Authentication and Authorization
CREATE TABLE users_table (
id bigint NOT NULL AUTO_INCREMENT,
user_id varchar(50) NOT NULL UNIQUE,
user_name varchar(50) NOT NULL,
user_dob date DEFAULT NULL,
user_email varchar(50) NOT NULL,
user_passwd varchar(100) NOT NULL,
time_stamp varchar(255) DEFAULT NULL,
user_pic varchar(255) DEFAULT NULL,
banner_pic varchar(255) DEFAULT NULL,
followers bigint DEFAULT NULL,
following bigint DEFAULT NULL,
PRIMARY KEY (id)
);
CREATE TABLE tweets_table (
tweet_id bigint NOT NULL AUTO_INCREMENT,
user_id varchar(255) DEFAULT NULL,
tweet_filepath varchar(255) DEFAULT NULL,
hashtags varchar(255) DEFAULT NULL,
time_stamp varchar(255) DEFAULT NULL,
tweet_content varchar(255) DEFAULT NULL,
likes_count bigint DEFAULT NULL,
PRIMARY KEY (tweet_id)
);
CREATE TABLE comments_table (
id bigint NOT NULL AUTO_INCREMENT,
comment_content varchar(255) DEFAULT NULL,
time_stamp varchar(255) DEFAULT NULL,
tweet_id bigint DEFAULT NULL,
user_id varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
CREATE TABLE likes_table (
id bigint NOT NULL AUTO_INCREMENT,
liked_by varchar(255) DEFAULT NULL,
tweet_id bigint DEFAULT NULL,
time_stamp varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
CREATE TABLE followers_table (
id bigint NOT NULL AUTO_INCREMENT,
followed_by varchar(255) DEFAULT NULL,
time_stamp varchar(255) DEFAULT NULL,
user_id varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
CREATE TABLE following_table (
id bigint NOT NULL AUTO_INCREMENT,
following varchar(255) DEFAULT NULL,
time_stamp varchar(255) DEFAULT NULL,
user_id varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
POST - localhost:8080/register
- REGISTER USER
GET - localhost:8080/{userId}
- GET USER DETAILS
DELETE - localhost:8080/{userId}
- DELETE USER
PUT - localhost:8080/{userId}/follow
- FOLLOW USER
PUT - localhost:8080/{userId}/unfollow
- UNFOLLOW USER
GET - localhost:8080/home
- FEED POSTS
POST - localhost:8080/home
- POST TWEET
DELETE - localhost:8080/home/{tweetId}
- DELETE TWEET
PUT - localhost:8080/home/{tweetId}/comment
- POST COMMENT
DELETE - llocalhost:8080/home/{tweetId}/comment
- DELETE COMMENT
PUT - localhost:8080/home/{tweetId}/like
- LIKE POST
PUT - localhost:8080/home/{tweetId}/dislike
- DISLIKE POST