1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2981],{82378:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/trading-engine/technical/frontend/app-router-structure",function(){return n(43545)}])},43545:function(e,t,n){"use strict";n.r(t),n.d(t,{__toc:function(){return c}});var i=n(52676),r=n(59552),s=n(48975),a=n(96735);n(5853);var o=n(40605),l=n(82657);let c=[{depth:2,value:"Directory Structure",id:"directory-structure"},{depth:2,value:"Route Groups",id:"route-groups"},{depth:3,value:"Auth Routes (auth)",id:"auth-routes-auth"},{depth:3,value:"Dashboard Routes (dashboard)",id:"dashboard-routes-dashboard"},{depth:2,value:"Layouts",id:"layouts"},{depth:3,value:"Root Layout (app/layout.tsx)",id:"root-layout-applayouttsx"},{depth:3,value:"Dashboard Layout (app/(dashboard)/layout.tsx)",id:"dashboard-layout-appdashboardlayouttsx"},{depth:2,value:"Page Pattern",id:"page-pattern"},{depth:2,value:"API Routes",id:"api-routes"},{depth:2,value:"Middleware",id:"middleware"},{depth:2,value:"Static vs Dynamic",id:"static-vs-dynamic"}];function d(e){let t=Object.assign({h1:"h1",p:"p",strong:"strong",h2:"h2",hr:"hr",h3:"h3",code:"code",table:"table",thead:"thead",tr:"tr",th:"th",tbody:"tbody",td:"td",pre:"pre",span:"span",ul:"ul",li:"li"},(0,o.a)(),e.components);return l.zH||h("FileTree",!1),l.zH.File||h("FileTree.File",!0),l.zH.Folder||h("FileTree.Folder",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h1,{children:"App Router Structure"}),"\n",(0,i.jsxs)(t.p,{children:["Nexgent uses ",(0,i.jsx)(t.strong,{children:"Next.js 15"})," with the App Router for server-side rendering, routing, and layouts."]}),"\n",(0,i.jsx)(t.h2,{id:"directory-structure",children:"Directory Structure"}),"\n",(0,i.jsx)(l.zH,{children:(0,i.jsxs)(l.zH.Folder,{name:"src/app",defaultOpen:!0,children:[(0,i.jsxs)(l.zH.Folder,{name:"(auth)",defaultOpen:!0,children:[(0,i.jsx)(l.zH.File,{name:"layout.tsx"}),(0,i.jsx)(l.zH.Folder,{name:"login",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})}),(0,i.jsx)(l.zH.Folder,{name:"register",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})})]}),(0,i.jsxs)(l.zH.Folder,{name:"(dashboard)",defaultOpen:!0,children:[(0,i.jsx)(l.zH.File,{name:"layout.tsx"}),(0,i.jsxs)(l.zH.Folder,{name:"dashboard",defaultOpen:!0,children:[(0,i.jsx)(l.zH.File,{name:"page.tsx"}),(0,i.jsx)(l.zH.Folder,{name:"general",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})}),(0,i.jsx)(l.zH.Folder,{name:"agent-profile",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})}),(0,i.jsx)(l.zH.Folder,{name:"performance-overview",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})}),(0,i.jsx)(l.zH.Folder,{name:"trade-signals",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})}),(0,i.jsx)(l.zH.Folder,{name:"transactions",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})}),(0,i.jsx)(l.zH.Folder,{name:"wallet",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})}),(0,i.jsx)(l.zH.Folder,{name:"integrations",children:(0,i.jsx)(l.zH.File,{name:"page.tsx"})})]})]}),(0,i.jsx)(l.zH.Folder,{name:"api/auth/[...nextauth]",children:(0,i.jsx)(l.zH.File,{name:"route.ts"})}),(0,i.jsx)(l.zH.File,{name:"layout.tsx"}),(0,i.jsx)(l.zH.File,{name:"page.tsx"}),(0,i.jsx)(l.zH.File,{name:"globals.css"})]})}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h2,{id:"route-groups",children:"Route Groups"}),"\n",(0,i.jsx)(t.p,{children:"Next.js route groups (folders in parentheses) organize routes without affecting the URL structure."}),"\n",(0,i.jsxs)(t.h3,{id:"auth-routes-auth",children:["Auth Routes ",(0,i.jsx)(t.code,{children:"(auth)"})]}),"\n",(0,i.jsx)(t.p,{children:"Authentication pages with a minimal layout (no sidebar):"}),"\n",(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:"Route"}),(0,i.jsx)(t.th,{children:"File"}),(0,i.jsx)(t.th,{children:"Description"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/login"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"(auth)/login/page.tsx"})}),(0,i.jsx)(t.td,{children:"Login form"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/register"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"(auth)/register/page.tsx"})}),(0,i.jsx)(t.td,{children:"Registration form"})]})]})]}),"\n",(0,i.jsxs)(t.h3,{id:"dashboard-routes-dashboard",children:["Dashboard Routes ",(0,i.jsx)(t.code,{children:"(dashboard)"})]}),"\n",(0,i.jsx)(t.p,{children:"Protected pages with the full dashboard layout (sidebar, header):"}),"\n",(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:"Route"}),(0,i.jsx)(t.th,{children:"File"}),(0,i.jsx)(t.th,{children:"Description"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/page.tsx"})}),(0,i.jsx)(t.td,{children:"Dashboard home (redirects to general)"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard/general"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/general/page.tsx"})}),(0,i.jsx)(t.td,{children:"Main dashboard with positions"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard/agent-profile"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/agent-profile/page.tsx"})}),(0,i.jsx)(t.td,{children:"Agent trading configuration"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard/performance-overview"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/performance-overview/page.tsx"})}),(0,i.jsx)(t.td,{children:"Performance charts and metrics"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard/trade-signals"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/trade-signals/page.tsx"})}),(0,i.jsx)(t.td,{children:"Signal history"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard/transactions"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/transactions/page.tsx"})}),(0,i.jsx)(t.td,{children:"Transaction history"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard/wallet"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/wallet/page.tsx"})}),(0,i.jsx)(t.td,{children:"Wallet management"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"/dashboard/integrations"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"dashboard/integrations/page.tsx"})}),(0,i.jsx)(t.td,{children:"API keys and integrations"})]})]})]}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h2,{id:"layouts",children:"Layouts"}),"\n",(0,i.jsxs)(t.h3,{id:"root-layout-applayouttsx",children:["Root Layout (",(0,i.jsx)(t.code,{children:"app/layout.tsx"}),")"]}),"\n",(0,i.jsx)(t.p,{children:"The root layout wraps the entire application with providers:"}),"\n",(0,i.jsx)(t.pre,{"data-language":"tsx","data-theme":"default",children:(0,i.jsxs)(t.code,{"data-language":"tsx","data-theme":"default",children:[(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// app/layout.tsx"})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { AppProviders } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/shared/providers'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { Toaster } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/shared/components/ui/toaster'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"default"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"RootLayout"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"({ children }"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { children"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"React"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"ReactNode"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" }) {"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ("})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"html"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"lang"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"en"'}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"className"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"dark"'}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"body"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"className"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"font-sans"'}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"AppProviders"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">{children}</"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"AppProviders"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"Toaster"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" />"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" </"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"body"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" </"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"html"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" );"})}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,i.jsxs)(t.h3,{id:"dashboard-layout-appdashboardlayouttsx",children:["Dashboard Layout (",(0,i.jsx)(t.code,{children:"app/(dashboard)/layout.tsx"}),")"]}),"\n",(0,i.jsx)(t.p,{children:"The dashboard layout provides the sidebar and requires authentication:"}),"\n",(0,i.jsx)(t.pre,{"data-language":"tsx","data-theme":"default",children:(0,i.jsxs)(t.code,{"data-language":"tsx","data-theme":"default",children:[(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// app/(dashboard)/layout.tsx"})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'use client'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { useSession } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'next-auth/react'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { redirect } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'next/navigation'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { SidebarProvider"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" SidebarInset } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/shared/components/ui/sidebar'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { AppSidebar } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(
1t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/shared/components/layout/app-sidebar'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { Providers } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/shared/contexts/providers'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"default"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"DashboardLayout"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"({ children }"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { children"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"React"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"ReactNode"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" }) {"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"const"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"status"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"useSession"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"();"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"if"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" (status "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"==="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'unauthenticated'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"redirect"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'/login'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"if"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" (status "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"==="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'loading'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"LoadingScreen"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" />;"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ("})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"Providers"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"SidebarProvider"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"AppSidebar"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" />"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"SidebarInset"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {children}"})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" </"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"SidebarInset"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" </"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"SidebarProvider"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" </"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"Providers"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" );"})}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,i.jsx)(l.UW,{type:"info",children:(0,i.jsxs)(t.p,{children:["The dashboard layout uses ",(0,i.jsx)(t.code,{children:"Providers"})," from contexts (agent selection, currency, trading mode) which are separate from ",(0,i.jsx)(t.code,{children:"AppProviders"})," (NextAuth, React Query) at the root."]})}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h2,{id:"page-pattern",children:"Page Pattern"}),"\n",(0,i.jsx)(t.p,{children:"Pages are thin wrappers that compose feature components:"}),"\n",(0,i.jsx)(t.pre,{"data-language":"tsx","data-theme":"default",children:(0,i.jsxs)(t.code,{"data-language":"tsx","data-theme":"default",children:[(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// app/(dashboard)/dashboard/general/page.tsx"})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { LivePositionsTable } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/features/positions'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { RecentTradesTable } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/features/trades'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { SystemHealthCard } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'@/features/system-health'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"default"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"GeneralPage"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"}
1,children:"() {"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ("})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"div"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"className"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"flex flex-col gap-6 p-6"'}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"h1"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"className"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"text-2xl font-bold"'}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">Dashboard</"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"h1"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"div"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"className"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"grid gap-6"'}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"LivePositionsTable"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" />"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"RecentTradesTable"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" />"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" <"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"SystemHealthCard"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" />"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" </"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"div"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" </"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"div"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:">"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" );"})}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h2,{id:"api-routes",children:"API Routes"}),"\n",(0,i.jsx)(t.p,{children:"NextAuth.js uses an API route for authentication callbacks:"}),"\n",(0,i.jsx)(t.pre,{"data-language":"tsx","data-theme":"default",children:(0,i.jsxs)(t.code,{"data-language":"tsx","data-theme":"default",children:[(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// app/api/auth/[...nextauth]/route.ts"})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" NextAuth "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'next-auth'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { authConfig } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"}
1,children:"'@/infrastructure/auth/auth-config'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"const"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"handler"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"NextAuth"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(authConfig);"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { handler "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"as"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" GET"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" handler "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"as"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" POST };"})]})]})}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h2,{id:"middleware",children:"Middleware"}),"\n",(0,i.jsx)(t.p,{children:"Next.js middleware protects routes and handles redirects:"}),"\n",(0,i.jsx)(t.pre,{"data-language":"tsx","data-theme":"default",children:(0,i.jsxs)(t.code,{"data-language":"tsx","data-theme":"default",children:[(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// src/middleware.ts"})}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { withAuth } "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'next-auth/middleware'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"default"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"withAuth"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"({"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" pages"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" signIn"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'/login'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" }"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"});"})}),"\n",(0,i.jsx)(t.span,{className:"line",children:" "}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"const"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"config"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,i.jsxs)(t.span,{className:"line",children:[(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" matcher"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ["}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'/dashboard/:path*'"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"]"}),(0,i.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,i.jsx)(t.span,{className:"line",children:(0,i.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"};"})})]})}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h2,{id:"static-vs-dynamic",children:"Static vs Dynamic"}),"\n",(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:"Rendering"}),(0,i.jsx)(t.th,{children:"Usage"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.strong,{children:"Static"})}),(0,i.jsx)(t.td,{children:"Landing page, auth pages"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.strong,{children:"Dynamic"})}),(0,i.jsx)(t.td,{children:"Dashboard pages (require session)"})]})]})]}),"\n",(0,i.jsxs)(t.p,{children:["Dashboard pages are client components (",(0,i.jsx)(t.code,{children:"'use client'"}
1),") because they depend on:"]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Session state (authentication)"}),"\n",(0,i.jsx)(t.li,{children:"WebSocket connections (real-time updates)"}),"\n",(0,i.jsx)(t.li,{children:"Client-side contexts (agent selection)"}),"\n"]})]})}function h(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}let g={MDXContent:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,o.a)(),e.components);return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(d,{...e})}):d(e)},pageOpts:{filePath:"pages/trading-engine/technical/frontend/app-router-structure.mdx",route:"/trading-engine/technical/frontend/app-router-structure",frontMatter:{title:"App Router Structure",description:"Next.js 15 App Router configuration and routing"},timestamp:1769255365e3,pageMap:[{kind:"Meta",data:{index:{type:"page",display:"hidden",title:"Nexgent Documentation"},"trading-engine":{title:"OS Trading Engine",type:"page",display:"hidden"},"signal-engine":{title:"Nexgent Signals",type:"page",display:"hidden"},tokenomics:{title:"Tokenomics",type:"page",display:"hidden"}}},{kind:"MdxPage",name:"index",route:"/",frontMatter:{title:"Nexgent Documentation"}},{kind:"Folder",name:"signal-engine",route:"/signal-engine",children:[{kind:"Meta",data:{index:"Introduction","getting-started":"Getting Started","token-lock":"Token Lock Mechanism","---strategies":{type:"separator",title:"Signal Strategies"},strategies:"Signal Strategies","---delivery":{type:"separator",title:"Signal Delivery"},delivery:"Delivery Methods"}},{kind:"MdxPage",name:"delivery",route:"/signal-engine/delivery",frontMatter:{title:"Signal Delivery",description:"Configure how you receive Nexgent trading signals"}},{kind:"MdxPage",name:"getting-started",route:"/signal-engine/getting-started",frontMatter:{title:"Getting Started",description:"Subscribe to Nexgent Signals and configure delivery in minutes"}},{kind:"MdxPage",name:"index",route:"/signal-engine",frontMatter:{title:"Nexgent Signals",description:"AI-powered trading signal generation and delivery platform for Solana",asIndexPage:!0}},{kind:"MdxPage",name:"strategies",route:"/signal-engine/strategies",frontMatter:{title:"Signal Strategies",description:"Overview of Nexgent's AI-powered trading signal strategies"}},{kind:"MdxPage",name:"token-lock",route:"/signal-engine/token-lock",frontMatter:{title:"Token Lock Mechanism",description:"A simple explanation of how Nexgent token locking works and why it secures the ecosystem"}}]},{kind:"Folder",name:"tokenomics",route:"/tokenomics",children:[{kind:"Meta",data:{index:"Token Utility"}},{kind:"MdxPage",name:"index",route:"/tokenomics",frontMatter:{title:"Nexgent Tokenomics",description:"Token economics, utility, and on-chain transparency for $NEXGENT",asIndexPage:!0}}]},{kind:"Folder",name:"trading-engine",route:"/trading-engine",children:[{kind:"Meta",data:{index:"Introduction",comparison:"Nexgent vs. Alternatives","---getting-started":{type:"separator",title:"Getting Started"},"getting-started":"Getting Started","self-hosting":"Self-Hosting","---usage":{type:"separator",title:"Usage"},"platform-guide":"Platform Guide","api-reference":"API Reference","---technical":{type:"separator",title:"Technical"},technical:"Technical Documentation","---additional":{type:"separator",title:"Additional"},security:"Security",contributing:"Contributing",reference:"Reference",resources:"Resources"}},{kind:"Folder",name:"api-reference",route:"/trading-engine/api-reference",children:[{kind:"Meta",data:{overview:"Overview",authentication:"Authentication",endpoints:"Endpoints",websocket:"WebSocket API",postman:"Postman Collection","error-codes":"Error Codes & Handling"}},{kind:"Folder",name:"authentication",route:"/trading-engine/api-reference/authentication",children:[{kind:"Meta",data:{"jwt-tokens":"JWT Tokens","api-keys":"API Keys","login-registration":"Login & Authentication","token-refresh":"Token Refresh"}},{kind:"MdxPage",name:"api-keys",route:"/trading-engine/api-reference/authentication/api-keys",frontMatter:{title:"API Keys",description:"API key authentication for programmatic access"}},{kind:"MdxPage",name:"jwt-tokens",route:"/trading-engine/api-reference/authentication/jwt-tokens",frontMatter:{title:"JWT Tokens",description:"JWT-based authentication for the Nexgent API"}},{kind:"MdxPage",name:"login-registration",route:"/trading-engine/api-reference/authentication/login-registration",frontMatter:{title:"Login & Authentication",description:"User authentication endpoints"}},{kind:"MdxPage",name:"token-refresh",route:"/trading-engine/api-reference/authentication/token-refresh",frontMatter:{title:"Token Refresh",description:"Refresh expired JWT tokens"}}]},{kind:"Folder",name:"endpoints",route:"/trading-engine/api-reference/endpoints",children:[{kind:"Meta",data:{agents:"Agents","agent-balances":"Agent Balances","agent-positions":"Agent Positions","agent-transactions":"Agent Transactions","historical-swaps":"Historical Swaps","trading-signals":"Trading Signals",wallets:"Wallets","data-sources":"Data Sources","price-feeds":"Price Feeds","health-metrics":"Health & Metrics"}},{kind:"MdxPage",name:"agent-balances",route:"/trading-engine/api-reference/endpoints/agent-balances",frontMatter:{title:"Agent Balances",description:"API endpoints for managing agent token balances"}},{kind:"MdxPage",name:"agent-positions",route:"/trading-engine/api-reference/endpoints/agent-positions",frontMatter:{title:"Agent Positions",description:"API endpoints for viewing and managing open positions"}},{kind:"MdxPage",name:"agent-transactions",route:"/trading-engine/api-reference/endpoints/agent-transactions",frontMatter:{title:"Agent Transactions",description:"API endpoints for viewing agent transaction history"}},{kind:"MdxPage",name:"agents",route:"/trading-engine/api-reference/endpoints/agents",frontMatter:{title:"Agents",description:"API endpoints for managing trading agents"}},{kind:"MdxPage",name:"data-sources",route:"/trading-engine/api-reference/endpoints/data-sources",frontMatter:{title:"Data Sources",description:"API endpoint for checking data source configuration status"}},{kind:"MdxPage",name:"health-metrics",route:"/trading-engine/api-reference/endpoints/health-metrics",frontMatter:{title:"Health & Metrics",description:"API endpoints for system health checks and Prometheus metrics"}},{kind:"MdxPage",name:"historical-swaps",route:"/trading-engine/api-reference/endpoints/historical-swaps",frontMatter:{title:"Historical Swaps",description:"API endpoints for viewing completed trades and P/L history"}},{kind:"MdxPage",name:"price-feeds",route:"/trading-engine/api-reference/endpoints/price-feeds",frontMatter:{title:"Price Feeds",description:"API endpoint for getting current SOL/USD price"}},{kind:"MdxPage",name:"trading-signals",route:"/trading-engine/api-reference/endpoints/trading-signals",frontMatter:{title:"Trading Signals",description:"API endpoints for sending and managing trading signals"}},{kind:"MdxPage",name:"wallets",route:"/trading-engine/api-reference/endpoints/wallets",frontMatter:{title:"Wallets",description:"API endpoints for managing agent wallets"}}]},{kind:"MdxPage",name:"error-codes",route:"/trading-engine/api-reference/error-codes",frontMatter:{title:"Error Codes & Handling",description:"API error codes, response formats, and handling strategies"}},{kind:"MdxPage",name:"overview",route:"/trading-engine/api-reference/overview",frontMatter:{title:"API Overview",description:"Introduction to the Nexgent REST API"}},{kind:"MdxPage",name:"postman",route:"/trading-engine/api-reference/postman",frontMatter:{title:"Postman Collection",description:"Import and use the Nexgent API Postman collection"}},{kind:"Folder",name:"websocket",route:"/trading-engine/api-reference/websocket",children:[{kind:"Meta",data:{connection:"Connection",events:"Events",examples:"Example Implementations"}},{kind:"MdxPage",name:"connection",route:"/trading-engine/api-reference/websocket/connection",frontMatter:{title:"WebSocket Connection",description:"Connect to the Nexgent WebSocket API for real-time updates"}},{kind:"MdxPage",name:"events",route:"/trading-engine/api-reference/websocket/events",frontMatter:{title:"WebSocket Events",description:"WebSocket message types and event structures"}},{kind:"MdxPage",name:"examples",route:"/trading-engine/api-reference/websocket/examples",frontMatter:{title:"WebSocket Examples",description:"Example implementations for WebSocket connections"}}]}]},{kind:"MdxPage",name:"comparison",route:"/trading-engine/comparison",frontMatter:{title:"Nexgent vs. Alternatives",description:"Compare Nexgent AI with other Solana trading automation solutions"}},{kind:"Folder",name:"contributing",route:"/trading-engine/contributing",children:[{kind:"Meta",data:{"how-to-contribute":"How to Contribute","code-style":"Code Style Guide",testing:"Testing Guide","pull-requests":"Pull Request Process","release-process":"Release Process"}},{kind:"MdxPage",name:"code-style",route:"/trading-engine/contributing/code-style",frontMatter:{title:"Code Style Guide",description:"Coding conventions and style guidelines"}},{kind:"MdxPage",name:"how-to-contribute",route:"/trading-engine/contributing/how-to-contribute",frontMatter:{title:"How to Contribute",description:"Guide to contributing to the Nexgent open-source project"}},{kind:"MdxPage",name:"pull-requests",route:"/trading-engine/contributing/pull-requests",frontMatter:{title:"Pull Request Process",description:"Guidelines for submitting pull requests"}},{kind:"MdxPage",name:"release-process",route:"/trading-engine/contributing/release-process",frontMatter:{title:"Release Process",description:"How releases are managed for Nexgent"}},{kind:"MdxPage",name:"testing",route:"/trading-engine/contributing/testing",frontMatter:{title:"Testing Guide",description:"Guide to writing and running tests"}}]},{kind:"Folder",name:"getting-started",route:"/trading-engine/getting-started",children:[{kind:"Meta",data:{quickstart:"Quickstart (Local Dev)","quickstart-cloud":"Quickstart (Cloud Hosting)","core-concepts":"Core Concepts"}},{kind:"Folder",name:"core-concepts",route:"/trading-engine/getting-started/core-concepts",children:[{kind:"Meta",data:{overview:"Overview",agents:"Agents",positions:"Positions","trading-signals":"Trading Signals","simulation-vs-live":"Simulation vs Live Trading","risk-management":"Risk Management"}},{kind:"MdxPage",name:"agents",route:"/trading-engine/getting-started/core-concepts/agents",frontMatter:{title:"Agents",description:"Understanding trading agents in Nexgent"}},{kind:"MdxPage",name:"overview",route:"/trading-engine/getting-started/core-concepts/
1overview",frontMatter:{title:"Core Concepts Overview",description:"Understand how Nexgent's trading engine works"}},{kind:"MdxPage",name:"positions",route:"/trading-engine/getting-started/core-concepts/positions",frontMatter:{title:"Positions",description:"Understanding positions in Nexgent"}},{kind:"MdxPage",name:"risk-management",route:"/trading-engine/getting-started/core-concepts/risk-management",frontMatter:{title:"Risk Management",description:"Understanding stop loss, take profit, and DCA strategies in Nexgent"}},{kind:"MdxPage",name:"simulation-vs-live",route:"/trading-engine/getting-started/core-concepts/simulation-vs-live",frontMatter:{title:"Simulation vs Live Trading",description:"Understanding the difference between simulation and live trading modes"}},{kind:"MdxPage",name:"trading-signals",route:"/trading-engine/getting-started/core-concepts/trading-signals",frontMatter:{title:"Trading Signals",description:"Understanding trading signals in Nexgent"}}]},{kind:"MdxPage",name:"quickstart-cloud",route:"/trading-engine/getting-started/quickstart-cloud",frontMatter:{title:"Quickstart (Cloud Hosting)",description:"Deploy Nexgent to cloud in minutes using Railway's one-click template"}},{kind:"MdxPage",name:"quickstart",route:"/trading-engine/getting-started/quickstart",frontMatter:{title:"Quickstart (Local Dev)",description:"Get Nexgent running locally in 15 minutes"}}]},{kind:"MdxPage",name:"index",route:"/trading-engine",frontMatter:{title:"Nexgent Trading Engine",description:"Open-source, self-hosted trading automation framework for Solana",asIndexPage:!0}},{kind:"Folder",name:"platform-guide",route:"/trading-engine/platform-guide",children:[{kind:"Meta",data:{dashboard:"Dashboard Overview",agents:"Agents",wallets:"Wallets",positions:"Positions","trading-signals":"Trading Signals",transactions:"Transactions & History"}},{kind:"Folder",name:"agents",route:"/trading-engine/platform-guide/agents",children:[{kind:"Meta",data:{creating:"Creating Agents",configuration:"Agent Configuration","trading-settings":"Trading Settings",performance:"Agent Performance"}},{kind:"MdxPage",name:"configuration",route:"/trading-engine/platform-guide/agents/configuration",frontMatter:{title:"Agent Configuration",description:"Complete guide to configuring your trading agent's profile and trading strategy settings"}},{kind:"MdxPage",name:"creating",route:"/trading-engine/platform-guide/agents/creating",frontMatter:{title:"Creating Agents",description:"Step-by-step guide to creating your first trading agent in Nexgent AI"}},{kind:"MdxPage",name:"performance",route:"/trading-engine/platform-guide/agents/performance",frontMatter:{title:"Agent Performance",description:"Understanding agent performance metrics, how they're calculated, and what they mean"}},{kind:"Folder",name:"trading-settings",route:"/trading-engine/platform-guide/agents/trading-settings",children:[{kind:"Meta",data:{signals:"Signals Configuration","stop-loss":"Stop Loss Configuration",dca:"DCA Configuration","take-profit":"Take Profit Configuration","stale-trades":"Stale Trade Settings","auto-trade":"Auto Trade Configuration"}},{kind:"MdxPage",name:"auto-trade",route:"/trading-engine/platform-guide/agents/trading-settings/auto-trade",frontMatter:{title:"Auto Trade Configuration",description:"Complete guide to configuring auto trade for automatic token re-entry after position close"}},{kind:"MdxPage",name:"dca",route:"/trading-engine/platform-guide/agents/trading-settings/dca",frontMatter:{title:"DCA Configuration",description:"Complete guide to configuring Dollar Cost Averaging (DCA) settings for your trading agent"}},{kind:"MdxPage",name:"signals",route:"/trading-engine/platform-guide/agents/trading-settings/signals",frontMatter:{title:"Signals Configuration",description:"Complete guide to configuring signal filtering settings for your trading agent"}},{kind:"MdxPage",name:"stale-trades",route:"/trading-engine/platform-guide/agents/trading-settings/stale-trades",frontMatter:{title:"Stale Trade Configuration",description:"Complete guide to configuring stale trade auto-close settings for your trading agent"}},{kind:"MdxPage",name:"stop-loss",route:"/trading-engine/platform-guide/agents/trading-settings/stop-loss",frontMatter:{title:"Stop Loss Configuration",description:"Complete guide to configuring stop loss settings for your trading agent"}},{kind:"MdxPage",name:"take-profit",route:"/trading-engine/platform-guide/agents/trading-settings/take-profit",frontMatter:{title:"Take Profit Configuration",description:"Complete guide to configuring partial take-profit settings for your trading agent"}}]}]},{kind:"MdxPage",name:"dashboard",route:"/trading-engine/platform-guide/dashboard",frontMatter:{title:"Dashboard Overview",description:"Learn how to navigate and use the Nexgent AI dashboard - your command center for managing trading agents"}},{kind:"Folder",name:"positions",route:"/trading-engine/platform-guide/positions",children:[{kind:"Meta",data:{"live-positions":"Live Positions","manual-close":"Manual Close"}},{kind:"MdxPage",name:"live-positions",route:"/trading-engine/platform-guide/positions/live-positions",frontMatter:{title:"Live Positions",description:"Monitor and manage live trading positions with real-time price updates, profit/loss tracking, and WebSocket connections"}},{kind:"MdxPage",name:"manual-close",route:"/trading-engine/platform-guide/positions/manual-close",frontMatter:{title:"Manual Close",description:"How to manually exit trading positions before automated triggers occur"}}]},{kind:"Folder",name:"trading-signals",route:"/trading-engine/platform-guide/trading-signals",children:[{kind:"Meta",data:{understanding:"Understanding Signals","signal-flow":"Signal Processing Flow"}},{kind:"MdxPage",name:"signal-flow",route:"/trading-engine/platform-guide/trading-signals/signal-flow",frontMatter:{title:"Signal Processing Flow",description:"Detailed explanation of how signals are processed from creation to trade execution"}},{kind:"MdxPage",name:"understanding",route:"/trading-engine/platform-guide/trading-signals/understanding",frontMatter:{title:"Understanding Signals",description:"What trading signals are, how they work, and how agents evaluate them"}}]},{kind:"Folder",name:"transactions",route:"/trading-engine/platform-guide/transactions",children:[{kind:"Meta",data:{"transaction-types":"Transaction Types","historical-swaps":"Historical Swaps",exporting:"Exporting Data"}},{kind:"MdxPage",name:"exporting",route:"/trading-engine/platform-guide/transactions/exporting",frontMatter:{title:"Exporting Data",description:"Export transaction and signal data to CSV for analysis and reporting"}},{kind:"MdxPage",name:"historical-swaps",route:"/trading-engine/platform-guide/transactions/historical-swaps",frontMatter:{title:"Historical Swaps",description:"Understanding completed trade pairs and profit/loss tracking"}},{kind:"MdxPage",name:"transaction-types",route:"/trading-engine/platform-guide/transactions/transaction-types",frontMatter:{title:"Transaction Types",description:"Understanding the different types of transactions tracked in Nexgent AI"}}]},{kind:"Folder",name:"wallets",route:"/trading-engine/platform-guide/wallets",children:[{kind:"Meta",data:{creating:"Creating Wallets","deposits-withdrawals":"Deposits & Withdrawals"}},{kind:"MdxPage",name:"creating",route:"/trading-engine/platform-guide/wallets/creating",frontMatter:{title:"Creating Wallets",description:"Understanding wallet setup - simulation wallets are automatic, live wallets require environment variable configuration"}},{kind:"MdxPage",name:"deposits-withdrawals",route:"/trading-engine/platform-guide/wallets/deposits-withdrawals",frontMatter:{title:"Deposits & Withdrawals",description:"Understanding how deposits and withdrawals work differently for simulation and live wallets"}}]}]},{kind:"Folder",name:"reference",route:"/trading-engine/reference",children:[{kind:"Meta",data:{glossary:"Glossary",faq:"FAQ",troubleshooting:"Troubleshooting"}},{kind:"MdxPage",name:"faq",route:"/trading-engine/reference/faq",frontMatter:{title:"FAQ",description:"Frequently asked questions about Nexgent"}},{kind:"MdxPage",name:"glossary",route:"/trading-engine/reference/glossary",frontMatter:{title:"Glossary",description:"Definitions of terms used in Nexgent documentation"}},{kind:"MdxPage",name:"troubleshooting",route:"/trading-engine/reference/troubleshooting",frontMatter:{title:"Troubleshooting",description:"Solutions to common issues with Nexgent"}}]},{kind:"Folder",name:"resources",route:"/trading-engine/resources",children:[{kind:"Meta",data:{"community-support":"Community & Support",license:"License"}},{kind:"MdxPage",name:"community-support",route:"/trading-engine/resources/community-support",frontMatter:{title:"Community & Support",description:"Get help and connect with the Nexgent community"}},{kind:"MdxPage",name:"license",route:"/trading-engine/resources/license",frontMatter:{title:"License",description:"Nexgent open-source license information"}}]},{kind:"Folder",name:"security",route:"/trading-engine/security",children:[{kind:"Meta",data:{overview:"Security Overview","wallet-security":"Wallet Security Best Practices","api-security":"API Security","network-security":"Network Security","vulnerability-reporting":"Vulnerability Reporting"}},{kind:"MdxPage",name:"api-security",route:"/trading-engine/security/api-security",frontMatter:{title:"API Security",description:"API authentication, authorization, and security controls"}},{kind:"MdxPage",name:"network-security",route:"/trading-engine/security/network-security",frontMatter:{title:"Network Security",description:"Infrastru
1cture and network security for self-hosted deployments"}},{kind:"MdxPage",name:"overview",route:"/trading-engine/security/overview",frontMatter:{title:"Security Overview",description:"Security architecture and practices for Nexgent"}},{kind:"MdxPage",name:"vulnerability-reporting",route:"/trading-engine/security/vulnerability-reporting",frontMatter:{title:"Vulnerability Reporting",description:"How to responsibly report security vulnerabilities"}},{kind:"MdxPage",name:"wallet-security",route:"/trading-engine/security/wallet-security",frontMatter:{title:"Wallet Security",description:"Best practices for securing Solana wallets in Nexgent"}}]},{kind:"Folder",name:"self-hosting",route:"/trading-engine/self-hosting",children:[{kind:"Meta",data:{overview:"Overview",railway:"Railway (Recommended)","docker-compose":"Docker Compose","vercel-railway":"Vercel + Railway",vps:"VPS","production-checklist":"Production Checklist",upgrading:"Upgrading"}},{kind:"MdxPage",name:"docker-compose",route:"/trading-engine/self-hosting/docker-compose",frontMatter:{title:"Docker Compose Deployment",description:"Deploy Nexgent with Docker Compose for local development and simple production"}},{kind:"MdxPage",name:"overview",route:"/trading-engine/self-hosting/overview",frontMatter:{title:"Self-Hosting Overview",description:"Deploy your own Nexgent instance"}},{kind:"MdxPage",name:"production-checklist",route:"/trading-engine/self-hosting/production-checklist",frontMatter:{title:"Production Checklist",description:"Security, database, Redis, SSL, and monitoring configuration for production"}},{kind:"MdxPage",name:"railway",route:"/trading-engine/self-hosting/railway",frontMatter:{title:"Railway (Recommended)",description:"The quickest and easiest way to deploy Nexgent"}},{kind:"MdxPage",name:"upgrading",route:"/trading-engine/self-hosting/upgrading",frontMatter:{title:"Upgrading Nexgent",description:"Update your Nexgent installation to the latest version"}},{kind:"MdxPage",name:"vercel-railway",route:"/trading-engine/self-hosting/vercel-railway",frontMatter:{title:"Vercel + Railway Deployment",description:"Deploy Nexgent frontend on Vercel and backend on Railway"}},{kind:"MdxPage",name:"vps",route:"/trading-engine/self-hosting/vps",frontMatter:{title:"VPS Deployment",description:"Deploy Nexgent manually on a VPS or dedicated server"}}]},{kind:"Folder",name:"technical",route:"/trading-engine/technical",children:[{kind:"Meta",data:{architecture:"Architecture",backend:"Backend",frontend:"Frontend",shared:"Shared Package",database:"Database","caching-performance":"Caching & Performance",integrations:"Integrations",configuration:"Configuration"}},{kind:"Folder",name:"architecture",route:"/trading-engine/technical/architecture",children:[{kind:"Meta",data:{overview:"Overview",monorepo:"Monorepo Structure","tech-stack":"Technology Stack","data-flow":"Data Flow"}},{kind:"MdxPage",name:"data-flow",route:"/trading-engine/technical/architecture/data-flow",frontMatter:{title:"Data Flow",description:"How data flows through the Nexgent trading engine"}},{kind:"MdxPage",name:"monorepo",route:"/trading-engine/technical/architecture/monorepo",frontMatter:{title:"Monorepo Structure",description:"Package organization and directory structure of the Nexgent trading engine"}},{kind:"MdxPage",name:"overview",route:"/trading-engine/technical/architecture/overview",frontMatter:{title:"Architecture Overview",description:"High-level technical architecture of the Nexgent trading engine"}},{kind:"MdxPage",name:"tech-stack",route:"/trading-engine/technical/architecture/tech-stack",frontMatter:{title:"Technology Stack",description:"Technologies and frameworks used in the Nexgent trading engine"}}]},{kind:"Folder",name:"backend",route:"/trading-engine/technical/backend",children:[{kind:"Meta",data:{"layered-architecture":"Layered Architecture","domain-services":"Domain Services",infrastructure:"Infrastructure","api-layer-middleware":"API Layer & Middleware","authentication-authorization":"Authentication & Authorization"}},{kind:"MdxPage",name:"api-layer-middleware",route:"/trading-engine/technical/backend/api-layer-middleware",frontMatter:{title:"API Layer & Middleware",description:"REST API routes and Express middleware"}},{kind:"MdxPage",name:"authentication-authorization",route:"/trading-engine/technical/backend/authentication-authorization",frontMatter:{title:"Authentication & Authorization",description:"JWT and API key authentication in Nexgent"}},{kind:"MdxPage",name:"domain-services",route:"/trading-engine/technical/backend/domain-services",frontMatter:{title:"Domain Services",description:"Business logic services in the Nexgent trading engine"}}
1,{kind:"Folder",name:"infrastructure",route:"/trading-engine/technical/backend/infrastructure",children:[{kind:"Meta",data:{database:"Database (Prisma)",caching:"Caching (Redis)","job-queues":"Job Queues (BullMQ)","websocket-server":"WebSocket Server"}},{kind:"MdxPage",name:"caching",route:"/trading-engine/technical/backend/infrastructure/caching",frontMatter:{title:"Caching (Redis)",description:"Redis caching strategy and implementation"}},{kind:"MdxPage",name:"database",route:"/trading-engine/technical/backend/infrastructure/database",frontMatter:{title:"Database (Prisma)",description:"PostgreSQL database integration with Prisma ORM"}},{kind:"MdxPage",name:"job-queues",route:"/trading-engine/technical/backend/infrastructure/job-queues",frontMatter:{title:"Job Queues (BullMQ)",description:"Background job processing with BullMQ"}},{kind:"MdxPage",name:"websocket-server",route:"/trading-engine/technical/backend/infrastructure/websocket-server",frontMatter:{title:"WebSocket Server",description:"Real-time updates via WebSocket"}}]},{kind:"MdxPage",name:"layered-architecture",route:"/trading-engine/technical/backend/layered-architecture",frontMatter:{title:"Layered Architecture",description:"Domain-Driven Design inspired architecture of the Nexgent backend"}}]},{kind:"Folder",name:"caching-performance",route:"/trading-engine/technical/caching-performance",children:[{kind:"Meta",data:{"redis-patterns":"Redis Patterns","performance-optimization":"Performance Optimization"}},{kind:"MdxPage",name:"performance-optimization",route:"/trading-engine/technical/caching-performance/performance-optimization",frontMatter:{title:"Performance Optimization",description:"Ultra-low latency design patterns in Nexgent"}},{kind:"MdxPage",name:"redis-patterns",route:"/trading-engine/technical/caching-performance/redis-patterns",frontMatter:{title:"Redis Patterns",description:"Redis caching patterns and implementation details"}}]},{kind:"Folder",name:"configuration",route:"/trading-engine/technical/configuration",children:[{kind:"Meta",data:{"environment-variables":"Environment Variables","trading-config-defaults":"Trading Config Defaults"}},{kind:"MdxPage",name:"environment-variables",route:"/trading-engine/technical/configuration/environment-variables",frontMatter:{title:"Environment Variables",description:"Complete reference for all environment variables"}},{kind:"MdxPage",name:"trading-config-defaults",route:"/trading-engine/technical/configuration/trading-config-defaults",frontMatter:{title:"Trading Config Defaults",description:"Default trading configuration values for agents"}}]},{kind:"Folder",name:"database",route:"/trading-engine/technical/database",children:[{kind:"Meta",data:{"schema-erd":"Schema & ERD",tables:"Tables Reference",migrations:"Migrations"}},{kind:"MdxPage",name:"migrations",route:"/trading-engine/technical/database/migrations",frontMatter:{title:"Migrations",description:"Database migration workflow with Prisma"}},{kind:"MdxPage",name:"schema-erd",route:"/trading-engine/technical/database/schema-erd",frontMatter:{title:"Schema & ERD",description:"Database schema overview and entity relationship diagram"}},{kind:"MdxPage",name:"tables",route:"/trading-engine/technical/database/tables",frontMatter:{title:"Tables Reference",description:"Complete reference for all database tables"}}]},{kind:"Folder",name:"frontend",route:"/trading-engine/technical/frontend",children:[{kind:"Meta",data:{"app-router-structure":"App Router Structure","feature-organization":"Feature Organization","state-management":"State Management","component-patterns":"Component Patterns"}},{kind:"MdxPage",name:"app-router-structure",route:"/trading-engine/technical/frontend/app-router-structure",frontMatter:{title:"App Router Structure",description:"Next.js 15 App Router configuration and routing"}},{kind:"MdxPage",name:"component-patterns",route:"/trading-engine/technical/frontend/component-patterns",frontMatter:{title:"Component Patterns",description:"UI component patterns and shadcn/ui usage in Nexgent"}},{kind:"MdxPage",name:"feature-organization",route:"/trading-engine/technical/frontend/feature-organization",frontMatter:{title:"Feature Organization",description:"Feature-based code organization in the Nexgent frontend"}},{kind:"MdxPage",name:"state-management",route:"/trading-engine/technical/frontend/state-management",frontMatter:{title:"State Management",description:"React Query, Context, and WebSocket state in the Nexgent frontend"}}]},{kind:"Folder",name:"integrations",route:"/trading-engine/technical/integrations",children:[{kind:"Meta",data:{jupiter:"Jupiter Aggregator",pyth:"Pyth Network",dexscreener:"DexScreener","solana-web3":"Solana Web3.js"}},{kind:"MdxPage",name:"dexscreener",route:"/trading-engine/technical/integrations/dexscreener",frontMatter:{title:"DexScreener",description:"DexScreener integration for token price feeds and liquidity data"}},{kind:"MdxPage",name:"jupiter",route:"/trading-engine/technical/integrations/jupiter",frontMatter:{title:"Jupiter Aggregator",description:"Jupiter DEX aggregator integration for swaps and prices"}},{kind:"MdxPage",name:"pyth",route:"/trading-engine/technical/integrations/pyth",frontMatter:{title:"Pyth Network",description:"Pyth Network integration for SOL/USD price oracle"}},{kind:"MdxPage",name:"solana-web3",route:"/trading-engine/technical/integrations/solana-web3",frontMatter:{title:"Solana Web3.js",description:"Solana Web3.js integration for blockchain interaction"}}]},{kind:"MdxPage",name:"shared",route:"/trading-engine/technical/shared",frontMatter:{title:"Shared Package",description:"Types, validators, and utilities in nexgent-open-source-trading-engine/shared"}}]}]}],flexsearch:{codeblocks:!0}
1,title:"App Router Structure",headings:c},pageNextRoute:"/trading-engine/technical/frontend/app-router-structure",nextraLayout:s.ZP,themeConfig:a.Z};t.default=(0,r.j)(g)},96735:function(e,t,n){"use strict";var i=n(52676);n(75271);var r=n(49290),s=n.n(r);let a={logo:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,i.jsx)(s(),{src:"/icon-logo.png",alt:"Nexgent Logo",width:24,height:24}),(0,i.jsx)("span",{children:"Nexgent Documentation"})]}),project:{link:"https://github.com/nexgent-ai-org/nexgent-open-source-trading-engine",icon:(0,i.jsx)(()=>(0,i.jsx)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:(0,i.jsx)("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),{})},chat:{link:"https://x.com/nexgentai",icon:(0,i.jsx)(()=>(0,i.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,i.jsx)("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),{})},docsRepositoryBase:"https://github.com/nexgent-ai-org/nexgent-open-source-trading-engine/tree/main/documentation",useNextSeoProps:()=>({titleTemplate:"%s â Nexgent Docs"}),head:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("meta",{property:"og:site_name",content:"Nexgent Documentation"}),(0,i.jsx)("meta",{property:"og:type",content:"website"}),(0,i.jsx)("meta",{property:"og:title",content:"Nexgent Documentation"}),(0,i.jsx)("meta",{property:"og:description",content:"Open-source Solana AI agent trading automation framework"}),(0,i.jsx)("meta",{property:"og:url",content:"https://docs.nexgent.ai"}),(0,i.jsx)("meta",{property:"og:image",content:"https://docs.nexgent.ai/images/og-image.png"}),(0,i.jsx)("meta",{property:"og:image:width",content:"1200"}),(0,i.jsx)("meta",{property:"og:image:height",content:"630"}),(0,i.jsx)("meta",{property:"og:image:alt",content:"Nexgent Documentation"}),(0,i.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,i.jsx)("meta",{name:"twitter:site",content:"@nexgentai"}),(0,i.jsx)("meta",{name:"twitter:title",content:"Nexgent Documentation"}),(0,i.jsx)("meta",{name:"twitter:description",content:"Open-source Solana AI agent trading automation framework"}),(0,i.jsx)("meta",{name:"twitter:image",content:"https://docs.nexgent.ai/images/og-image.png"}),(0,i.jsx)("meta",{name:"twitter:image:alt",content:"Nexgent Documentation"})]}),primaryHue:212,sidebar:{defaultMenuCollapseLevel:1,toggleButton:!0},toc:{backToTop:!0},navigation:{prev:!0,next:!0},search:{placeholder:"Search documentation..."},feedback:{content:null},editLink:{component:null},footer:{text:"\xa9 ".concat(new Date().getFullYear()," Nexgent AI. Built with Nextra.")}};t.Z=a},45184:function(){}},function(e){e.O(0,[6225,2888,9774,179],function(){return e(e.s=82378)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.