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

Django with React project structure

Opens with credits

A Django and Django REST framework backend in backend/ and a Vite React TypeScript app in frontend/, in one repository. The browser always sees one origin: Vite proxies /api in development and Django serves the built React app in production, so login is a normal Django session protected by its CSRF cookie, and TypeScript types are generated from the DRF schema. For students who know a bit of Django and a bit of React and want to see how the two halves fit together, from two scaffolds to one tested, deployable app.

Curated by Tauseef FayyazIntermediate144 files and foldersDjango 6.1, Django REST framework 3.18, drf-spectacular 0.30Checked 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 you39 files and folders
  2. 2GrowingWhat a real app with features and tests adds+63 files and folders
  3. ProductionWhat running it for real users adds+21 files and foldersOpens with credits
  4. ExpertWhat a team needs to keep it healthy for years+21 files and foldersOpens with credits

How it is organised

  • Two folders, two toolchains: `backend/` is a normal uv and Django project, `frontend/` a normal Vite project. Each half follows its own conventions and tutorials still apply.
  • One origin, always. Vite proxies `/api` to Django in development and Django serves the built React app in production, so the browser never makes a cross-origin call and you never need CORS.
  • The session cookie is the login. Django sets an HttpOnly `sessionid`; React reads the `csrftoken` cookie and sends it back as `X-CSRFToken` on every unsafe request. No token is ever stored in JavaScript.
  • The schema is the contract. drf-spectacular writes `schema.yml` from the serializers, openapi-typescript turns it into types, and CI fails if either generated file is stale.
  • Mirror the features: `backend/orders` and `frontend/src/features/orders` belong together, so one pull request can change both.
  • Enforce everything on the server. React hides buttons for convenience; querysets and permissions decide what anyone can actually read or change.
  • Ship one image. The Docker build compiles the frontend, `collectstatic` picks up its assets and Gunicorn serves everything, so the UI and the API it expects always deploy together.
  • Test each half alone, then together: pytest for the API, Vitest with MSW for components, a few Playwright journeys through the real cookie and proxy, and contract tests on the schema at Expert.

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 Django with React.

See 9 more
Checked against 19 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