From ce892994a874096742ec1ce0925da7c8dca09af4 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Tue, 14 Oct 2025 15:42:08 +0530 Subject: [PATCH 1/9] create: vercel.json for api reference docs Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- vercel.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 vercel.json diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000000..1eddc59f2a8 --- /dev/null +++ b/vercel.json @@ -0,0 +1,12 @@ +{ + "rewrites": [ + { + "source": "/api-reference", + "destination": "https://developers.avacloud.io" + }, + { + "source": "/api-reference/:path*", + "destination": "https://developers.avacloud.io/:path*" + } + ] +} From c0c4019582965948e9660781f66c37c95effab03 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Wed, 15 Oct 2025 17:26:38 +0530 Subject: [PATCH 2/9] test with redirects for asset paths Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- vercel.json | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/vercel.json b/vercel.json index 1eddc59f2a8..42f478080df 100644 --- a/vercel.json +++ b/vercel.json @@ -1,12 +1,40 @@ { "rewrites": [ + { + "source": "/_mintlify/api/request", + "destination": "https://test-0a7d1918.mintlify.app/_mintlify/api/request" + }, + { + "source": "/api/request", + "destination": "https://test-0a7d1918.mintlify.app/_mintlify/api/request" + }, { "source": "/api-reference", - "destination": "https://developers.avacloud.io" + "destination": "https://test-0a7d1918.mintlify.app" + }, + { + "source": "/api-reference/llms.txt", + "destination": "https://test-0a7d1918.mintlify.app/llms.txt" + }, + { + "source": "/api-reference/llms-full.txt", + "destination": "https://test-0a7d1918.mintlify.app/llms-full.txt" + }, + { + "source": "/api-reference/sitemap.xml", + "destination": "https://test-0a7d1918.mintlify.app/sitemap.xml" + }, + { + "source": "/api-reference/robots.txt", + "destination": "https://test-0a7d1918.mintlify.app/robots.txt" }, { "source": "/api-reference/:path*", - "destination": "https://developers.avacloud.io/:path*" + "destination": "https://test-0a7d1918.mintlify.app/api-reference/:path*" + }, + { + "source": "/mintlify-assets/:path+", + "destination": "https://test-0a7d1918.mintlify.app/mintlify-assets/:path+" } ] } From ff3c79eb6c5a7c685422a0e997ef59cfac7620ea Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Wed, 15 Oct 2025 18:08:17 +0530 Subject: [PATCH 3/9] Delete vercel.json Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- vercel.json | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 vercel.json diff --git a/vercel.json b/vercel.json deleted file mode 100644 index 42f478080df..00000000000 --- a/vercel.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "rewrites": [ - { - "source": "/_mintlify/api/request", - "destination": "https://test-0a7d1918.mintlify.app/_mintlify/api/request" - }, - { - "source": "/api/request", - "destination": "https://test-0a7d1918.mintlify.app/_mintlify/api/request" - }, - { - "source": "/api-reference", - "destination": "https://test-0a7d1918.mintlify.app" - }, - { - "source": "/api-reference/llms.txt", - "destination": "https://test-0a7d1918.mintlify.app/llms.txt" - }, - { - "source": "/api-reference/llms-full.txt", - "destination": "https://test-0a7d1918.mintlify.app/llms-full.txt" - }, - { - "source": "/api-reference/sitemap.xml", - "destination": "https://test-0a7d1918.mintlify.app/sitemap.xml" - }, - { - "source": "/api-reference/robots.txt", - "destination": "https://test-0a7d1918.mintlify.app/robots.txt" - }, - { - "source": "/api-reference/:path*", - "destination": "https://test-0a7d1918.mintlify.app/api-reference/:path*" - }, - { - "source": "/mintlify-assets/:path+", - "destination": "https://test-0a7d1918.mintlify.app/mintlify-assets/:path+" - } - ] -} From e48073fcb12535925eb2be5ad111740580b97cff Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Wed, 15 Oct 2025 18:09:24 +0530 Subject: [PATCH 4/9] update middleware for handling api docs Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- middleware.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/middleware.ts b/middleware.ts index b3e6c578b66..f4be9b868ea 100644 --- a/middleware.ts +++ b/middleware.ts @@ -4,6 +4,15 @@ import { NextMiddlewareResult } from "next/dist/server/web/types"; import { NextRequest, NextResponse } from "next/server"; export async function middleware(req: NextRequest) { + const pathname = req.nextUrl.pathname; + + if (pathname.startsWith('/api-reference')) { + const response = NextResponse.next(); + response.headers.set('X-Forwarded-Host', req.headers.get('host') || ''); + response.headers.set('X-Forwarded-Proto', 'https'); + return response; + } + const response = NextResponse.next(); response.headers.set("Access-Control-Allow-Origin", "*"); response.headers.set( @@ -18,17 +27,14 @@ export async function middleware(req: NextRequest) { if (req.method === "OPTIONS") { return new Response(null, { status: 204 }); } + const token = await getToken({ req, secret: process.env.NEXTAUTH_SECRET }); - const pathname = req.nextUrl.pathname; const isAuthenticated = !!token; const isLoginPage = pathname === "/login"; const isShowCase = pathname.startsWith("/showcase"); const custom_attributes = token?.custom_attributes as string[] ?? [] - // If not authenticated and trying to access protected routes, - // preserve the complete URL (including UTM) as callbackUrl if (!isAuthenticated && !isLoginPage) { - // Check if it's a protected path const protectedPaths = [ "/hackathons/registration-form", "/hackathons/project-submission", @@ -47,16 +53,13 @@ export async function middleware(req: NextRequest) { } if (isAuthenticated) { - if (isLoginPage) return NextResponse.redirect(new URL("/", req.url)); - //TODO Change this line to enable showcase to a different set of users if (isShowCase && !custom_attributes.includes('showcase')) return NextResponse.redirect(new URL("/hackathons", req.url)) - - } + return withAuth( (authReq: NextRequestWithAuth): NextMiddlewareResult => { return NextResponse.next(); @@ -67,7 +70,6 @@ export async function middleware(req: NextRequest) { }, callbacks: { authorized: ({ token }) => !!token, - } } )(req as NextRequestWithAuth, {} as any); @@ -75,6 +77,7 @@ export async function middleware(req: NextRequest) { export const config = { matcher: [ + "/api-reference/:path*", "/hackathons/registration-form/:path*", "/hackathons/project-submission/:path*", "/showcase/:path*", From 7c6dd5e6787c6f0de0320e717cea398222bcfefa Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Wed, 15 Oct 2025 18:12:32 +0530 Subject: [PATCH 5/9] update next config to add redirects for api reference Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- next.config.mjs | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/next.config.mjs b/next.config.mjs index 6eaaa1733a8..4a8888f0b35 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -40,10 +40,30 @@ const config = { protocol: 'https', hostname: 'cdn.prod.website-files.com', }, + { + protocol: 'https', + hostname: 'developers.avacloud.io', + }, ], }, async rewrites() { return [ + { + source: '/mintlify-assets/:path*', + destination: 'https://developers.avacloud.io/mintlify-assets/:path*', + }, + { + source: '/_mintlify/:path*', + destination: 'https://developers.avacloud.io/_mintlify/:path*', + }, + { + source: '/api-reference', + destination: 'https://developers.avacloud.io', + }, + { + source: '/api-reference/:path*', + destination: 'https://developers.avacloud.io/:path*', + }, { source: '/docs/:path*.mdx', destination: '/llms.mdx/docs/:path*', @@ -64,6 +84,41 @@ const config = { }, async redirects() { return [ + { + source: '/introduction', + destination: '/api-reference/introduction', + permanent: false, + }, + { + source: '/data-api/:path*', + destination: '/api-reference/data-api/:path*', + permanent: false, + }, + { + source: '/webhooks-api/:path*', + destination: '/api-reference/webhooks-api/:path*', + permanent: false, + }, + { + source: '/metrics-api/:path*', + destination: '/api-reference/metrics-api/:path*', + permanent: false, + }, + { + source: '/rpc-api/:path*', + destination: '/api-reference/rpc-api/:path*', + permanent: false, + }, + { + source: '/avalanche-sdk/:path*', + destination: '/api-reference/avalanche-sdk/:path*', + permanent: false, + }, + { + source: '/changelog/:path*', + destination: '/api-reference/changelog/:path*', + permanent: false, + }, { source: '/codebase-entrepreneur', destination: '/codebase-entrepreneur-academy', From b26a821dcbc6db7e6035cdfac9e87c8eee70a2c1 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 22 Oct 2025 15:10:43 -0400 Subject: [PATCH 6/9] consistent navbar across docs/academy/homepage --- app/academy/layout.tsx | 24 ++++++----------------- app/docs/layout.tsx | 31 ++++++++++-------------------- app/docs/styles.css | 43 ++++++++++++++++++++++++++++++++++++++++++ app/global.css | 43 ++++++++++++++++++++++++++++++++++++++++++ app/layout.config.tsx | 2 +- 5 files changed, 103 insertions(+), 40 deletions(-) create mode 100644 app/docs/styles.css diff --git a/app/academy/layout.tsx b/app/academy/layout.tsx index d31dd495164..52580ea1e63 100644 --- a/app/academy/layout.tsx +++ b/app/academy/layout.tsx @@ -1,32 +1,19 @@ import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/notebook'; +import { HomeLayout } from 'fumadocs-ui/layouts/home'; import type { ReactNode } from 'react'; -import { baseOptions, docsMenu, consoleMenu, integrationsMenu, userMenu } from '@/app/layout.config'; +import { baseOptions } from '@/app/layout.config'; import { academy } from '@/lib/source'; -import { AvalancheLogo } from '@/components/navigation/avalanche-logo'; const academyOptions: DocsLayoutProps = { - ...baseOptions, + tree: academy.pageTree, nav: { - mode: "top" as const, - title: ( - <> - {} - Academy - - ), - url: '/academy', + enabled: false, }, - tree: academy.pageTree, - links: [ - consoleMenu, - docsMenu, - integrationsMenu, - userMenu - ], }; export default function Layout({ children }: { children: ReactNode }) { return ( + {children} + ); } \ No newline at end of file diff --git a/app/docs/layout.tsx b/app/docs/layout.tsx index 5a1d2c34cd4..24252a342db 100644 --- a/app/docs/layout.tsx +++ b/app/docs/layout.tsx @@ -1,34 +1,22 @@ import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/notebook'; +import { HomeLayout } from 'fumadocs-ui/layouts/home'; import type { ReactNode } from 'react'; -import { baseOptions, academyMenu, consoleMenu, integrationsMenu } from '@/app/layout.config'; +import { baseOptions } from '@/app/layout.config'; import { documentation } from '@/lib/source'; import 'fumadocs-twoslash/twoslash.css'; -import { AvalancheLogo } from '@/components/navigation/avalanche-logo'; +import './styles.css'; const docsOptions: DocsLayoutProps = { -tree: documentation.pageTree, -tabMode: 'navbar', -nav: { - ...baseOptions.nav, - mode: 'top', - title: ( - <> - {} - Documentation - - ), - url: '/docs', + tree: documentation.pageTree, + nav: { + enabled: false, }, - links: [ - academyMenu, - consoleMenu, - integrationsMenu - ] }; export default function Layout({ children }: { children: ReactNode }) { return ( - + + {children} - + + ); } \ No newline at end of file diff --git a/app/docs/styles.css b/app/docs/styles.css new file mode 100644 index 00000000000..ae9c36a367b --- /dev/null +++ b/app/docs/styles.css @@ -0,0 +1,43 @@ +/* Force ONLY main navbar to extend to left edge - DOCS PAGE ONLY */ +body { + padding-left: 0 !important; + margin-left: 0 !important; +} + +/* Target only the main navbar, NOT the tabs nav */ +body > div > nav[aria-label="Main"], +.nd-layout-home > nav:not([role="tablist"]):not(.nd-tabs-nav), +.nd-layout-home > header:not([role="tablist"]):not(.nd-tabs-nav) { + padding-left: 0 !important; + margin-left: 0 !important; + width: 100vw !important; + max-width: 100vw !important; +} + +/* Container gets the padding instead - only for main nav */ +nav[aria-label="Main"] > div, +.nd-layout-home > nav:not([role="tablist"]):not(.nd-tabs-nav) > div, +.nd-layout-home > header:not([role="tablist"]):not(.nd-tabs-nav) > div { + padding-left: 1rem !important; + padding-right: 1rem !important; +} + +/* Preserve normal styling for tabs nav */ +.nd-tabs-nav, +nav[role="tablist"], +[role="tablist"] { + width: auto !important; + max-width: none !important; + padding-left: 0 !important; +} + +/* Add padding at top of docs content area */ +.nd-layout-notebook { + padding-top: 2rem !important; +} + +/* Add padding to the main content container */ +main .nd-layout-notebook > div:first-child { + padding-top: 1rem !important; +} + diff --git a/app/global.css b/app/global.css index 2fb68988d18..021bb122b58 100644 --- a/app/global.css +++ b/app/global.css @@ -26,6 +26,49 @@ div.group\/accordion h3 { margin-top: 0 !important; } +/* Remove ALL left whitespace from navbar to fill screen edge */ +body > div > nav, +body > div > header, +nav[aria-label="Main"], +header nav, +.nd-nav, +.nd-layout-home > nav, +.nd-layout-home > header { + padding-left: 0 !important; + margin-left: 0 !important; + padding-right: 0 !important; + margin-right: 0 !important; + max-width: 100% !important; +} + +/* Remove container padding/margin */ +nav > div, +header > div, +nav[aria-label="Main"] > div, +.nd-nav > div { + padding-left: 1rem !important; + padding-right: 1rem !important; + margin-left: 0 !important; + margin-right: 0 !important; + max-width: 100% !important; +} + +/* Force the navbar to be full width */ +body > div:first-child, +body > div > main { + padding-left: 0 !important; + padding-right: 0 !important; +} + +/* Specifically target fumadocs nav container */ +.nd-layout-home, +.nd-layout-docs { + padding-left: 0 !important; + padding-right: 0 !important; + margin-left: 0 !important; + margin-right: 0 !important; +} + /* .light .prose :where(a:not([data-card])):not(:where([class~="not-prose"],[class~="not-prose"] *)) { color: #18181B; } diff --git a/app/layout.config.tsx b/app/layout.config.tsx index 465d2eacf8a..4ea900407ca 100644 --- a/app/layout.config.tsx +++ b/app/layout.config.tsx @@ -137,7 +137,7 @@ export const stats: LinkItemType = { export const docsMenu: LinkItemType = { type: 'menu', - text: 'Docs', + text: 'Documentation', url: '/docs/quick-start', items: [ { From 57453f484d848ab09f961daf68f4e7819e26eab9 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 22 Oct 2025 15:11:33 -0400 Subject: [PATCH 7/9] fix mintlify redirect --- middleware.ts | 4 ++-- next.config.mjs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/middleware.ts b/middleware.ts index f4be9b868ea..4d99ce1d091 100644 --- a/middleware.ts +++ b/middleware.ts @@ -6,7 +6,7 @@ import { NextRequest, NextResponse } from "next/server"; export async function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; - if (pathname.startsWith('/api-reference')) { + if (pathname.startsWith('/docs/api-reference')) { const response = NextResponse.next(); response.headers.set('X-Forwarded-Host', req.headers.get('host') || ''); response.headers.set('X-Forwarded-Proto', 'https'); @@ -77,7 +77,7 @@ export async function middleware(req: NextRequest) { export const config = { matcher: [ - "/api-reference/:path*", + "/docs/api-reference/:path*", "/hackathons/registration-form/:path*", "/hackathons/project-submission/:path*", "/showcase/:path*", diff --git a/next.config.mjs b/next.config.mjs index 4a8888f0b35..371d2f79ec6 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -57,11 +57,11 @@ const config = { destination: 'https://developers.avacloud.io/_mintlify/:path*', }, { - source: '/api-reference', + source: '/docs/api-reference', destination: 'https://developers.avacloud.io', }, { - source: '/api-reference/:path*', + source: '/docs/api-reference/:path*', destination: 'https://developers.avacloud.io/:path*', }, { @@ -86,37 +86,37 @@ const config = { return [ { source: '/introduction', - destination: '/api-reference/introduction', + destination: '/docs/api-reference/introduction', permanent: false, }, { source: '/data-api/:path*', - destination: '/api-reference/data-api/:path*', + destination: '/docs/api-reference/data-api/:path*', permanent: false, }, { source: '/webhooks-api/:path*', - destination: '/api-reference/webhooks-api/:path*', + destination: '/docs/api-reference/webhooks-api/:path*', permanent: false, }, { source: '/metrics-api/:path*', - destination: '/api-reference/metrics-api/:path*', + destination: '/docs/api-reference/metrics-api/:path*', permanent: false, }, { source: '/rpc-api/:path*', - destination: '/api-reference/rpc-api/:path*', + destination: '/docs/api-reference/rpc-api/:path*', permanent: false, }, { source: '/avalanche-sdk/:path*', - destination: '/api-reference/avalanche-sdk/:path*', + destination: '/docs/api-reference/avalanche-sdk/:path*', permanent: false, }, { source: '/changelog/:path*', - destination: '/api-reference/changelog/:path*', + destination: '/docs/api-reference/changelog/:path*', permanent: false, }, { From 830a53a0d9d6b25a48db1fa546270f4ea0a7fe51 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 22 Oct 2025 19:03:35 -0400 Subject: [PATCH 8/9] fix padding / fix line under navbar --- app/academy/layout.tsx | 1 + app/academy/styles.css | 29 +++++++++++++++++++++++++++++ app/docs/styles.css | 16 ++++++++++++++++ app/global.css | 2 +- 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 app/academy/styles.css diff --git a/app/academy/layout.tsx b/app/academy/layout.tsx index 52580ea1e63..d86f9be66ad 100644 --- a/app/academy/layout.tsx +++ b/app/academy/layout.tsx @@ -3,6 +3,7 @@ import { HomeLayout } from 'fumadocs-ui/layouts/home'; import type { ReactNode } from 'react'; import { baseOptions } from '@/app/layout.config'; import { academy } from '@/lib/source'; +import './styles.css'; const academyOptions: DocsLayoutProps = { tree: academy.pageTree, diff --git a/app/academy/styles.css b/app/academy/styles.css new file mode 100644 index 00000000000..bc66d8d5414 --- /dev/null +++ b/app/academy/styles.css @@ -0,0 +1,29 @@ +/* Increase spacing between the main navbar and the academy sidebar dropdown */ +@media (min-width: 768px) { + #nd-sidebar > div:first-child { + padding-top: calc(var(--spacing) * 7.5); + } +} + +/* Remove thin separator line from library defaults under navbar */ +body > div > nav[aria-label="Main"], +.nd-layout-home > nav:not([role="tablist"]):not(.nd-tabs-nav), +.nd-layout-home > header:not([role="tablist"]):not(.nd-tabs-nav) { + border-bottom: 0 !important; + box-shadow: none !important; +} + +/* Remove any top border drawn directly under the navbar */ +nav[aria-label="Main"] + *, +header + * { + border-top: 0 !important; + box-shadow: none !important; +} + +/* Fumadocs DocsNavbar adds border-b on internal containers; remove it */ +#nd-subnav .border-b { + border-bottom: 0 !important; + box-shadow: none !important; +} + + diff --git a/app/docs/styles.css b/app/docs/styles.css index ae9c36a367b..c41a6dce7cd 100644 --- a/app/docs/styles.css +++ b/app/docs/styles.css @@ -12,6 +12,9 @@ body > div > nav[aria-label="Main"], margin-left: 0 !important; width: 100vw !important; max-width: 100vw !important; + /* Remove thin separator line from library defaults */ + border-bottom: 0 !important; + box-shadow: none !important; } /* Container gets the padding instead - only for main nav */ @@ -41,3 +44,16 @@ main .nd-layout-notebook > div:first-child { padding-top: 1rem !important; } +/* Remove any top border drawn directly under the navbar */ +nav[aria-label="Main"] + *, +header + * { + border-top: 0 !important; + box-shadow: none !important; +} + +/* Fumadocs DocsNavbar adds border-b on internal containers; remove it */ +#nd-subnav .border-b { + border-bottom: 0 !important; + box-shadow: none !important; +} + diff --git a/app/global.css b/app/global.css index 021bb122b58..2b599803926 100644 --- a/app/global.css +++ b/app/global.css @@ -10,7 +10,7 @@ @media (min-width: 768px) { #nd-sidebar > div:first-child { - padding-top: calc(var(--spacing) * 3.5); + padding-top: calc(var(--spacing) * 7.5); } } /* @plugin "@tailwindcss/typography"; */ From 3c16601b337c3ebf67610e2fb1798bb807d13328 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 22 Oct 2025 19:43:45 -0400 Subject: [PATCH 9/9] fix avacloud doc redirect on vercel preview --- middleware.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/middleware.ts b/middleware.ts index 4d99ce1d091..341fe12307a 100644 --- a/middleware.ts +++ b/middleware.ts @@ -6,11 +6,11 @@ import { NextRequest, NextResponse } from "next/server"; export async function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; - if (pathname.startsWith('/docs/api-reference')) { - const response = NextResponse.next(); - response.headers.set('X-Forwarded-Host', req.headers.get('host') || ''); - response.headers.set('X-Forwarded-Proto', 'https'); - return response; + // Proxy Mintlify-powered API Reference through our domain in production + if (pathname === '/docs/api-reference' || pathname.startsWith('/docs/api-reference/')) { + const suffix = pathname === '/docs/api-reference' ? '' : pathname.replace('/docs/api-reference', ''); + const target = new URL(`https://developers.avacloud.io${suffix}${req.nextUrl.search}`); + return NextResponse.rewrite(target); } const response = NextResponse.next(); @@ -77,6 +77,7 @@ export async function middleware(req: NextRequest) { export const config = { matcher: [ + "/docs/api-reference", "/docs/api-reference/:path*", "/hackathons/registration-form/:path*", "/hackathons/project-submission/:path*",