A lightweight Reddit-style front page built with React and Vite. It includes a mocked OAuth PKCE login flow, a protected Profile page, and a Hot Posts feed with a Reddit-like UI. No backend is required for the current mock flow.
- Mocked OAuth PKCE login and logout flow with a callback route
- Protected Profile page showing token-gated sample data
- Hot Posts feed with Reddit-style cards and sidebars
- Minimal routing using browser history; handled paths:
/,/callback,/profile - Tailwind UI via CDN (no build-time CSS setup)
- ESLint configured
- React 19, Vite 7
- React Router (BrowserRouter wrapper)
- ESLint 9
- Axios is available for future API calls
Prerequisites:
- Node.js 18+ and npm
Install and run:
npm install
npm run devOpen http://localhost:5173 and use the Login button to trigger the mock OAuth flow. You will be redirected to /callback, and then to the protected /profile page.
Build and preview:
npm run build
npm run previewLint:
npm run lintThe app ships with a mocked PKCE flow. To integrate a real Reddit OAuth:
- Create a Reddit app at https://www.reddit.com/prefs/apps
- Set type “web app” and add redirect URI
http://localhost:5173/callback - Update
CLIENT_IDand verifyREDIRECT_URIinsrc/App.jsx - Perform the token exchange on your backend against
https://www.reddit.com/api/v1/access_tokenusingauthorization_code,code_verifier, and yourredirect_uri
Note: A .env file is present with generic OAuth variables but is not wired to src/App.jsx in the current implementation. You can repurpose it when adding a real provider or wiring axios-based API calls.
src/App.jsx— main app, auth context, routes, UIsrc/main.jsx— React entry with BrowserRoutersrc/components/— UI building blocks (e.g., voting buttons)src/pages/— legacy pages (Home, CreatePost)src/context/GlobalStateContext.jsx— legacy global statesrc/api/apiClient.js— dummy API helpersindex.html— loads Tailwind via CDN and mounts the app
npm run dev— start dev servernpm run build— production buildnpm run preview— preview built assetsnpm run lint— run ESLint