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/, andsrc/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/orapp/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 routeDetected metadata:
isInAppDir: true- File is in/app/directorydirective: 'client' | 'server'- 'use client' or 'use server' directiverouteRole- Route role based on filename (page, layout, loading, error, not-found, template, default, route)segmentPath- Route path derived from file structuremetadata- Metadata exports (static and/or dynamic)
Route Roles
LogicStamp detects route roles based on special Next.js filenames:
| Filename | Route Role | Description |
|---|---|---|
page.tsx | page | Page component |
layout.tsx | layout | Layout component |
loading.tsx | loading | Loading UI component |
error.tsx | error | Error boundary component |
not-found.tsx | not-found | Not found page |
template.tsx | template | Template component |
default.tsx | default | Default parallel route |
route.ts | route | API route handler |
Segment Paths
LogicStamp extracts route paths from file structure:
app/page.tsxsegmentPath: '/'Root route path
app/blog/page.tsxsegmentPath: '/blog'Nested route path
app/blog/[slug]/page.tsxsegmentPath: '/blog/[slug]'Dynamic route with parameter
app/(auth)/login/page.tsxsegmentPath: '/login'Route groups are removed
app/api/users/route.tssegmentPath: '/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 ./appLimitations
- Middleware files are detected but not fully analyzed
getServerSidePropsandgetStaticPropsare 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.