DEV Community

Cover image for AuthKit : Spring Boot JWT Authentication Boilerplate
boiler_agents
boiler_agents

Posted on

AuthKit : Spring Boot JWT Authentication Boilerplate

TL;DR: Skip the repetitive Spring Boot security setup. AuthKit is a paid Gumroad starter kit with JWT, refresh tokens, roles, and clean structure. Ready to plug into your project.


Introduction

If you’ve set up authentication in Spring Boot before, you know how it goes: security config, JWT handling, refresh tokens, password hashing, roles, and all the “not fun” boilerplate.

It’s repetitive, easy to get wrong, and slows down your actual project.

AuthKit takes care of all of that for you. It’s a downloadable starter kit from Gumroad that gives you a production-ready authentication layer, so you can get straight to building your features.


Why this boilerplate?

  • Saves time: No need to reimplement JWT login or refresh tokens again.
  • Secure by default: BCrypt hashing, JWT best practices, role-based access.
  • Clean structure: Controllers, services, repositories, and DTOs organized.
  • Plug-and-play: Grab the ZIP, configure, and run in minutes.

Features

  • 🔑 JWT Authentication & Refresh Tokens — login with short-lived tokens + refresh support
  • 👤 User & Role Management — ready-to-use signup/login + GET /api/users/me
  • 🔒 Password Hashing — secure BCrypt out of the box
  • 🛡️ Role-Based Authorization@PreAuthorize and security config supported
  • Modern Spring Security 6 — no deprecated configs
  • 🗂️ Organized Project Layout — clean, extensible structure
  • 📦 Starter Pack — includes Postman collection for quick API testing

Prerequisites

  • Java 21
  • Maven 3.8+
  • MySQL

Quick Start

  1. Grab the ZIP from Gumroad: 👉 Download AuthKit on Gumroad
  2. Extract the ZIP anywhere on your machine.
  3. Open the project in your favorite IDE (IntelliJ, Eclipse, VS Code).
  4. Update database + JWT config in src/main/resources/application.properties.

Example application.properties:

# Application Name
spring.application.name=AuthKit

# Database Configuration (MySQL example)
spring.datasource.url=jdbc:mysql://localhost:3306/boiler_agents_auth_kit_db
spring.datasource.username=root
spring.datasource.password=<your-password>

# Hibernate / JPA
spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
spring.jpa.properties.hibernate.allow_update_outside_transaction=true

# JWT
app.jwt.secret=<change-me-to-a-very-long-random-string>
app.jwt.access-token-expiration-ms=900000
app.jwt.refresh-token-expiration-ms=1209600000
Enter fullscreen mode Exit fullscreen mode
  1. Run the app: Run as spring boot app. It will start with port 8080.

Usage

Once running, you can test the endpoints right away:

  • POST /api/auth/register → register a new user
  • POST /api/auth/login → login & receive JWT tokens
  • POST /api/auth/refresh → refresh your access token
  • GET /api/users/me → fetch logged-in user info

👉 Use the included Postman collection (auth-kit.postman_collection.json) for quick API tests.


Project Structure

auth-kit/
├── pom.xml
├── readme.md
├── license.md                          # MIT License
├── auth-kit.postman_collection.json    # Postman collection
│
└── src/
    ├── main/java/com/auth/
    │   ├── config/        # Security & app configs
    │   ├── controllers/   # REST endpoints
    │   ├── dtos/          # Request/response objects
    │   ├── entities/      # Database models
    │   ├── exceptions/    # Custom exceptions + handler
    │   ├── repositories/  # JPA repositories
    │   ├── security/      # Auth service, filters, JWT utils
    │   └── services/      # Business logic
    │
    └── test/java/com/auth/
        └── AuthKitApplicationTests.java
Enter fullscreen mode Exit fullscreen mode

Who Is This For?

AuthKit is perfect for:

  • Developers who want secure JWT auth in minutes, not days.
  • Teams bootstrapping new Spring Boot apps.
  • Freelancers/indie devs shipping MVPs fast.
  • Anyone tired of copy-pasting security configs across projects.

License

This project is under the MIT License.


About Boileragents

We build developer-friendly starter kits so you don’t have to waste time on setup.


Take a look

Closing

Save time, avoid mistakes, and start coding your real features faster.
👉 Get AuthKit on Gumroad

If this starter helps, don’t forget to leave a ⭐ on the repo and share your feedback!
Need a custom feature? Reach out at boileragents@gmail.com.


👉 Subscribe to get updates on new boilerplates, free resources, and practical tips — https://boileragent.gumroad.com/

Top comments (0)