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..cfda685 --- /dev/null +++ b/codepress_documentation/INDEX.md @@ -0,0 +1,7 @@ +# Feature Documentation Index + +| Feature | Area | Summary | Last Updated | +|---|---|---|---| +| [django-api-server](./features/django-api-server/README.md) | server | Django backend providing rest_auth/allauth authentication endpoints and serving the React build as its default route. | 2026-07-07 | +| [react-frontend](./features/react-frontend/README.md) | web | Create React App single-page app with Redux and React Router, built and copied into the Django server's static files. | 2026-07-07 | +| [auth-web-samples](./features/auth-web-samples/README.md) | samples | Standalone reference login/signup UI with GitHub OAuth, kept as boilerplate and not wired into the running app. | 2026-07-07 | diff --git a/codepress_documentation/features/auth-web-samples/README.md b/codepress_documentation/features/auth-web-samples/README.md new file mode 100644 index 0000000..b3950c4 --- /dev/null +++ b/codepress_documentation/features/auth-web-samples/README.md @@ -0,0 +1,30 @@ +--- +feature: auth-web-samples +area: samples +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# Auth Web Samples + +## Overview + +`samples/auth-web/` is a standalone set of reference React components implementing a login/signup UI with GitHub OAuth, kept as copy-paste boilerplate for future projects rather than as part of the running application. It is not imported by, or wired into, the app in `web/`. + +## Architecture + +`Auth.js` is the container component that toggles between `LoginForm` and `SignupForm` based on a `login` prop, and handles the GitHub OAuth callback (parsing query-string params on mount and dispatching a login action). `Button.js` is a shared styled submit button used by both forms. `GithubButton.js` builds the GitHub OAuth authorize URL from a client ID and a random `state` value for CSRF protection. + +These files import from paths that don't exist in this repo (e.g. `../../redux/auth`, `../header/Header`, `../../../config/settings`), confirming they are a design/code reference extracted from another project rather than active code — any reuse requires copying the files into `web/src` and creating the matching redux module, header component, and settings file. + +## Key Files + +- `samples/auth-web/Auth.js` - Container switching between login/signup, handles GitHub OAuth redirect callback +- `samples/auth-web/LoginForm.js` - Email/password login form +- `samples/auth-web/SignupForm.js` - Registration form +- `samples/auth-web/Button.js` - Shared styled button used by the forms +- `samples/auth-web/components/GithubButton.js` - Builds the GitHub OAuth authorize link + +## Keywords + +auth, authentication, login form, signup form, github oauth, social login, sample code, boilerplate, reference implementation, aphrodite styling diff --git a/codepress_documentation/features/django-api-server/README.md b/codepress_documentation/features/django-api-server/README.md new file mode 100644 index 0000000..bf61ea3 --- /dev/null +++ b/codepress_documentation/features/django-api-server/README.md @@ -0,0 +1,31 @@ +--- +feature: django-api-server +area: server +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# Django API Server + +## Overview + +The `server/` directory is a Django 1.11 backend that provides authentication endpoints (via `django-rest-framework`, `django-rest-auth`, and `django-allauth`) and serves the compiled React frontend as its default catch-all route. It is the single deployable backend for this intro/starter project. + +## Architecture + +Django is configured as a thin API layer plus a static-file host. `rest_auth` and `allauth` are wired in to provide login, logout, password reset, and registration endpoints without hand-written views. A local `user` app exists as a placeholder for project-specific user model/view extensions but currently contains no custom logic. + +Rather than running a separate static file server, Django templates and static files are pointed at the React app's production build output (`static/build`), and a catch-all URL pattern renders that build's `index.html` for any path not claimed by the API or admin routes. This lets client-side routing (react-router) take over in the browser after the initial page load. + +## Key Files + +- `server/server/settings.py` - Django settings; registers `rest_framework`, `rest_auth`, `allauth`, and the local `user` app; points templates/static files at `static/build` +- `server/server/urls.py` - Routes `/admin/`, `/api/auth/` (login/logout/password), `/api/auth/registration/` (signup), and a catch-all `^` route to the frontend index view +- `server/server/views.py` - `index` view that renders the React build's `index.html` +- `server/user/` - Placeholder Django app for user-related models/views/admin (scaffolded, not yet implemented) +- `server/Pipfile` - Backend dependencies (Django, django-rest-framework, django-rest-auth, django-allauth) +- `server/manage.py` - Standard Django management entrypoint + +## Keywords + +django, backend, api server, rest framework, drf, rest-auth, allauth, authentication, login, registration, wsgi, sqlite, static build, catch-all route, user app diff --git a/codepress_documentation/features/react-frontend/README.md b/codepress_documentation/features/react-frontend/README.md new file mode 100644 index 0000000..ec44f73 --- /dev/null +++ b/codepress_documentation/features/react-frontend/README.md @@ -0,0 +1,35 @@ +--- +feature: react-frontend +area: web +created: 2026-07-07 +last_updated: 2026-07-07 +--- + +# React Frontend + +## Overview + +The `web/` directory is a Create React App (react-scripts) single-page application that renders the client side of the project. It uses React Router for navigation, Redux for state management, and Aphrodite for CSS-in-JS styling. Its production build output is copied into the Django server's static directory so the two apps ship as one deployable unit. + +## Architecture + +The app boots in `web/src/index.js`, wrapping the root `App` component in a Redux `Provider` and a router-aware `ConnectedRouter` (from `react-router-redux`), with hot-module-reload support for both the component tree and the reducers. `App.js` defines the top-level route table and wraps routed content in a `ScrollToTop` helper that resets scroll position on navigation. + +State is managed through a single Redux store assembled in `config/configure-store.js`, which applies `redux-thunk` for async actions and `redux-logger` in development. Reducers are combined in `redux/index.js`; the `redux/example.js` module demonstrates the actions/reducer pattern used for feature state (login flag tracking) and serves as a template for future domain reducers. `containers/home/Home.js` is the sole routed page, illustrating the connected-component pattern (`mapStateToProps`/`mapDispatchToProps`) and Aphrodite styling. + +The `postbuild` npm script (`cp -r build/ ../server/static/build/`) is what physically joins this app to the Django backend described in [django-api-server](../django-api-server/README.md) — after `yarn build`, the compiled assets land where Django's `TEMPLATES`/`STATICFILES_DIRS` expect them. + +## Key Files + +- `web/src/index.js` - App entry point; sets up the Redux store, connected router, and hot reload +- `web/src/containers/App/App.js` - Top-level route table (`react-router-dom` `Switch`/`Route`) +- `web/src/containers/router/ScrollToTop.js` - Router-aware helper that scrolls to top on navigation +- `web/src/config/configure-store.js` - Redux store creation, middleware (thunk, router, logger) +- `web/src/redux/index.js` - Root reducer (`combineReducers`) +- `web/src/redux/example.js` - Example actions/reducer pair demonstrating the state pattern +- `web/src/containers/home/Home.js` - Home page container; example of a connected component with Aphrodite styles +- `web/package.json` - CRA scripts; `postbuild` copies the build output into `server/static/build/` + +## Keywords + +react, create-react-app, redux, react-router, react-router-redux, thunk, redux-logger, aphrodite, css-in-js, spa, frontend, home page, connected component, postbuild, hot reload