Backend service for the git-sat CLI. This is a small Spring Boot API that accepts commit/file-change data and returns a summarized response.
Need / Purpose
- Provide a lightweight HTTP endpoint for the CLI to request summaries.
- Provide browser-friendly auth routes that issue an
HttpOnlycookie namedgit-sat.
Repo Structure
pom.xmlMaven build with Spring Boot 3.x and Java 17.src/main/java/com/gitsat/backend/GitSatApplication.javaSpring Boot entry point.src/main/java/com/gitsat/backend/controller/SummaryController.javaREST controller with the/summaryendpoint.src/main/java/com/gitsat/backend/controller/AuthController.javaREST controller for register, signup, login, logout, andme.src/main/java/com/gitsat/backend/dto/Request/response DTOs used by the API.
API Snapshot
POST /auth/registerPOST /auth/signup- Input:
RegisterRequestwithname,email, andpassword. - Output:
201 Created, user info in the response body, and anHttpOnlycookie namedgit-sat.
- Input:
POST /auth/login- Input:
LoginRequestwithemailandpassword. - Output:
200 OK, user info in the response body, and a refreshedgit-satcookie.
- Input:
POST /auth/logout- Output: clears the
git-satcookie.
- Output: clears the
GET /auth/me- Output: returns the authenticated user when the
git-satcookie is present and valid.
- Output: returns the authenticated user when the
POST /summary- Input:
SummaryRequestwith repo metadata and a list of commits/files. - Output:
SummaryResponsecontaining per-file summaries, a short overall summary, and a detailed overall summary for the CLI. - Current behavior: summaries are generated through the NVIDIA-hosted OpenAI-compatible chat completions API.
- Input:
Build/Run
mvn spring-boot:run- Configure
.envwithNVIDIA_API_BASE,NVIDIA_API_KEY, andNVIDIA_MODELbefore calling/summary. - Set
AUTH_TOKEN_SECRETin.envif you want auth cookies to stay valid across application restarts.
Auth Notes
- Users are stored in memory for now, so registered accounts are lost when the application restarts.
- Cookies are issued as
HttpOnly, withSameSiteandSecurecontrolled from properties/env vars. - For browser clients on another origin, send requests with credentials enabled so the
git-satcookie is stored and sent back.
Smoke Test
- Run
mvn testfor the local auth and application tests. - Run
mvn -DrunNvidiaApiTest=true -Dtest=NvidiaApiSmokeTest testto verify/summarycan reach the configured NVIDIA API and return non-fallback summaries.
Docker
- Build:
docker build -t git-sat-backend . - Run:
docker run --rm -p 8080:8080 git-sat-backend