Newflix is a personal streaming application composed of a frontend (Angular 17), a backend (Spring Boot 3), and a database (PostgreSQL) to store metadata for movies, TV shows, and episodes.
The project follows an API-first architecture: openapi.yaml at the root is the single source of truth for all API contracts. Backend Java entities and Spring interfaces, as well as frontend TypeScript models and Angular services, are generated from this file.
- Java 17+, Maven 3.8+
- Node.js 18+, npm
- Docker & Docker Compose (for containerised deployment)
- A TheMovieDB API key — register at https://www.themoviedb.org
Copy the example file and fill in your values:
cp deployment/docker/.env.example deployment/docker/.env| Variable | Description | Required |
|---|---|---|
TMDB_API_KEY |
Your TheMovieDB API key — get one at https://www.themoviedb.org/settings/api | Yes |
DATABASE_USERNAME |
PostgreSQL username | Yes |
DATABASE_PASSWORD |
PostgreSQL password | Yes |
CORS_ALLOWED_ORIGINS |
Comma-separated allowed origins (default: http://localhost:4200,http://localhost:8080) |
No |
Never commit your
.envfile. It is already listed in.gitignore.
After any change to openapi.yaml, regenerate backend and frontend code:
# Backend — generates JPA entities + Spring API interfaces
cd backend-service && mvn generate-sources
# Frontend — generates TypeScript models and Angular services
cd web && npm run generate:apicd backend-service
# Local dev — uses H2 in-memory DB, no env vars needed, debug on port 5005
mvn spring-boot:run
# Run tests
mvn test
# Build JAR (skip tests)
mvn package -DskipTestsTo run against a local PostgreSQL instead of H2, pass the required env vars:
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/newflix \
SPRING_DATASOURCE_USERNAME=admin \
SPRING_DATASOURCE_PASSWORD=yourpassword \
SPRING_JPA_HIBERNATE_DDL_AUTO=none \
SPRING_FLYWAY_ENABLED=true \
SPRING_SQL_INIT_MODE=never \
mvn spring-boot:runcd web
npm install
ng serve # Dev server at http://localhost:4200
npm run build # Development build
npm run buildprod # Production build
ng test # Unit testscd deployment/docker
docker-compose build
docker-compose up -d
docker-compose downServices:
| Service | Port |
|---|---|
| Frontend (Nginx) | 8080 |
| Backend (Spring Boot) | 8081 |
| PostgreSQL | 5432 |
Sensitive values are not stored in values.yaml. Pass them at install time using --set or a local override file that you never commit.
Option A — --set flags (quick)
helm install newflix . -n newflix \
--set secrets.dbUsername=admin \
--set secrets.dbPassword=your_strong_password \
--set secrets.tmdbApiKey=your_tmdb_api_key \
-f values.yaml \
--kubeconfig="/etc/rancher/k3s/k3s.yaml"Option B — local values file (recommended)
Create a values.secret.yaml file (already gitignored):
# values.secret.yaml — DO NOT COMMIT
secrets:
dbUsername: admin
dbPassword: your_strong_password
tmdbApiKey: your_tmdb_api_keyThen install with both files:
helm install newflix . -n newflix \
-f values.yaml \
-f values.secret.yaml \
--kubeconfig="/etc/rancher/k3s/k3s.yaml"Helm will create a Kubernetes Secret named newflix-secrets in the namespace, and the backend and PostgreSQL pods will read credentials from it via valueFrom.secretKeyRef.
cd deployment/helm/newflix
# Render templates locally (dry run)
helm template -f values.yaml -f values.secret.yaml .
# Upgrade a running release
helm upgrade newflix . -n newflix \
-f values.yaml \
-f values.secret.yaml \
--kubeconfig="/etc/rancher/k3s/k3s.yaml"
# Uninstall
helm uninstall newflix -n newflix --kubeconfig="/etc/rancher/k3s/k3s.yaml"apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: upload-limit
namespace: default
spec:
buffering:
maxRequestBodyBytes: 0
maxResponseBodyBytes: 0apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
additionalArguments:
- "--entryPoints.web.transport.respondingTimeouts.readTimeout=3600s"
- "--entryPoints.web.transport.respondingTimeouts.writeTimeout=3600s"
- "--entryPoints.web.transport.respondingTimeouts.idleTimeout=3600s"
- "--entryPoints.websecure.transport.respondingTimeouts.readTimeout=3600s"
- "--entryPoints.websecure.transport.respondingTimeouts.writeTimeout=3600s"
- "--entryPoints.websecure.transport.respondingTimeouts.idleTimeout=3600s"With the backend running, access the Swagger UI at:
http://localhost:8081/swagger-ui.html
The OpenAPI JSON spec is available at:
http://localhost:8081/v3/api-docs
newflix/
├── openapi.yaml # API contract (source of truth)
├── backend-service/ # Spring Boot 3 + Java 17
│ └── src/
│ └── main/java/com/picture/newflix/
│ ├── api/ # Generated Spring interfaces (do not edit)
│ ├── models/ # Generated JPA entities + FromApi records
│ ├── controllers/ # Implement generated API interfaces
│ ├── services/ # Business logic
│ └── repositories/ # Spring Data JPA repositories
└── web/ # Angular 17 frontend
└── src/app/
├── generated/ # Generated TS models + Angular services (do not edit)
├── components/ # UI components
└── services/ # Angular services (use generated code)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
When modifying the API:
- Edit
openapi.yamlfirst - Run
mvn generate-sourcesandnpm run generate:api - Update controller implementations if method signatures changed
- Update tests as appropriate