Framework Support

Next.js Framework Support

LogicStamp Context provides enhanced support for Next.js applications, automatically detecting Next.js-specific patterns, routing, and conventions.

Next.js Detection

LogicStamp automatically identifies Next.js projects by:

  • File structure: Detects app/, pages/, and src/app/ directories
  • Next.js imports: Detects imports from next, next/link, next/router, etc.
  • Route files: Identifies page and layout files based on Next.js conventions
  • API routes: Detects API route handlers in pages/api/ or app/api/

App Router (Next.js 13+)

LogicStamp detects and extracts App Router patterns:

app/ layout.tsx → Layout component page.tsx → Page component loading.tsx → Loading component error.tsx → Error component route.ts → Route handler api/ users/ route.ts → API route

Detected metadata:

  • isInAppDir: true - File is in /app/ directory
  • directive: 'client' | 'server' - 'use client' or 'use server' directive
  • routeRole - Route role based on filename (page, layout, loading, error, not-found, template, default, route)
  • segmentPath - Route path derived from file structure
  • metadata - Metadata exports (static and/or dynamic)

Route Roles

LogicStamp detects route roles based on special Next.js filenames:

FilenameRoute RoleDescription
page.tsxpagePage component
layout.tsxlayoutLayout component
loading.tsxloadingLoading UI component
error.tsxerrorError boundary component
not-found.tsxnot-foundNot found page
template.tsxtemplateTemplate component
default.tsxdefaultDefault parallel route
route.tsrouteAPI route handler

Segment Paths

LogicStamp extracts route paths from file structure:

app/page.tsx
segmentPath: '/'

Root route path

app/blog/page.tsx
segmentPath: '/blog'

Nested route path

app/blog/[slug]/page.tsx
segmentPath: '/blog/[slug]'

Dynamic route with parameter

app/(auth)/login/page.tsx
segmentPath: '/login'

Route groups are removed

app/api/users/route.ts
segmentPath: '/api/users'

API route path

Note: Route groups (parentheses) are automatically removed from segment paths. Both app/ and src/app/ directory structures are supported.

Metadata Extraction

LogicStamp extracts Next.js metadata exports:

Static Metadata

// app/page.tsx export const metadata = { title: 'My Page', description: 'Page description', keywords: ['nextjs', 'react'] }; export default function Page() { return <div>Page</div>; }

Detected: metadata.static - Object containing extracted metadata properties. Supports string, number, boolean, and null values.

Dynamic Metadata

// app/blog/[slug]/page.tsx export function generateMetadata({ params }: { params: { slug: string } }) { return { title: `Post: ${params.slug}`, description: 'Dynamic description' }; } export default function BlogPost() { return <div>Post</div>; }

Detected: metadata.dynamic: true - Indicates generateMetadata function exists.

Usage

No special configuration needed for Next.js projects:

# Scan Next.js project stamp context # With style extraction stamp context --include-style # Specific directory stamp context ./app

Limitations

  • Middleware files are detected but not fully analyzed
  • getServerSideProps and getStaticProps are identified but their return types may not be fully extracted
  • Dynamic imports in routes are tracked but not resolved

Next Steps

Get started with LogicStamp Context or explore other framework integrations.