SolarWatch is a full-stack Java + React demo that shows authentication, external API integrations (weather, maps, sunrise/sunset) and an AI chat microservice on a single dashboard.
·
View Demo
·
Table of Contents
A full‑stack demo showing authentication and multiple integrations on a single dashboard:
- Sunrise and sunset times for a selected city
- Weather summary cards (temperature, pressure, humidity, wind)
- Google Maps city embed (Google Cloud Maps Embed API)
- AI chat assistant (separate Spring Boot microservice) to ask city‑related questions
The backend (Spring Boot) serves the core API. The AI capability is split into a dedicated microservice so secrets (AI keys) never reach the browser. The frontend (React + Vite + Tailwind) provides an accordion chat panel, loading states, and a dark, glassy UI.
External APIs used:
·
Sunset and sunrise times API
·
·
Geocoding API (OpenWeather)
·
·
Google Maps Embed API (Google Cloud)
·
- solarwatch-backend (Spring Boot, :8080): authentication and solar endpoints
- solarwatch-ai-service (Spring Boot, :8082): AI chat microservice with multi-provider support (Gemini default, OpenAI optional)
- solarwatch-frontend (Vite React, :5173): UI with Vite proxy to backend and AI service
Dev proxy (Vite):
- /api → http://localhost:8080 (backend)
- /api/ai → http://localhost:8082 (AI microservice)
Run the full stack (frontend + backend + AI microservice + database + dev Nginx reverse proxy) using Docker.
- Docker Desktop (Windows/macOS) or Docker Engine (Linux)
- Docker Compose v2 (bundled with Docker Desktop)
- Open a terminal and navigate to the project root (the folder containing
docker-compose.yml). - Create a
.envfile with at least:DATABASE_USERNAME=postgres DATABASE_PASSWORD=postgres OPENWEATHER_API_KEY=your_openweather_key # AI provider (default: gemini) AI_PROVIDER=gemini GOOGLE_API_KEY=your_gemini_api_key AI_GEMINI_MODEL=gemini-2.5-flash # If you prefer OpenAI instead: # AI_PROVIDER=openai # AI_OPENAI_API_KEY=sk-... # AI_OPENAI_MODEL=gpt-4o-mini # Optional for the map widget VITE_GOOGLE_MAPS_EMBED_KEY=your_google_maps_embed_key
- Build and start the stack in the background:
docker compose up -d --build
- (Optional) Tail logs during the first run:
docker compose logs -f
- Open the app via the dev reverse proxy (Nginx):
- App (proxied): http://localhost/
- Nginx forwards
/→ Vite dev server,/api→ backend,/api/ai→ AI microservice
- Nginx forwards
- Direct services (useful for debugging):
- Frontend Vite: http://localhost:5173/
- Backend API: http://localhost:8080/
- AI health: http://localhost:8082/actuator/health
- App (proxied): http://localhost/
- See running services:
docker compose ps
- Stop and remove containers (keep data volumes):
docker compose down
- Stop only (keep containers for quick restart):
docker compose stop
- Rebuild images without cache:
docker compose build --no-cache
- Reset everything (containers and volumes, e.g., wipe the DB):
docker compose down -v
This section explains how to run the project locally. Follow the steps below:
- Node.js and npm (frontend)
- Java 21+ (Spring Boot services)
- IntelliJ IDEA or another IDE
Frontend (React + TypeScript)
- Navigate to
solarwatch-frontend/ - Install packages:
npm install
- Start the development server:
npm run dev
- Open http://localhost:5173/
Backend (Spring Boot)
-
Open the backend/ folder in IntelliJ IDEA.
-
Run the project using the green arrow (from the Spring Boot main class, e.g. Application.java).
- Alternatively, you can start the backend from the terminal with:
mvn spring-boot:run
-
The backend will be available at http://localhost:8080/ by default.
- Register and log in.
- Open the SolarWatch dashboard.
- Enter a city to see:
- Sunrise and sunset times
- Weather summary cards (temperature, pressure, humidity, wind)
- Google Maps city embed (if
VITE_GOOGLE_MAPS_EMBED_KEYis set) - AI Assistant accordion → ask questions about the selected city
Notes
- The AI service uses a separate API key on the server. If the provider returns 429 (insufficient quota), you’ll see a friendly message in the UI.
- In development, Vite proxies
/apito :8080 and/api/aito :8082.
AI microservice (server):
AI_PROVIDER– gemini (default) or openai- For Gemini:
GOOGLE_API_KEY– requiredAI_GEMINI_MODEL– optional (default: gemini-2.5-flash)
- For OpenAI:
AI_OPENAI_API_KEY– requiredAI_OPENAI_MODEL– optional (default: gpt-4o-mini)
Frontend:
-
VITE_GOOGLE_MAPS_EMBED_KEY– Google Maps Embed API key (Google Cloud) to show the map -
VITE_AI_BASE_URL– optional for production if the AI service is on a different origin; in dev the proxy is used
Délczeg Balázs - dbalazsworkemail@gmail.com
Project Link - GitHub repository