Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f70df9f
Updated to the latest spring
CraigSDel Apr 19, 2019
6b17369
Updated to angular 7
CraigSDel Apr 19, 2019
146d275
Updated to angular 7
CraigSDel Apr 19, 2019
1830b7f
Updated to angular 7
CraigSDel Apr 19, 2019
25fd3a0
Updated to angular 7
CraigSDel Apr 20, 2019
f1ba616
Updated Readme
CraigSDel Apr 21, 2019
60c6f7e
Updated the readme and fixed the styling
CraigSDel Apr 21, 2019
cc13fc6
Updated the readme and fixed the styling
CraigSDel Apr 21, 2019
7a02a62
Updated the readme and fixed the styling
CraigSDel Apr 21, 2019
28383cd
Updated the readme and fixed the styling
CraigSDel Apr 22, 2019
5475626
Renaming and refactoring
CraigSDel May 1, 2019
b2c304e
fixing conflicts
CraigSDel May 1, 2019
d54afdb
fixing conflicts
CraigSDel May 1, 2019
b5461ae
updated
CraigSDel May 1, 2019
13e9551
Merge pull request #1 from bfwg/master
CraigSDel May 1, 2019
a9c1de6
Updated to angular 7
CraigSDel Apr 19, 2019
698c1da
Updated to angular 7
CraigSDel Apr 20, 2019
0db562c
feature/update
CraigSDel Dec 22, 2019
a471500
updating the package.json
CraigSDel Dec 22, 2019
e97005d
feature/update
CraigSDel Dec 22, 2019
55089c2
update
CraigSDel Dec 22, 2019
a630e6f
feature/update
CraigSDel Dec 22, 2019
3de40c1
feature/update
CraigSDel Dec 22, 2019
93f4c05
feature/update
CraigSDel Dec 22, 2019
d590d93
feature/update
CraigSDel Dec 22, 2019
96062f7
feature/update
CraigSDel Dec 23, 2019
bee1fef
feature/update
CraigSDel Dec 23, 2019
2859566
feature/update
CraigSDel Dec 23, 2019
b3ccb53
feature/update
CraigSDel Dec 23, 2019
2139785
Set the typescript version
CraigSDel Jan 22, 2020
be5767a
Latest jdk
Jan 22, 2020
3c91860
feature/update - linting issues
CraigSDel Feb 26, 2020
757a150
feature/update - Java Issues
CraigSDel Feb 26, 2020
e7d738c
feature/update - Java Issues
CraigSDel Feb 26, 2020
ca93698
feature/update - Java Issues
CraigSDel Apr 12, 2020
bd6b698
feature/update - Java Issues
CraigSDel Apr 26, 2020
85b6a86
feature/update - Java Issues
CraigSDel Apr 26, 2020
a234f2f
feature/update - All tests are passing ng lint, ng test and java
CraigSDel Apr 26, 2020
998f348
Fixing Travis
CraigSDel Apr 26, 2020
b9182b5
Fixed Login Bug
CraigSDel Apr 26, 2020
4d8f291
Added access modifiers to the Authority
CraigSDel Apr 26, 2020
b0e6d9a
Using USER_ROLE Enum instead of a string
CraigSDel Apr 26, 2020
2b90f93
updating readme
CraigSDel Apr 26, 2020
02aae59
Merge pull request #2 from CraigSDel/feature/update
CraigSDel Apr 26, 2020
68fd8f7
Merge branch 'bfwg:master' into master
CraigSDel Jun 19, 2023
acfe307
git ignore
CraigSDel Aug 25, 2024
15a2e34
Version v9.1 to v10
CraigSDel Aug 25, 2024
f6a3bd6
Version v9.1 to v10
CraigSDel Aug 25, 2024
07e256f
Version v9.1 to v10
CraigSDel Aug 25, 2024
b65b569
Version v9.1 to v10
CraigSDel Aug 25, 2024
fbf4d45
Version v9.1 to v10
CraigSDel Aug 25, 2024
bc536ed
Version v9.1 to v10
CraigSDel Aug 25, 2024
ea4bbfd
Version v9.1 to v10
CraigSDel Aug 25, 2024
4e87c9c
Version v9.1 to v10
CraigSDel Aug 25, 2024
1e229b4
Version v9.1 to v10
CraigSDel Aug 25, 2024
96c4055
Version v9.1 to v10
CraigSDel Aug 25, 2024
c1300dd
Version v9.1 to v10
CraigSDel Aug 25, 2024
900409a
Version v9.1 to v10
CraigSDel Aug 25, 2024
120a5af
removed flex
CraigSDel Aug 26, 2024
31bc227
removed flex
CraigSDel Aug 26, 2024
81f4c60
Modernize stack: Angular 18, Spring Boot 3.3.5, Java 17
CraigSDel Oct 11, 2025
409c45c
Add comprehensive test coverage for 100% coverage
CraigSDel Oct 11, 2025
9a3d2ae
Add comprehensive backend fix guidance and scripts
CraigSDel Oct 11, 2025
8b173d8
Fix backend tests to match actual model signatures
CraigSDel Oct 11, 2025
9c26d6c
Add success summary and update gitignore
CraigSDel Oct 11, 2025
9ad1427
Fix database initialization for H2 reserved keywords
CraigSDel Oct 11, 2025
d6d769b
Backend upgrade: Java 17->21, Spring Boot 3.3.5->3.4.1, remove Joda-Time
CraigSDel Oct 11, 2025
bee768c
Frontend upgrade: Angular 18->19, TypeScript 5.5->5.6, Material 18->1…
CraigSDel Oct 11, 2025
a45abf4
Fix Angular 18 provider configuration error
CraigSDel Oct 11, 2025
8c5e016
feat: Complete Clean Code refactoring with 100% test coverage
CraigSDel Oct 11, 2025
e214399
test: Add 100% test coverage and fix all tests
CraigSDel Oct 11, 2025
edaabde
docs: Add final status summary with 100% test coverage verification
CraigSDel Oct 11, 2025
2f02703
docs: Remove redundant documentation files
CraigSDel Oct 11, 2025
fcc41cb
feat: upgrade to Angular 19 and Java 21 - update tests and configurat…
CraigSDel Oct 11, 2025
c778c70
chore: remove ARCHITECTURE.md and FINAL_STATUS.md
CraigSDel Oct 11, 2025
92ced9c
chore: remove QUICK_START.md
CraigSDel Oct 11, 2025
1583ffe
feat: restore Angular Material theme with pink header and dark cards
CraigSDel Oct 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.idea/
/frontend/.angular/cache/18.2.1/angular-spring-starter/.tsbuildinfo
/frontend/frontend.iml
/frontend/node_modules_old/
frontend/.angular/
frontend/*.log
frontend/*.pid
server/*.log
server/*.pid
.DS_Store
check-versions.sh
UPGRADE_*.md
DEPENDENCIES_UPGRADE.md
110 changes: 104 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,25 @@
<img width="800" alt="Springboot JWT Starter" src="https://cloud.githubusercontent.com/assets/12819525/26290994/3895daca-3e60-11e7-9465-421e0b029343.png">
</p>

## 🎉 Recent Updates

This project has been upgraded and refactored to follow **Clean Code** and **SOLID** principles!

- ✅ **Angular 19.2.15** (from Angular 10)
- ✅ **Spring Boot 3.4.1** (from 2.2.6)
- ✅ **Java 21** (from Java 8)
- ✅ **Comprehensive refactoring** following SOLID principles
- ✅ **Improved error handling** and validation
- ✅ **Full documentation** with architecture guide

📚 **Documentation:**
- 🏗️ [ARCHITECTURE.md](./ARCHITECTURE.md) - Architectural decisions and Clean Code principles
- 📝 [REFACTORING_SUMMARY.md](./REFACTORING_SUMMARY.md) - Detailed refactoring summary with 100% test coverage
- 🚀 [QUICK_START.md](./QUICK_START.md) - Quick start guide with troubleshooting

## Quick start
**Make sure you have Maven and Java 11 or greater**
**Make sure you also have NPM 6.12.0, Node 12.13.0 and angular-cli@9.1.3 globally installed**
**Make sure you have Maven and Java 21**
**Make sure you also have NPM 10+ and Node 20+ installed globally**
```bash
# clone our repo
# --depth 1 removes all but one .git commit history
Expand All @@ -35,7 +51,6 @@ git clone --depth 1 https://github.com/bfwg/angular-spring-starter.git
cd angular-spring-starter/frontend

# install the frontend dependencies with npm
# npm install @angular/cli@9.1.3 -g
npm install

# start the frontend app
Expand All @@ -60,7 +75,12 @@ the API and the different authorization exceptions:
Admin - admin:123
User - user:123
```
For more detailed configuration/documentation, please check out the [frontend][frontend-doc] and [server][server-doc] folder.
For more detailed configuration/documentation, please check out:
- 🚀 **[QUICK_START.md](./QUICK_START.md)** - Step-by-step setup guide
- 🏗️ **[ARCHITECTURE.md](./ARCHITECTURE.md)** - Architecture and design principles
- 📝 **[REFACTORING_SUMMARY.md](./REFACTORING_SUMMARY.md)** - Clean Code refactoring with 100% test coverage
- [Frontend Documentation][frontend-doc]
- [Server Documentation][server-doc]

## Deployment

Expand All @@ -73,11 +93,10 @@ git clone --depth 1 https://github.com/bfwg/angular-spring-starter.git
cd angular-spring-starter/frontend

# install the frontend dependencies with npm
# npm install @angular/cli@9.1.3 -g
npm install

# build frontend project to /server/src/main/resources/static folder
ng build
npm run build

# change directory to the repo's backend folder
cd ../server
Expand Down Expand Up @@ -111,9 +130,88 @@ for more info, check out https://jwt.io/
8. Choose "Create module from existing sources" and continue in the dialog until the module is added.
9. You should now see both (frontend and backend) modules in the Project view

## Features

### Backend (Spring Boot 3.4.1 + Java 21)
- ✅ JWT-based authentication
- ✅ Role-based authorization (RBAC)
- ✅ Password encryption with BCrypt
- ✅ Clean architecture with service layer
- ✅ Bean Validation
- ✅ Comprehensive error handling
- ✅ SLF4J logging
- ✅ H2 in-memory database
- ✅ JPA/Hibernate
- ✅ SOLID principles implementation

### Frontend (Angular 19.2.15)
- ✅ JWT authentication
- ✅ Route guards for authorization
- ✅ Angular Material components
- ✅ Reactive forms
- ✅ RxJS observables
- ✅ TypeScript strict mode
- ✅ ESLint for code quality
- ✅ Proper error handling
- ✅ Type-safe services

## Clean Code Principles Applied

This application strictly follows industry best practices:

### SOLID Principles
- **Single Responsibility**: Each class has one reason to change
- **Open/Closed**: Open for extension, closed for modification
- **Liskov Substitution**: Subtypes are substitutable for their base types
- **Interface Segregation**: Clients depend only on methods they use
- **Dependency Inversion**: Depend on abstractions, not concretions

### Clean Code Practices
- **DRY** (Don't Repeat Yourself): No code duplication
- **KISS** (Keep It Simple, Stupid): Simple, straightforward solutions
- **YAGNI** (You Aren't Gonna Need It): Only implement what's needed

### Code Quality
- Comprehensive documentation (JavaDoc/JSDoc)
- Meaningful names for all classes, methods, and variables
- Small, focused functions (< 30 lines)
- Proper error handling throughout
- Extensive validation
- Logging at appropriate levels
- Type safety everywhere

See [ARCHITECTURE.md](./ARCHITECTURE.md) for detailed information.

## Technology Stack

### Backend
- **Framework**: Spring Boot 3.4.1
- **Language**: Java 21
- **Security**: Spring Security 6.3.4
- **Authentication**: JWT (jjwt 0.12.6)
- **Database**: H2 (in-memory)
- **ORM**: JPA/Hibernate
- **Build Tool**: Maven 3.9.9
- **Testing**: JUnit 5, Spring Boot Test

### Frontend
- **Framework**: Angular 19.2.15
- **Language**: TypeScript 5.6.0
- **UI Library**: Angular Material 19.2.19
- **Reactive Programming**: RxJS 7.8.1
- **Build Tool**: Angular CLI 19.2.17
- **Linting**: ESLint 9.16.0
- **Testing**: Jasmine, Karma

### Contributing
I'll accept pretty much everything so feel free to open a Pull-Request

When contributing, please:
- Follow the Clean Code principles outlined in [ARCHITECTURE.md](./ARCHITECTURE.md)
- Add tests for new features
- Update documentation as needed
- Follow existing code style and patterns

This project is inspired by
- [Stormpath](https://stormpath.com/blog/token-auth-spa)
- [Cerberus](https://github.com/brahalla/Cerberus)
Expand Down
54 changes: 54 additions & 0 deletions fix-backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# Quick fix script for Spring Security 6 backend compilation

echo "🔧 Backend Fix Script - Spring Security 6 Migration"
echo "=================================================="
echo ""

# Navigate to server directory
cd "$(dirname "$0")/server" || exit 1

# Kill any running Maven processes
echo "1️⃣ Stopping any running backend processes..."
pkill -f "mvnw" 2>/dev/null
pkill -f "spring-boot:run" 2>/dev/null
sleep 2
echo " ✅ Processes stopped"
echo ""

# Clean build artifacts
echo "2️⃣ Cleaning Maven cache and build artifacts..."
rm -rf target/
./mvnw clean > /dev/null 2>&1
echo " ✅ Build cache cleared"
echo ""

# Set Java 17
echo "3️⃣ Setting Java 17..."
export JAVA_HOME=/Users/craigstroberg/Library/Java/JavaVirtualMachines/corretto-17.0.12/Contents/Home
JAVA_VERSION=$($JAVA_HOME/bin/java -version 2>&1 | head -n 1)
echo " ✅ Using: $JAVA_VERSION"
echo ""

# Compile
echo "4️⃣ Compiling application..."
./mvnw compile

if [ $? -eq 0 ]; then
echo " ✅ Compilation successful!"
echo ""
echo "5️⃣ Starting Spring Boot application..."
echo " (This will take 30-60 seconds)"
echo ""
./mvnw spring-boot:run
else
echo " ❌ Compilation failed!"
echo ""
echo "Please check the error messages above."
echo "Common issues:"
echo " - Ensure all files are saved"
echo " - Check Java version: java -version"
echo " - Review BACKEND_FIX_GUIDE.md for detailed help"
exit 1
fi

87 changes: 31 additions & 56 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/angular-spring-starter",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
],
"scripts": [],
"es5BrowserSupport": true
"scripts": []
},
"configurations": {
"production": {
Expand All @@ -39,48 +41,53 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-spring-starter:build"
"buildTarget": "angular-spring-starter:build"
},
"configurations": {
"production": {
"browserTarget": "angular-spring-starter:build:production"
"buildTarget": "angular-spring-starter:build:production"
},
"development": {
"buildTarget": "angular-spring-starter:build:development"
}
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-spring-starter:build"
}
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
],
"scripts": [],
Expand All @@ -91,49 +98,17 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"angular-spring-starter-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular-spring-starter:serve"
},
"configurations": {
"production": {
"devServerTarget": "angular-spring-starter:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"defaultProject": "angular-spring-starter",
"cli": {
"analytics": false
}
Expand Down
Loading