Subdomain Architecture
How GoLink uses Next.js middleware and reverse proxy for unified multi-tenant routing.
Subdomain Architecture & Edge Routing
GoLink runs on a unified Next.js codebase that powers multiple subdomains from a single deployment. By pairing Next.js App Router folders with custom reverse proxy middleware, every request is dynamically resolved to its dedicated sub-application.
The Hostname Routing Table
When a request arrives at GoLink, the proxy middleware inspects the incoming Host header and URL path:
| Subdomain | Environment Map | Route Handled | Handler |
|---|---|---|---|
| golink.buzz | localhost:3000 | Landing Page & /docs | app/(root) & app/docs |
| app.golink.buzz | app.localhost:3000 | Dashboard & Console | app/app.golink.buzz |
| auth.golink.buzz | auth.localhost:3000 | Sign In, Register, Auth | app/auth.golink.buzz |
| admin.golink.buzz | admin.localhost:3000 | Platform Admin Console | app/admin.golink.buzz |
| go.golink.buzz | go.localhost:3000 | Short Link Redirection | app/go.golink.buzz |
| *.custom-domain.com | Any custom CNAME | Branded Short Links | app/go.golink.buzz |
Directory Tree
Here is how the project routes are organized in the Next.js App Router:
How proxy.ts Works
The edge middleware parses the incoming request domain and selectively redirects or rewrites the request internally:
proxy.ts
Because short link redirection uses Next.js NextResponse.rewrite(), the client's address bar retains the custom branded domain (e.g., go.yourcompany.com/launch) while internally rendering the optimized redirector route.
Last updated on October 20, 2026