Skip to content

Commit 3221f56

Browse files
author
gabriele.sisinna
committed
Add Vue frontend and improve local developer UX
1 parent e76efce commit 3221f56

41 files changed

Lines changed: 9954 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88
contents: read
99

1010
jobs:
11-
test:
11+
backend:
1212
runs-on: ubuntu-latest
1313
timeout-minutes: 15
1414

@@ -28,3 +28,26 @@ jobs:
2828

2929
- name: Run tests
3030
run: ./gradlew test --no-daemon
31+
32+
frontend:
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 15
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: '22.12.0'
44+
cache: npm
45+
cache-dependency-path: frontend/package-lock.json
46+
47+
- name: Install frontend dependencies
48+
working-directory: frontend
49+
run: npm ci
50+
51+
- name: Build frontend
52+
working-directory: frontend
53+
run: npm run build

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ Read [docs/architecture.md](./docs/architecture.md) for the design rationale and
4848
- enums
4949
- `@ConfigurationProperties`
5050

51+
### Frontend
52+
53+
- Vue 3 + TypeScript with Vite
54+
- Vuetify UI layer
55+
- Pinia state management
56+
- Vue Router navigation
57+
- backend integration with the student and course APIs
58+
- a UI workflow for learning, testing, and modifying the backend
59+
5160
## Start here
5261

5362
Read these files in order:
@@ -112,6 +121,55 @@ Then run the app:
112121

113122
The app starts on `http://localhost:8080`.
114123

124+
## Run the frontend
125+
126+
The frontend lives in [frontend/README.md](./frontend/README.md).
127+
128+
For a one-command local preview of frontend + backend together, run:
129+
130+
```bash
131+
./scripts/start-dev.sh
132+
```
133+
134+
That will:
135+
136+
- start MongoDB with Docker Compose
137+
- start the Spring Boot backend on `http://localhost:8080`
138+
- start the Vue frontend on `http://localhost:5173`
139+
140+
Press `Ctrl+C` to stop the frontend and backend process. MongoDB stays available in Docker.
141+
142+
Manual start is also available if you want separate terminals.
143+
144+
If MongoDB is already running locally and you do not want Docker in the loop, use:
145+
146+
```bash
147+
./scripts/start-local-dev.sh
148+
```
149+
150+
That script:
151+
152+
- assumes MongoDB is already reachable on `localhost:27017`
153+
- stops old repo-owned Java and Vite processes
154+
- starts the backend on `http://localhost:8080`
155+
- starts the frontend on `http://localhost:5173`
156+
157+
To stop any previous repo dev processes without starting again, run:
158+
159+
```bash
160+
./scripts/stop-dev.sh
161+
```
162+
163+
Start the backend first, then run:
164+
165+
```bash
166+
cd frontend
167+
npm install
168+
npm run dev
169+
```
170+
171+
The frontend runs on `http://localhost:5173` and proxies API requests to the backend on `http://localhost:8080`.
172+
115173
## Production deployment
116174

117175
This repo now includes a simple production deployment target using Docker Compose and MongoDB.

frontend/.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
2+
charset = utf-8
3+
indent_size = 2
4+
indent_style = space
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
max_line_length = 100

frontend/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

frontend/.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
# Editor directories and files
18+
.vscode/*
19+
!.vscode/extensions.json
20+
.idea
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
27+
*.tsbuildinfo
28+
29+
.eslintcache
30+
31+
# Cypress
32+
/cypress/videos/
33+
/cypress/screenshots/
34+
35+
# Vitest
36+
__screenshots__/
37+
38+
# Vite
39+
*.timestamp-*-*.mjs
40+
41+
test-results/
42+
playwright-report/

frontend/.oxlintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["eslint", "typescript", "unicorn", "oxc", "vue", "vitest"],
4+
"env": {
5+
"browser": true
6+
},
7+
"categories": {
8+
"correctness": "error"
9+
}
10+
}

frontend/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Frontend
2+
3+
This folder contains the dedicated frontend for the Java Spring learning repo.
4+
5+
Stack:
6+
7+
- Vue 3
8+
- TypeScript
9+
- Vite
10+
- Vuetify
11+
- Vue Router
12+
- Pinia
13+
14+
## Purpose
15+
16+
The frontend is built to make the backend easier to learn and modify:
17+
18+
- dashboard for the repo overview
19+
- student screen for the public JSON endpoints
20+
- course screen for the secured MongoDB CRUD flow
21+
- learning screen that maps the UI back to the backend architecture
22+
23+
## Run locally
24+
25+
From the repo root, start MongoDB and the Spring Boot backend first:
26+
27+
```bash
28+
docker compose up -d mongo
29+
./gradlew bootRun
30+
```
31+
32+
Then start the frontend:
33+
34+
```bash
35+
cd frontend
36+
npm install
37+
npm run dev
38+
```
39+
40+
The frontend runs on `http://localhost:5173`.
41+
42+
During development, Vite proxies these paths to the backend on `http://localhost:8080`:
43+
44+
- `/api`
45+
- `/v3`
46+
- `/swagger-ui`
47+
- `/actuator`
48+
49+
## Useful commands
50+
51+
```bash
52+
npm run dev
53+
npm run build
54+
npm run type-check
55+
```
56+
57+
## Notes
58+
59+
- The course screen uses the default backend learning credentials: `student` / `password`
60+
- Swagger UI remains available through the backend at `/swagger-ui.html`

frontend/e2e/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "@tsconfig/node24/tsconfig.json",
3+
"include": ["./**/*"]
4+
}

frontend/e2e/vue.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { test, expect } from '@playwright/test'
2+
3+
test('visits the app root url', async ({ page }) => {
4+
await page.goto('/')
5+
await expect(page.locator('h1')).toContainText('Explore Java objects')
6+
await expect(page.getByRole('button', { name: 'Work on student endpoints' })).toBeVisible()
7+
})

frontend/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

0 commit comments

Comments
 (0)