WeSearch

Why my single Next.js app runs 4 different domains (and how the proxy.ts decides who sees what)

·10 min read · 0 reactions · 0 comments · 6 views
#nextjs#architecture#saas#buildinpublic
Why my single Next.js app runs 4 different domains (and how the proxy.ts decides who sees what)
⚡ TL;DR · AI summary

The article discusses how a single Next.js application can effectively manage four different domains. It highlights the use of a proxy.ts file to route requests based on the host, allowing for distinct functionalities across each domain. The author shares insights on the challenges faced and the advantages of this multi-domain approach for a SaaS product.

Key facts
Original article
DEV.to (Top)
Read full at DEV.to (Top) →
Opening excerpt (first ~120 words) tap to expand

try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3936949) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Youssefroop Posted on May 30 Why my single Next.js app runs 4 different domains (and how the proxy.ts decides who sees what) #nextjs #architecture #saas #buildinpublic > TL;DR — I run four different domains off one Next.js codebase: a marketing site at pagestrike.com, an authenticated app at app.pagestrike.com, a public publishing domain at pagestrike.app, and customer-owned domains.

Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from DEV.to (Top)