Skip to content

arpitraj11/InstaBackend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Instagram Backend

Java Maven Spring Boot MySQL

This project is a basic web application that allows users to sign in, sign up, and manage their profile information. Additionally, users can create posts and view posts created by other users. The application uses authentication tokens to secure user data and ensure that only authenticated users can access certain features of the application.



Framework Used

  • Spring Boot


Dependencies

The following dependencies are required to run the project:

  • Spring Boot Dev Tools
  • Spring Web
  • Spring Data JPA
  • MySQL Driver
  • Lombok
  • Validation
  • Swagger

Database Configuration

To connect to a MySQL database, update the application.properties file with the appropriate database URL, username, and password. The following properties need to be updated:

spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/<DatabaseName>
spring.datasource.username = <userName>
spring.datasource.password = <password>
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true

Language Used

  • Java


Data Model

The Job data model is defined in the Job class, which has the following attributes:

  • User Model
Id : integer
UserName : String
instagramName : string
instagramBio : string
email : string
password : string
isBlueTicked : boolean
  • Like Model
  LikeId : Integer
  InstaPost:post(@ManytoOne)
  Liker: User(@ManyToOne)
  • Post Model
postContent = String
createdDate : LocalDateTime
postData : String
postCaption : string
postlocation : string
postType:PostType
user : User(@ManyToOne)
  • Follow Model
followingTableId = Integer
currentUser : User (ManyToOne)
currentUserFollower : User (ManyToOne)
  • InstagramComment Model
commentId = Integer
commentBody : String
commentCreationTimeStamp : LocalDatetime(Access.READ_ONLY)
instaPost : Post(ManyToOne)
commenter : User (ManyToOne)
  • Authentication Token
tokenId : Long
token : string
tokenCreationDate : LocalDate
@OneToOne 
user : User
  • Admin Token
adminId : Long
adminName : String
adminEmail : string(regexp = "^.+@instaAdmin\\.com$")
adminPassword: String

Data Flow

  1. The user at client side sends a request to the application through the API endpoints.
  2. The API receives the request and sends it to the appropriate controller method.
  3. The controller method makes a call to the method in service class.
  4. The method in service class builds logic and retrieves or modifies data from the database, which is in turn given to controller class
  5. The controller method returns a response to the API.
  6. The API sends the response back to the user.


API End Points

The following endpoints are available in the API:

  • User Controller:
 @PostMapping("user/signup")
 @PostMapping("user/signIn")
 @DeleteMapping("user/signOut")
 @PostMapping("post")
 @DeleteMapping("post")
 @PostMapping("comment")
 @DeleteMapping("comment")
 @PostMapping("like")
 @GetMapping("like/count/post/{postId}")
 @DeleteMapping("like")
 @PostMapping("follow")
 @DeleteMapping("unfollow/target/{followId}")
   

DataBase Used

  • SQL database
We have used Persistent database to implement CRUD Operations.


Project Summary

The project is a basic web application built using Java and the Spring framework. It allows users to sign up, sign in, and manage their profile information. Users can also create and view posts. The application uses authentication tokens to secure user data and ensure that only authenticated users can access certain features. The API endpoints include user signup, signin, and update details, post creation and retrieval, and authentication token creation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages