Modwin Chat is a full-stack account and friendship application built with Spring Boot, React, and PostgreSQL. The repository contains a working authentication and social-graph foundation; chat delivery is intentionally not exposed until its business rules are implemented.
- Local registration and login using BCrypt and server-side sessions
- Optional Google OpenID Connect login
- Authenticated profile retrieval
- Send, accept, decline/cancel, and remove friendship relationships
- CSRF protection and RFC 9457-style API problem responses
- Flyway-managed PostgreSQL schema
- Responsive React UI backed by typed API contracts
Chat and Message persistence models remain as future-facing domain groundwork. There are no chat endpoints or real-time delivery claims yet.
| Area | Stack |
|---|---|
| Backend | Java 21, Spring Boot 3.5, Spring Security, Spring Data JPA |
| Frontend | React 19, TypeScript 6, Vite 8 |
| Data | PostgreSQL 17, Flyway; H2 for fast tests |
| Delivery | Docker Compose, multi-stage images, Nginx reverse proxy |
Prerequisites: Docker Desktop (or Docker Engine with Compose).
docker compose up --buildOpen http://localhost:3000. PostgreSQL data is retained in the postgres-data volume. The backend is reachable through Nginx rather than published directly.
The checked-in defaults are intended only for local development. Copy .env to .env to override them. Do not use the default database password outside a local machine.
Set these values in .env:
SPRING_PROFILES_ACTIVE=docker,oauth
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
FRONTEND_URL=http://localhost:3000Configure the provider callback as http://localhost:3000/login/oauth2/code/google. Nginx forwards that route to Spring Security.
The oauth profile fails fast when either Google credential is absent. Without that profile, the API and UI advertise local login only. Never place real credentials in application*.yml or build them into a container image.
Start PostgreSQL first (the Compose database service is sufficient), then run the backend with Java 21 and the explicit dev profile:
docker compose up -d database
SPRING_PROFILES_ACTIVE=dev ./mvnw spring-boot:runPowerShell equivalent:
docker compose up -d database
$env:SPRING_PROFILES_ACTIVE = "dev"
.\mvnw.cmd spring-boot:runThe development profile connects to PostgreSQL at localhost:5433 using the local-only Compose defaults. If you override the database credentials, export matching DATABASE_USERNAME and DATABASE_PASSWORD values before starting Spring Boot.
In a second terminal:
cd frontend
npm ci
npm run devThe Vite development server proxies backend routes to port 8081.
./mvnw test
./mvnw -Ppostgres-it verify
cd frontend
npm run lint
npm test
npm run buildThe fast backend tests use an isolated H2 database. The postgres-it profile is the authoritative Flyway/PostgreSQL verification and intentionally fails when Docker is unavailable; CI always runs it. GitHub Actions also builds both container images and smoke-tests the Compose stack, but does not publish or deploy images.
| Method | Path | Access | Purpose |
|---|---|---|---|
| GET | /api/csrf |
Public | Obtain the session CSRF token |
| GET | /api/auth/providers |
Public | Discover enabled login providers |
| POST | /api/auth/register |
Public + CSRF | Create and sign in a local account |
| POST | /api/auth/login |
Public + CSRF | Sign in a local account |
| POST | /api/auth/logout |
Authenticated + CSRF | End the current session |
| GET | /api/users/me |
Authenticated | Get the current profile |
| GET/POST | /api/friendships |
Authenticated | List or create requests |
| PATCH | /api/friendships/{id}/accept |
Recipient | Accept a pending request |
| DELETE | /api/friendships/{id} |
Participant | Decline, cancel, or remove |
See the architecture review for the design assessment, implemented corrections, and deferred recommendations.
MIT — see LICENSE.