The client app is a very lean VITE React SPA with minimal boilerplate:
src/
assets/
- CSS, Images, Fonts, etc.
components/
- React components (non-pages).
providers/
- React provider components.
routes/
- Page level components. These correspond to the routes defined in
RouteProvider.jsx
- Page level components. These correspond to the routes defined in
hooks.js
- Reusable custom hooks.
contexts.js
- React context object definitions
socket.js
- Socket.io configuration
.env
- Environment Variable file for storing Auth0 credentials, cloud credentials as well as any other environment-specific values.
vite.config.js
To make a page require authentication from the user, simply wrap the component in the withAuthenticationRequired
HOC. This should only need to be used on page-level components in /routes
that get rendered from RouteProvider.jsx
. For example:
import { withAuthenticationRequired } from "@auth0/auth0-react";
export const ProtectedPage = withAuthenticationRequired(() => <div>Protected Page</div>)