Skip to content

Repository files navigation

Modwin Chat

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.

Current capabilities

  • 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.

Technology

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

Run the complete stack

Prerequisites: Docker Desktop (or Docker Engine with Compose).

docker compose up --build

Open 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.

Optional Google login

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:3000

Configure 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.

Run during development

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:run

PowerShell equivalent:

docker compose up -d database
$env:SPRING_PROFILES_ACTIVE = "dev"
.\mvnw.cmd spring-boot:run

The 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 dev

The Vite development server proxies backend routes to port 8081.

Verification

./mvnw test
./mvnw -Ppostgres-it verify
cd frontend
npm run lint
npm test
npm run build

The 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.

API summary

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.

License

MIT — see LICENSE.

About

Modwin Chat is a full-stack account and friendship application built with Spring Boot, React, and PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages