一个面向生产环境的 Spring Boot 3 REST API 模板,内置 JWT 认证、限流、Docker 和 CI/CD,旨在消除样板代码的搭建工作。

Stars

21

7 天增长

暂无数据

Fork 数

0

开放 Issue

0

开源协议

暂无数据

最近更新

2026-06-27

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它提供了完整的、有主见的入门套件,支持两种认证策略(JWT 和 Spring Session),内置限流、Flyway 迁移以及完整的 CI/CD 流程(部署到 EC2),可节省数小时的初始项目配置时间。

适合谁使用

  • 开始新 REST API 项目的 Java/Spring Boot 开发者
  • 需要标准化、安全 API 模板的团队
  • 希望使用 Docker + Nginx + MySQL 配置的开发者
  • 寻找现成 GitHub Actions 工作流的 CI/CD 实践者

典型使用场景

  • 构建需要用户认证的微服务或单体 REST API
  • 快速原型开发安全的后端服务,最小化设置
  • 教学或学习 Spring Boot 安全、JWT 和 DevOps 模式
  • 需要基于角色的访问和限流的内部工具 API

项目优势

  • 功能全面,包括带刷新令牌轮换的 JWT、基于角色的访问控制及 Bucket4j 限流
  • 提供两种并行的认证方式(JWT 和 Spring Session),适应不同客户端场景
  • 通过 Docker Compose、Nginx 反向代理和 MySQL 完全容器化
  • 自动化 CI/CD 流程:测试、构建 Docker 镜像并部署到 EC2

使用前须知

  • JWT 无状态特性导致撤销令牌需要使刷新令牌失效;不适用于浏览器应用(除非使用 Spring Session)
  • 仅支持 MySQL 或 H2 数据库,未内置其他数据库支持
  • 默认管理员凭据在启动时已注入,生产部署前必须通过环境变量修改

README 快速开始

🚀 Spring Boot Starter Kit

Stop copy-pasting boilerplate. Clone this, rename the package, and ship.

A production-ready Spring Boot 3 REST API template with everything you need baked in — JWT auth, rate limiting, Swagger docs, Docker, GitHub Actions CI/CD, and more.


✨ Features

FeatureDetails
🔐 JWT AuthenticationAccess token (15 min) + Refresh token (7 days) with rotation
👮 Role-Based Access ControlROLE_USER and ROLE_ADMIN via @PreAuthorize
🚦 Rate LimitingPer-IP rate limiting using Bucket4j (configurable)
📄 OpenAPI 3 / Swagger UIAuto-generated docs at /swagger-ui.html
🛡️ Global Exception HandlingConsistent ApiResponse across all endpoints
🗃️ Flyway MigrationsVersion-controlled schema with rollback support
🐳 Docker + Docker ComposeMulti-stage build, nginx reverse proxy, MySQL
⚙️ CI/CD via GitHub ActionsTest → Build → Push Docker → Deploy to EC2
📊 Actuator/actuator/health, /actuator/metrics
🔍 Request ID TrackingMDC-based request ID in every log line
🌍 CORS ConfiguredConfigurable via environment variables
Bean ValidationJakarta Validation on all request DTOs

📁 Project Structure

src/main/java/com/starterkit/
├── config/              # Security, Swagger, DataInitializer
├── controller/          # AuthController, UserController, HealthController
├── dto/
│   ├── request/         # RegisterRequest, LoginRequest, RefreshTokenRequest
│   └── response/        # ApiResponse, AuthResponse, UserResponse
├── entity/              # User, Role, RefreshToken
├── exception/           # GlobalExceptionHandler + custom exceptions
├── filter/              # JwtAuthFilter, RateLimitFilter, RequestIdFilter
├── repository/          # JPA repositories
├── security/            # JwtService, UserDetailsServiceImpl
└── service/             # AuthService, UserService

🚀 Quick Start

Prerequisites

  • Java 17+
  • Maven 3.8+
  • Docker & Docker Compose

Option 1 — Run locally (H2 in-memory, zero setup)

git clone https://github.com/raahulllkushw

项目描述

🚀 Production-ready Spring Boot 3 starter — JWT, Rate Limiting, Swagger, Docker, CI/CD Public ✅

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

oversecured
oversecured GitHub avatar

Samsung_Vulnerabilities

Oversecured discloses a report of 176 vulnerabilities discovered in Samsung preinstalled apps between 2022 and 2025, with 140 detailed, all fixed in collaboration with Samsung.

Java
310
wxxsfxyzm
wxxsfxyzm GitHub avatar

MiuiBackGestureHook

An LSPosed module that hooks MIUI SystemUI back gestures using modern Xposed API 102 for research and customization.

Java
86
SangLuoCN
SangLuoCN GitHub avatar

OneStep4

OneStep4.0 is a multi-window desktop container for Android that requires root or system-level privileges, enabling a main window with several side windows for efficient app multitasking.

Java
84