How nextlevelfrontend/full-stack-portfolio works
Purpose and Runtime
This is a Next.js App Router portfolio/CMS application backed by Supabase. It exposes a public portfolio, projects, blogs, and contact experience, plus an authenticated admin area for content management. It runs as a Next.js server application, styled with Tailwind CSS, and is suitable for Vercel deployment. Supabase provides cookie-based authentication and likely persists application content and uploaded assets.
Entry Points and Route Domains
The public site starts at app/page.tsx under the global root layout in app/layout.tsx. Public content has collection and slug-detail routes at app/blogs/page.tsx, app/blogs/[slug]/page.tsx, app/projects/page.tsx, and app/projects/[slug]/page.tsx.
Administration is isolated in the (admin) route group: login is app/(admin)/login/page.tsx; the CMS shell is app/(admin)/admin/layout.tsx; dashboards and management screens live below app/(admin)/admin.
Public Presentation Layer
Reusable site sections form the public composition layer: website-components/layout/WebsiteMainLayout.tsx, website-components/Header.tsx, website-components/Portfolio.tsx, website-components/Blogs.tsx, and website-components/ContactForm.tsx. These components separate portfolio-oriented display from the admin-oriented components in components/.
Public requests flow from App Router pages into these presentation components and, where dynamic data is needed, to the application's API/Supabase boundary rather than directly coupling layout code to administrative screens.
Content Management Domain
The admin domain manages blogs and projects through dedicated listing, creation, and slug-specific edit/detail routes: app/(admin)/admin/blogs/page.tsx, app/(admin)/admin/blogs/create/page.tsx, app/(admin)/admin/blogs/[slug]/page.tsx, app/(admin)/admin/projects/page.tsx, and app/(admin)/admin/projects/[slug]/page.tsx.
Shared CMS interaction components include components/BlogForm.tsx, components/SideNavigation.tsx, and components/LoginForm.tsx. The boundary is route-based: public pages consume published content, while admin pages provide authenticated authoring operations.
Server API Boundary
Route handlers provide server-side endpoints for core application actions: app/api/blogs/route.ts, app/api/projects/route.ts, app/api/contact/route.ts, app/api/upload/route.ts, and app/api/app/route.ts. These are the primary HTTP boundary for content retrieval/mutation, contact submission, upload handling, and application-level data.
The expected control flow is browser/page component → Next.js route handler → Supabase service. Keeping this boundary centralizes backend access and avoids exposing privileged server behavior to client components.
Authentication and Session Propagation
Supabase auth is initialized for distinct execution contexts in utils/supabase/client.ts, utils/supabase/server.ts, and utils/supabase/middleware.ts. The callback endpoint at app/auth/callback/route.ts completes authentication flows.
middleware.ts is the cross-cutting request gate/session-refresh point. It enables cookie-backed sessions to be available to App Router server components, route handlers, and protected admin routes; the login-to-admin transition is therefore governed by Supabase session state rather than a separate application auth service.
Infrastructure and Design Boundaries
External dependencies are Supabase (Auth, database, and potentially Storage) and the deployment/runtime target implied by next.config.js and the README’s Vercel integration. Required Supabase URL and anonymous key are environment-driven.
UI is split between application-specific layouts/components (components/MainLayout.tsx, website-components/) and a reusable primitive layer (components/ui/). This permits public branding and CMS workflows to evolve independently while sharing common controls and global styling from app/globals.css.
Main entry points: server.ts Supabase clients · WebsiteMainLayout.tsx Public presentation · BlogForm.tsx CMS components · route.ts Content API
Components 18
Public site
- Root layout · Applies global styling and shared application framing.
app/layout.tsx - Portfolio routes · Home plus blog and project collection/detail pages.
app/page.tsx - Public presentation · Header, portfolio, blog, and contact compositions.
website-components/layout/WebsiteMainLayout.tsx - Contact form
website-components/ContactForm.tsx
Admin CMS
Authenticated authoring routes.
- Login page
app/(admin)/login/page.tsx - CMS shell · Shared admin navigation and framing.
app/(admin)/admin/layout.tsx - Content management · Blog and project listing, creation, and editing routes.
app/(admin)/admin/blogs/page.tsx - CMS components · Forms and side navigation for CMS workflows.
components/BlogForm.tsx
Next.js server
- Session middleware · Refreshes cookie sessions and protects admin requests.
middleware.ts - Auth callback · Completes Supabase authentication flows.
app/auth/callback/route.ts - Content API · Blog and project retrieval and mutation boundary.
app/api/blogs/route.ts - Contact API · Handles contact submissions.
app/api/contact/route.ts - Upload API · Handles uploaded content assets.
app/api/upload/route.ts - Application API · Provides application-level data.
app/api/app/route.ts - Supabase clients · Context-specific browser, server, and middleware initialization.
utils/supabase/server.ts
Supabase
External auth, content, and asset services.
- Supabase Auth · Cookie-backed user sessions.
- Supabase data · Persists published content and uploaded assets.
Other components
- Shared UI primitives · Reusable controls shared by public and CMS UI.
components/ui/button.tsx
Connections 21
- Root layout → Portfolio routes: wraps
- Portfolio routes → Public presentation: renders
- Public presentation → Contact form: includes
- Public presentation → Content API: loads content
- Contact form → Contact API: submits
- Login page → Auth callback: auth flow
- Auth callback → Supabase clients: uses
- CMS shell → Content management: wraps
- Content management → CMS components: renders
- CMS components → Content API: manages content
- CMS components → Upload API: uploads assets
- Session middleware → CMS shell: guards
- Session middleware → Supabase clients: refreshes session
- Supabase clients → Supabase Auth: authenticates
- Content API → Supabase clients: uses
- Contact API → Supabase clients: uses
- Upload API → Supabase clients: uses
- Application API → Supabase clients: uses
- Supabase clients → Supabase data: reads and writes
- Public presentation → Shared UI primitives: composes
- CMS components → Shared UI primitives: composes