How shalabhgupta-aviz/community-site works
Project type and purpose
• This is a full-stack Next.js web application serving as a forum/discussion platform: users can register, log in, post questions, reply to questions, browse topics, and view their profile.
File structure
• Top-level Next.js config files: next.config.mjs, jsconfig.json, postcss.config.mjs, eslint.config.mjs.
• /src/app: Next.js “app router” folder containing route handlers (frontend pages) and API routes under /api.
• /api/auth/[...nextauth]/route.js: NextAuth authentication.
• /api/login, /api/logout, /api/me: custom REST endpoints.
• /src/components: React UI components (forms, cards, provider wrappers).
• /src/lib: data-access abstractions (fetching questions, replies, topics, authentication helpers).
• /src/middleware: custom Next.js middleware for logging.
• /src/store: Redux Toolkit slices and RTK Query setup for state & API integration (wpApi.js to call external WordPress API).
• /src/plugins: UI plugins (rich text editor, HTML decoder).
• /public & /styles: static assets and global CSS.
README for additional insights
• Bootstrapped via create-next-app.
• Uses Next.js app router, built-in Font optimization.
• Deployable on Vercel.
Architectural patterns
• Component-based frontend (React)
• API routes for backend logic in the same codebase (Next.js full-stack pattern)
• State management with Redux Toolkit and RTK Query for caching/fetching
• Middleware layer for cross-cutting concerns (logging)
• Headless CMS integration (WordPress)
Be detailed but focused
• Major Next.js app router directories that generate pages.
• Middleware and plugin steps in the server layer.
• Redux store interaction as a side-car to UI layer.
• NextAuth flow separately (login → token/session → protected routes).