diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..be6ef09 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,6 @@ +## 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..6824e3a --- /dev/null +++ b/codepress_documentation/INDEX.md @@ -0,0 +1,7 @@ +# Feature Documentation Index + +| Feature | Area | Summary | Last Updated | +|---|---|---|---| +| [django-spa-backend](features/django-spa-backend/README.md) | server | Django backend that serves the compiled React app via a catch-all route and provides token auth/registration endpoints via django-rest-auth and allauth. | 2026-07-07 | +| [react-redux-frontend](features/react-redux-frontend/README.md) | web | Create React App frontend scaffolded with Redux and React Router, built and copied into the Django backend's static directory for deployment. | 2026-07-07 | +| [auth-ui-samples](features/auth-ui-samples/README.md) | samples | Reference-only login/signup UI components with GitHub OAuth, not wired into the running 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..6329909 --- /dev/null +++ b/codepress_documentation/features/auth-ui-samples/README.md @@ -0,0 +1,30 @@ +--- +feature: auth-ui-samples +area: samples +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# Auth UI Samples + +## Overview + +A set of reference React components demonstrating how to build a login/signup UI with GitHub OAuth, kept under `samples/` as copy-from-here starting material rather than as part of the running app. They are not imported by [react-redux-frontend](../react-redux-frontend/README.md) and are not wired into the app's routes, store, or build. + +## Architecture + +The sample shows a typical container/presentational split: an `Auth` container toggles between a `LoginForm` and `SignupForm` based on a prop, renders a `GithubButton` for social login, and dispatches auth actions (login/register/GitHub OAuth) through Redux action creators. Styling uses `aphrodite` (CSS-in-JS), which is not a dependency used anywhere else in this repo's actual frontend. + +Because this is reference code, it intentionally imports from modules that don't exist in this repo (e.g. a `redux/auth` actions module, a `header/Header` component, and a `config/settings` file for the GitHub OAuth client ID) — these are placeholders showing the shape of a complete implementation, not working imports. Anyone adopting this sample needs to supply those pieces and add the corresponding Redux auth reducer/actions and API calls against the backend's `/api/auth/` endpoints. + +## Key Files + +- `samples/auth-web/Auth.js` - Container that switches between login/signup and renders the social login option +- `samples/auth-web/LoginForm.js` - Login form UI +- `samples/auth-web/SignupForm.js` - Signup form UI +- `samples/auth-web/Button.js` - Shared button component used by the forms +- `samples/auth-web/components/GithubButton.js` - GitHub OAuth login button, builds the GitHub authorize URL from a client ID + +## Keywords + +auth samples, login form, signup form, github oauth, social login, aphrodite, reference code, boilerplate, unused sample, auth ui diff --git a/codepress_documentation/features/django-spa-backend/README.md b/codepress_documentation/features/django-spa-backend/README.md new file mode 100644 index 0000000..0cdeba3 --- /dev/null +++ b/codepress_documentation/features/django-spa-backend/README.md @@ -0,0 +1,32 @@ +--- +feature: django-spa-backend +area: server +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# Django SPA Backend + +## Overview + +A Django backend that acts as both an API server and a static host for the React frontend. It ships with token-based authentication and social-login scaffolding already wired in, but no custom endpoints beyond that yet. It exists as the starting point for a Django + React project rather than a finished application. + +## Architecture + +Django's URL routing is split into three concerns: the Django admin, a set of authentication endpoints under `/api/auth/`, and a catch-all route that serves the compiled React app for every other path. This catch-all pattern is what lets client-side routing (`react-router`) work correctly on page refresh/deep links — any URL Django doesn't recognize falls through to `index.html` and the SPA's router takes over from there. + +Authentication is not hand-rolled: `django-rest-framework`, `django-rest-auth`, and `django-allauth` are installed and registered in `INSTALLED_APPS`, providing login/logout/registration/password-reset endpoints out of the box. A local `user` app exists as the designated place for custom user model/view extensions, but currently contains only Django's default scaffolding (no custom fields or views yet). + +The project uses SQLite for local development, and templates are configured to load from `static/build` — the directory the frontend's build step writes into (see [react-redux-frontend](../react-redux-frontend/README.md)). + +## Key Files + +- `server/server/settings.py` - Django settings; registers DRF/rest-auth/allauth apps, points templates and static files at `static/build` +- `server/server/urls.py` - Top-level routing: admin, `/api/auth/` (rest_auth + registration), and the SPA catch-all +- `server/server/views.py` - `index` view that renders the React build's `index.html` for the catch-all route +- `server/user/` - Placeholder Django app for user-related models/views (currently default scaffolding) +- `server/Pipfile` - Backend dependencies (Django, DRF, django-rest-auth, django-allauth) + +## Keywords + +django, backend, api, server, spa hosting, catch-all route, index view, django-rest-framework, drf, django-rest-auth, django-allauth, authentication, token auth, sqlite, static build, user app diff --git a/codepress_documentation/features/react-redux-frontend/README.md b/codepress_documentation/features/react-redux-frontend/README.md new file mode 100644 index 0000000..a84a05f --- /dev/null +++ b/codepress_documentation/features/react-redux-frontend/README.md @@ -0,0 +1,34 @@ +--- +feature: react-redux-frontend +area: web +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# React + Redux Frontend + +## Overview + +A Create React App frontend wired up with Redux for state management and React Router for client-side navigation. It provides the baseline app shell (store, router, root component) that the Django backend ([django-spa-backend](../django-spa-backend/README.md)) serves as a compiled static bundle. + +## Architecture + +The app entry point creates a Redux store and wraps the root `App` component in both a Redux `Provider` and a `ConnectedRouter`, so routing state lives in the Redux store alongside application state. The store is configured with `redux-thunk` for async actions and `redux-router` middleware to keep the URL in sync with Redux; a `redux-logger` middleware is added in development for action/state debugging. Hot module reloading is wired in for both the root component and the root reducer. + +`App.js` defines the top-level route table via `react-router-dom`'s `Switch`/`Route`, currently mapping only the root path to a `Home` container, and wraps routes in a `ScrollToTop` helper that resets scroll position on navigation. The Redux reducer tree currently only combines the router reducer — there are no application-specific reducers yet, making this a scaffold rather than a feature-complete app. + +Production builds are produced by `react-scripts build` and then copied into the Django backend's static directory via an npm `postbuild` script (`cp -r build/ ../server/static/build/`), which is how the two halves of the project connect at deploy time. + +## Key Files + +- `web/src/index.js` - App entry point; creates the Redux store and mounts `App` inside `Provider`/`ConnectedRouter` +- `web/src/config/configure-store.js` - Redux store setup: middleware (thunk, router, logger) and hot-reload wiring +- `web/src/containers/App/App.js` - Root component defining the route table +- `web/src/containers/home/Home.js` - The only registered route/page currently in the app +- `web/src/containers/router/ScrollToTop.js` - Route-change scroll-reset wrapper +- `web/src/redux/index.js` - Root reducer (currently just the router reducer) +- `web/package.json` - Frontend dependencies and the `postbuild` script that copies the build into the Django backend + +## Keywords + +react, redux, create-react-app, cra, react-router, react-router-redux, redux-thunk, redux-logger, connected router, scroll to top, postbuild, frontend scaffold, spa