forked from gothinkster/spring-boot-realworld-example-app
-
Notifications
You must be signed in to change notification settings - Fork 13
Modernization: DDD layering, security hardening, observability, containerization & CI/CD #558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devin-ai-integration
wants to merge
13
commits into
master
Choose a base branch
from
devin/1776363417-modernization-phases
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
43681c2
Apply Spotless formatting
gardnerjohnson-creator 5271662
Add testing verification note to README
devin-ai-integration[bot] e300b6a
Merge pull request #1 from gardnerjohnson-creator/devin/1756173620-te…
gardnerjohnson-creator 5708c27
Add React frontend application
devin-ai-integration[bot] e16ea3f
Fix critical issues in React frontend
devin-ai-integration[bot] c20e1f6
Merge pull request #2 from gardnerjohnson-creator/devin/1756177143-ad…
gardnerjohnson-creator 4e6f833
feat: extract core-layer read service interfaces with adapter pattern…
devin-ai-integration[bot] 432a50e
feat: security hardening with SecurityFilterChain, constructor inject…
devin-ai-integration[bot] 6840cf6
feat: add observability with actuator, prometheus, structured logging…
devin-ai-integration[bot] 6d694d1
feat: add containerization and CI/CD with Dockerfile, docker-compose,…
devin-ai-integration[bot] 024ec72
fix: bound RateLimitFilter bucket map size and remove X-Forwarded-For…
devin-ai-integration[bot] 89ff0e0
fix: upgrade deprecated GitHub Actions versions in gradle.yml (v2 → v4)
devin-ai-integration[bot] 7f607ad
merge: resolve conflict with master (accept gradle.yml deletion)
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .gradle/ | ||
| build/ | ||
| dev.db | ||
| *.md | ||
| .git/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| branches: [main, master] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 11 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '11' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Cache Gradle packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.gradle/caches | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
|
|
||
| - name: Check formatting | ||
| run: ./gradlew spotlessCheck | ||
|
|
||
| - name: Run tests | ||
| run: ./gradlew test | ||
|
|
||
| - name: Build JAR | ||
| run: ./gradlew bootJar | ||
|
|
||
| - name: Build Docker image | ||
| run: docker build -t realworld-app:${{ github.sha }} . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Stage 1: Build | ||
| FROM gradle:7.6-jdk11 AS build | ||
| WORKDIR /app | ||
| COPY build.gradle settings.gradle ./ | ||
| COPY gradle ./gradle | ||
| COPY src ./src | ||
| RUN gradle bootJar --no-daemon -x test | ||
|
|
||
| # Stage 2: Run | ||
| FROM eclipse-temurin:11-jre-alpine | ||
| WORKDIR /app | ||
| RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
| COPY --from=build /app/build/libs/*.jar app.jar | ||
| USER appuser | ||
| EXPOSE 8080 | ||
| HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:8080/actuator/health || exit 1 | ||
| ENTRYPOINT ["java", "-jar", "app.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| version: '3.8' | ||
| services: | ||
| app: | ||
| build: . | ||
| ports: | ||
| - "8080:8080" | ||
| environment: | ||
| - SPRING_PROFILES_ACTIVE=dev | ||
| - JWT_SECRET=ZGV2LXNlY3JldC1rZXktdGhhdC1pcy1hdC1sZWFzdC02NC1ieXRlcy1sb25nLWZvci1oczUxMi1hbGdvcml0aG0= | ||
| - CORS_ORIGINS=http://localhost:3000 | ||
| depends_on: | ||
| - db | ||
| db: | ||
| image: postgres:15-alpine | ||
| environment: | ||
| POSTGRES_DB: realworld | ||
| POSTGRES_USER: realworld | ||
| POSTGRES_PASSWORD: realworld | ||
| ports: | ||
| - "5432:5432" | ||
| volumes: | ||
| - pgdata:/var/lib/postgresql/data | ||
|
|
||
| volumes: | ||
| pgdata: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # API Configuration | ||
| VITE_API_BASE_URL=http://localhost:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # API Configuration | ||
| # Copy this file to .env and update the values as needed | ||
| VITE_API_BASE_URL=http://localhost:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # RealWorld Frontend | ||
|
|
||
| A modern React frontend application that consumes the Spring Boot RealWorld API. | ||
|
|
||
| ## Features | ||
|
|
||
| - **User Authentication** - Registration, login, JWT token management | ||
| - **Article Management** - Create, view, edit, delete articles with markdown support | ||
| - **Article Feed** - Global feed displaying all articles with pagination | ||
| - **User Profiles** - User information and article listings | ||
| - **Comments System** - Add and view comments on articles | ||
| - **Social Features** - Following users, favoriting articles | ||
| - **Tag System** - Article categorization and filtering | ||
| - **Responsive Design** - Modern UI built with Tailwind CSS | ||
|
|
||
| ## Technology Stack | ||
|
|
||
| - **React 18** with TypeScript for type safety | ||
| - **Vite** for fast development and building | ||
| - **Tailwind CSS** for modern, responsive styling | ||
| - **React Router** for navigation | ||
| - **Axios** for API communication with JWT authentication | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 16+ and npm | ||
| - Spring Boot backend running on http://localhost:8080 | ||
|
|
||
| ### Installation | ||
|
|
||
| ```bash | ||
| cd frontend | ||
| npm install | ||
| ``` | ||
|
|
||
| ### Development | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| ``` | ||
|
|
||
| The application will be available at http://localhost:3000 | ||
|
|
||
| ### Build for Production | ||
|
|
||
| ```bash | ||
| npm run build | ||
| ``` | ||
|
|
||
| ## API Integration | ||
|
|
||
| The frontend integrates with the Spring Boot RealWorld API running on localhost:8080: | ||
|
|
||
| - **Authentication**: POST /users/login, POST /users | ||
| - **Articles**: GET/POST/PUT/DELETE /articles | ||
| - **Profiles**: GET /profiles/{username} | ||
| - **Comments**: GET/POST/DELETE /articles/{slug}/comments | ||
| - **Tags**: GET /tags | ||
|
|
||
| All API calls include proper JWT authentication headers in the format: `Authorization: Token {jwt}` | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| frontend/ | ||
| ├── src/ | ||
| │ ├── components/ # Reusable UI components | ||
| │ ├── pages/ # Page components (Home, Login, Register, etc.) | ||
| │ ├── services/ # API integration layer | ||
| │ ├── hooks/ # Authentication context and hooks | ||
| │ ├── types/ # TypeScript interfaces | ||
| │ └── App.tsx # Main application component | ||
| ├── package.json # Dependencies and scripts | ||
| ├── vite.config.ts # Vite configuration | ||
| ├── tailwind.config.js # Tailwind CSS configuration | ||
| └── tsconfig.json # TypeScript configuration | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>RealWorld</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Docker Compose starts unused Postgres while app is hardcoded to SQLite
The
docker-compose.ymldeclares adb(Postgres) service and makes theappservicedepends_on: db, implying the app should use Postgres. However,application.properties:1-2hardcodesspring.datasource.url=jdbc:sqlite:dev.dbanddriver-class-name=org.sqlite.JDBC, and there is no profile-specific configuration (e.g.,application-dev.ymlorapplication-docker.yml) that overrides the datasource to point at Postgres. The result: the Postgres container starts but is never connected to, while the app uses an ephemeral SQLite file inside the container that is lost on every restart — defeating the purpose of the persistentpgdatavolume.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. This is intentional — the user's spec explicitly notes: "The app currently uses SQLite, so the db service won't be used until the database is migrated. Include it now as preparation." The Postgres service is scaffolding for a future database migration phase. A comment in the docker-compose.yml would help clarify the intent; adding that now isn't strictly needed but agreed this would confuse someone reading it cold.