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_here
Copy this file to
.env
and replace the values with your real credentials.
# Load env without exporting
set -a
. .env
set +a
mvn spring-boot:run
Or, 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:run
mvn clean package
Then:
set -a
. .env
set +a
java -jar target/magic-frige-0.0.1-SNAPSHOT.jar
Or:
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.jar
Make sure your .env
is in the root project directory.
docker-compose up --build
This:
- Builds the Spring Boot image
- Connects to PostgreSQL in another container
- Mounts database volume
- Reads your
.env
(onlyGEMINI_API_KEY
is passed at runtime)
📍 Web app: http://localhost:8080
🐘 DB: PostgreSQL at localhost:5432
, DB name postgres
docker-compose up --build app
To 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:
--env
or.env
docker-compose
(uses.env
automatically)--env-file .env
indocker 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-frige
This avoids
.env
and avoids shell pollution (noexport
needed).
docker-compose down -v
Removes containers and volumes (including the DB volume).