Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Project structure · Full stack

Spring Boot with React project structure

Opens with credits

A Spring Boot API from Spring Initializr in server/ and a React app from Vite in client/, side by side in one repository. The Vite dev server and Nginx both proxy /api to Spring, so the browser sees one origin with session cookies and CSRF tokens, and TypeScript types are generated from Spring's OpenAPI document. It grows from two scaffolds to a tested, containerised, observable app with contract tests and release automation; the example feature is orders.

Curated by Tauseef FayyazIntermediate251 files and foldersSpring Boot 4.1, Spring Security 7.1, Java 25 LTSChecked October 2026
Explore the filesPick any file to see what it is, why it exists and when you add it.

How it grows

Each stage opens the explorer there

  1. 1Day 1What the scaffold and your first hour give you67 files and folders
  2. 2GrowingWhat a real app with features and tests adds+109 files and folders
  3. ProductionWhat running it for real users adds+35 files and foldersOpens with credits
  4. ExpertWhat a team needs to keep it healthy for years+40 files and foldersOpens with credits

How it is organised

  • Two folders, two build tools: server/ is a normal Maven project and client/ is a normal Vite project. Each opens on its own in its natural editor, and every tutorial you read for either still applies.
  • The contract between them is the HTTP API, described by the OpenAPI document springdoc generates. The client turns it into TypeScript types, so a renamed Java field shows up as a compile error in React. At Expert, Pact contract tests add proof of behaviour on top of shapes.
  • One origin, always: Vite proxies /api to Spring in development and Nginx does the same in production. The browser never needs CORS, and Spring Security's session cookie and csrf.spa() token work the same everywhere.
  • Feature first on both sides: com.example.orders.order on the server, src/features/orders on the client. Server classes stay package-private and features talk through events; client features do not import each other.
  • Errors have one shape: the server answers with RFC 9457 problem details and the client's API layer maps them to messages and form field errors.
  • Test at the cheapest level that proves the point: Mockito and slices on the server, Vitest with Testing Library and MSW on the client, then a few Playwright journeys against the real stack. Contract, accessibility, visual and load tests come at Expert.
  • Two ways to ship. Separate (shown here): the client is static files served by Nginx, which forwards /api to the Spring container. Alternative: build React into server/src/main/resources/static with the frontend-maven-plugin and ship one jar. One jar is simpler to run; separate deploys let each side release on its own.
  • Spring Initializr now defaults to Gradle. Maven is shown because most Spring guides and company codebases still use it; with Gradle only the build files change.

At the top of the project

Open one in the explorer for the full story

Learn more on Sefism

Roadmaps, cheat sheets and projects that go with Spring Boot with React.

See 11 more
Checked against 22 official sources, October 2026. If something has changed, the docs win.Show sources

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com