From 1a77fafe72e6dbafb7d3e7b406c3765d8971d803 Mon Sep 17 00:00:00 2001 From: "codepress-dev[bot]" <202219725+codepress-dev[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 19:24:11 +0000 Subject: [PATCH] docs: auto-document django-backend, react-frontend, auth-ui-samples --- CLAUDE.md | 12 +++++ .../.last-documented-commit | 1 + codepress_documentation/INDEX.md | 7 +++ .../features/auth-ui-samples/README.md | 46 +++++++++++++++++ .../features/django-backend/README.md | 46 +++++++++++++++++ .../features/react-frontend/README.md | 50 +++++++++++++++++++ 6 files changed, 162 insertions(+) create mode 100644 CLAUDE.md create mode 100644 codepress_documentation/.last-documented-commit create mode 100644 codepress_documentation/INDEX.md create mode 100644 codepress_documentation/features/auth-ui-samples/README.md create mode 100644 codepress_documentation/features/django-backend/README.md create mode 100644 codepress_documentation/features/react-frontend/README.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..4fb13b9 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,12 @@ +# django-react-intro + +An intro project combining a Django REST backend (`server/`) with a Create +React App + Redux frontend (`web/`), plus reference auth UI components +(`samples/auth-web/`). + +## Feature Documentation + + + +Before modifying a feature area, read the relevant documentation in `codepress_documentation/features//README.md`. +See [INDEX.md](codepress_documentation/INDEX.md) for the full feature registry. diff --git a/codepress_documentation/.last-documented-commit b/codepress_documentation/.last-documented-commit new file mode 100644 index 0000000..536943d --- /dev/null +++ b/codepress_documentation/.last-documented-commit @@ -0,0 +1 @@ +0128af14fdc402edf3f11f3af3444d83b9651eff diff --git a/codepress_documentation/INDEX.md b/codepress_documentation/INDEX.md new file mode 100644 index 0000000..6a9ffd2 --- /dev/null +++ b/codepress_documentation/INDEX.md @@ -0,0 +1,7 @@ +# Feature Documentation Index + +| Feature | Area | Summary | Last Updated | +|---|---|---|---| +| [django-backend](features/django-backend/README.md) | server | Django project providing REST auth endpoints and serving the compiled React frontend from one process. | 2026-07-07 | +| [react-frontend](features/react-frontend/README.md) | web | Create React App + Redux single-page app, built and copied into the Django backend's static directory. | 2026-07-07 | +| [auth-ui-samples](features/auth-ui-samples/README.md) | samples/auth-web | Reference login/signup and GitHub OAuth UI components, not yet wired into the live app. | 2026-07-07 | diff --git a/codepress_documentation/features/auth-ui-samples/README.md b/codepress_documentation/features/auth-ui-samples/README.md new file mode 100644 index 0000000..4bfba71 --- /dev/null +++ b/codepress_documentation/features/auth-ui-samples/README.md @@ -0,0 +1,46 @@ +--- +feature: auth-ui-samples +area: samples/auth-web +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# Auth UI Samples + +## Overview + +`samples/auth-web/` holds reference React components for an email/password +login-and-signup flow plus a "Continue with GitHub" OAuth entry point. They +are sample/boilerplate code meant to be adapted when wiring real +authentication UI against the [django-backend](../django-backend/README.md)'s +`rest_auth` endpoints — they are not imported by the live app (the current +route table in [react-frontend](../react-frontend/README.md) only renders +`Home`) and reference sibling modules (`redux/auth`, `components/Input`, +`containers/header/Header`, `config/settings`) that don't exist yet in this +repo. + +## Architecture + +`Auth.js` is the container: it toggles between `LoginForm` and `SignupForm`, +renders a `GithubButton` for OAuth, and, when mounted with an OAuth callback +query string, dispatches a `githubLogin` action and redirects home on +success. `LoginForm` and `SignupForm` are uncontrolled forms that read values +off input refs and call `login()`/`register()` props supplied by the +container, redirecting after a successful response. `Button` is the shared +styled submit button used by both forms, and `GithubButton` builds a GitHub +OAuth authorize URL from a configured client ID and a random state token. + +All components style with Aphrodite (`StyleSheet.create`), the same pattern +used by the live `Home` component in the react-frontend feature. + +## Key Files + +- `samples/auth-web/Auth.js` - login/signup container and GitHub OAuth callback handling. +- `samples/auth-web/LoginForm.js` - email/password login form. +- `samples/auth-web/SignupForm.js` - signup form (email, name, password). +- `samples/auth-web/Button.js` - shared auth submit button. +- `samples/auth-web/components/GithubButton.js` - GitHub OAuth authorize link. + +## Keywords + +authentication UI, login form, signup form, GitHub OAuth, social login, rest_auth integration, reference components, boilerplate auth, sample code, Aphrodite styling diff --git a/codepress_documentation/features/django-backend/README.md b/codepress_documentation/features/django-backend/README.md new file mode 100644 index 0000000..ed9be06 --- /dev/null +++ b/codepress_documentation/features/django-backend/README.md @@ -0,0 +1,46 @@ +--- +feature: django-backend +area: server +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# Django Backend (API + Frontend Host) + +## Overview + +The `server/` app is a Django project that serves two roles at once: a REST +API for authentication (via django-rest-framework, django-rest-auth, and +django-allauth) and the host process that serves the compiled React +frontend. In this starter, both the API and the single-page app are shipped +from one Django process rather than two separately deployed services. + +## Architecture + +Django's URL config routes `/admin/` to the built-in admin, `/api/auth/` and +`/api/auth/registration/` to `rest_auth`'s login/logout/password endpoints and +registration flow, and treats every other path as a catch-all that renders +`index.html` — the entry point of the built React app. This catch-all must stay +last in `urlpatterns` so that client-side routing (pushState) works correctly. + +Django's template and static-files search paths are pointed at +`static/build`, the directory the frontend's production build gets copied +into (see [react-frontend](../react-frontend/README.md)). This is what lets a +single Django deployment serve both the API and the SPA's HTML/JS/CSS. + +A local `user` Django app exists as a placeholder for custom user models, +views, and admin registrations, but currently holds no app-specific code +beyond the generated scaffolding. The default database is SQLite, configured +for local development rather than production use. + +## Key Files + +- `server/server/settings.py` - installed apps (DRF, rest_auth, allauth, local `user` app), template/staticfiles paths pointed at `static/build`, SQLite config. +- `server/server/urls.py` - URL routing: admin, rest_auth/rest_auth.registration endpoints, and the catch-all SPA index route. +- `server/server/views.py` - the `index` view that renders the React build's `index.html`. +- `server/user/` - local app reserved for custom user models/views (currently unimplemented scaffolding). +- `server/Pipfile` - Python dependencies (Django, djangorestframework, django-rest-auth, django-allauth). + +## Keywords + +Django, REST API, django-rest-framework, DRF, django-rest-auth, rest_auth, django-allauth, allauth, authentication endpoints, registration, SQLite, static files, catch-all route, SPA hosting, urls.py, settings.py diff --git a/codepress_documentation/features/react-frontend/README.md b/codepress_documentation/features/react-frontend/README.md new file mode 100644 index 0000000..dccf870 --- /dev/null +++ b/codepress_documentation/features/react-frontend/README.md @@ -0,0 +1,50 @@ +--- +feature: react-frontend +area: web +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# React Frontend (Create React App + Redux) + +## Overview + +The `web/` app is a Create React App (CRA) single-page app wired with Redux +for state management, react-router for client-side routing, and Aphrodite +for CSS-in-JS styling. It is the frontend half of the project, built and then +handed off to the [django-backend](../django-backend/README.md) to serve. + +## Architecture + +The entry point renders the root `App` component inside a Redux `Provider` +and a router-aware `ConnectedRouter`, sharing a single browser history +instance created during store configuration. `App` defines the route table +(currently just `/` -> `Home`) and wraps routes in a `ScrollToTop` helper +that resets scroll position on navigation. + +The Redux store applies `redux-thunk` (for async action creators) and +`react-router-redux`'s router middleware, plus a development-only logger +middleware. The root reducer currently combines the router reducer with a +single example reducer (`redux/example.js`) that models a basic login +flag — a template for how feature reducers should be added, not a real auth +implementation. + +The build pipeline is what connects this app to the backend: CRA's `build` +script produces a static bundle, and a `postbuild` npm script copies that +output into `../server/static/build/`, the exact directory Django's settings +point at for templates and static files. Running `yarn build` in `web/` +followed by Django's server is how the two halves become one deployable app. + +## Key Files + +- `web/src/index.js` - app bootstrap; wires the Redux `Provider` and `ConnectedRouter`. +- `web/src/config/configure-store.js` - Redux store, middleware, and history configuration. +- `web/src/redux/index.js` / `web/src/redux/example.js` - root reducer and an example login action/reducer. +- `web/src/containers/App/App.js` - route definitions. +- `web/src/containers/home/Home.js` - the landing page (CRA default template content). +- `web/src/containers/router/ScrollToTop.js` - resets scroll position on route change. +- `web/package.json` - `postbuild` script that copies the CRA build into `server/static/build/`. + +## Keywords + +React, Create React App, CRA, Redux, redux-thunk, redux-logger, react-router, react-router-redux, ConnectedRouter, Aphrodite, CSS-in-JS, SPA, frontend build, postbuild, static build output