Use AI to suggest recipes based on what’s already in your fridge.
- Java: 21
- Maven: For local builds and dev
- Docker & Docker Compose: For containerized runtime
- .env file: For runtime secrets (not build-time)
# Database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=mysecretpassword
DB_URL=jdbc:postgresql://127.0.0.1:5432/postgres
# AI
GEMINI_API_KEY=your_gemini_key_hereCopy this file to
.envand replace the values with your real credentials.
# Load env without exporting
set -a
. .env
set +a
mvn spring-boot:runOr, manually inject:
DB_URL=jdbc:postgresql://127.0.0.1:5432/postgres \
POSTGRES_USER=postgres \
POSTGRES_PASSWORD=mysecretpassword \
GEMINI_API_KEY=your_gemini_key_here \
mvn spring-boot:runmvn clean packageThen:
set -a
. .env
set +a
java -jar target/magic-frige-0.0.1-SNAPSHOT.jarOr:
DB_URL=jdbc:postgresql://127.0.0.1:5432/postgres \
POSTGRES_USER=postgres \
POSTGRES_PASSWORD=mysecretpassword \
GEMINI_API_KEY=your_gemini_key_here \
java -jar target/magic-frige-0.0.1-SNAPSHOT.jarMake sure your .env is in the root project directory.
docker-compose up --buildThis:
- Builds the Spring Boot image
- Connects to PostgreSQL in another container
- Mounts database volume
- Reads your
.env(onlyGEMINI_API_KEYis passed at runtime)
📍 Web app: http://localhost:8080
🐘 DB: PostgreSQL at localhost:5432, DB name postgres
docker-compose up --build appTo rebuild everything:
docker-compose down -v
docker-compose up --build.
├── Dockerfile
├── docker-compose.yml
├── .env
├── .env-example
├── pom.xml
└── target/
└── magic-frige-0.0.1-SNAPSHOT.jar
-
Java 21
-
Spring Boot 3.4.4
- Web, WebFlux, JPA, DevTools
-
PostgreSQL (Dockerized)
-
Flyway: DB migrations
-
H2: Optional in-memory DB
-
Gemini AI API
-
Lombok, Spring Test
Do NOT use ARG to inject secrets like API keys into your Docker builds.
Always inject secrets at runtime via:
--envor.envdocker-compose(uses.envautomatically)--env-file .envindocker run
docker build \
--build-arg POSTGRES_USER=postgres \
--build-arg POSTGRES_PASSWORD=mysecretpassword \
--build-arg DB_URL=jdbc:postgresql://db:5432/magicfrige \
-t magic-frige .
docker run -d \
-e GEMINI_API_KEY=your_actual_key \
-p 8080:8080 \
--name magic-frige \
magic-frigeThis avoids
.envand avoids shell pollution (noexportneeded).
docker-compose down -vRemoves containers and volumes (including the DB volume).