DEV Community 👩‍💻👨‍💻

Cover image for Full Stack Reddit Clone - Spring Boot, React, Electron App - Part 1

Posted on • Updated on

Full Stack Reddit Clone - Spring Boot, React, Electron App - Part 1

Full Stack Reddit Clone - Spring Boot, React, Electron App - Part 1


In this series of blog posts, we will be building a Reddit clone with Spring Boot, React, and Electron. We will be using varying Spring Technologies like Spring Data JPA, Spring Security with JWT, and PostgreSQL for the database with Redis for Caching. The frontend portion will be using React with Typescript, Redux for state management, and Material-UI.

Important Links

Part 1: Backend Project Initialization 👩‍💻

Let's get started building the backend of this application, the first thing we will do is initialize the project using the Spring Initializer Website

  • Configure the project as follows

    • Project: Maven Project
    • Language: Java
    • Spring Boot: 2.3.2
    • Project Metadata:
    • Group: com.your-name-here
    • Artifact: backend
    • Packaging: JAR
    • Java: 11
    • Dependencies:
    • Lombok
    • Spring Web
    • Spring Security
    • Spring Data JPA
    • Java Mail Sender
    • Thymeleaf
    • PostgreSQL Driver
    • Spring Data Redis (Access+Driver)
  • Click generate project, download the project, and extract the contents somewhere safe.

  • Open the project in your favorite IDE, and ensure the project structure looks similar to below:

    alt text

Part 2: Additional Dependencies 📚

Now we need to add a couple additional dependencies that were not available in the project initializer

  • Open the pom.xml file and add the following dependencies for JWT Authentication, TimeAgo, Validator, and JavaFaker for future testing.

    <!-- JavaFaker related dependencies-->
    <!-- JWT related dependencies-->
    <!-- TimeAgo related dependencies-->

Part 3: Database, Hibernate, and Java Mail Configuration ⚙

Now we need to configure PostgreSQL, Hibernate JPA, Java Mail, and Redis

  • I am assuming you already have PostgreSQL, and Redis installed and setup.
  • PostgreSQL Installation
  • Redis Installation
  • You will also need to create an account at Mailtrap, to send account verification and notification emails. The reason this is needed is to have access to a fake SMTP Server through MailTrap. You can access the connections details by logging in, and selecting the cog icon on the demo inbox.
  • Open the src/main/resources/ file and add the following

    # Database Properties
    # Redis Properties
    # Mail Properties

Conclusion 🔍

  • To ensure everything is configured correctly you can run the application, and ensure there are no error in the console. Towards the bottom of the console you should see output similar to below

    alt text

  • In this article we covered the initialization of our Spring Boot backend.

  • Added JWT, TimeAgo, and JavaFaker dependencies for user authentication, displaying dates as relative time ago language, and generating fake data for future testing.

  • Added all the needed configuration for our backend to connect to our database, redis, and mail trap.

Next 📺

Part 2 Creating all of the domain entities, and repositories needed within the backend.

Top comments (0)

Update Your DEV Experience Level:


Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠