Skip to content

MatteoFierquin/SpringReactStarterTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StarterTemplate

Template full-stack avec:

  • ReactViteStarterTemplate/ (React + Vite + TypeScript)
  • SpringStarterTemplate/ (Gateway + API Service + Keycloak)

Structure

  • ReactViteStarterTemplate: frontend SPA
  • SpringStarterTemplate/gateway: point d'entree auth + routage /api/**
  • SpringStarterTemplate/api-service: API metier protegee
  • SpringStarterTemplate/keycloak: configuration realm/clients

Demarrage rapide

1) Lancer le backend (Docker)

cp .env.example .env
# Ajustez les variables si besoin

cd SpringStarterTemplate
docker compose --env-file ../.env up --build

Services disponibles:

  • Gateway: http://localhost:8000
  • API Service: http://localhost:8081
  • Keycloak: http://localhost:8080

2) Lancer le frontend

cd ../ReactViteStarterTemplate
bun install
bun dev

Variables d'environnement importantes (backend)

Dans /.env (racine du projet):

  • KC_REALM_NAME: nom du realm Keycloak
  • KC_ISSUER_URI: ex http://localhost:8080/realms/mon-projet
  • KC_SERVER_URL: ex http://localhost:8080
  • GATEWAY_PORT: port du gateway (default 8000)
  • API_PORT: port de l'api (default 8081)
  • KC_BOOTSTRAP_ADMIN_USERNAME / KC_BOOTSTRAP_ADMIN_PASSWORD

Auth Web + Mobile

Le gateway est configuré pour:

  • Web: login OAuth2 via session/cookie
  • Mobile: JWT Bearer

Fonctionnement

  1. Le frontend appelle le gateway (/api/**).
  2. Le gateway relaie vers api-service (TokenRelay).
  3. L'API valide le JWT et applique les roles.

About

A starter template for Spring and React with auth that uses vite and keycloak

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors