Skip to content
CalliCoder

4-part series

Spring Boot JWT Authentication with React

Read in order — each part builds on the code from the one before it, and each is written to stand on its own if you already have the earlier pieces in place.

  1. 01 Spring Boot, Spring Security and JWT with React — Part 1 Spring Boot · 11 min read The backend foundation for a JWT-authenticated app: dependencies, JPA auditing on a shared base class, User and Role entities with the join table, and seeding roles from code instead of a SQL file.
  2. 02 Spring Boot, Spring Security and JWT with React — Part 2 Spring Boot · 13 min read Email and password authentication: signup and signin endpoints, BCrypt, a UserDetailsService over the entities from part 1, and what a React client does with the token once it has one.
  3. 03 Spring Boot, Spring Security and JWT with React — Part 3 Spring Boot · 14 min read The polling API: JPA auditing for created/updated columns, why the vote count belongs in a query rather than a counter column, keyset-safe pagination, and the unique constraint that stops a double vote.
  4. 04 Spring Boot, Spring Security and JWT with React — Part 4 Spring Boot · 14 min read The React client: one request helper so the token header exists in a single place, a route guard that survives a page refresh, optimistic voting with a rollback, and the environment variable that is baked in at build time.