Next.js Discord

Discord Forum

How to deploy landing page ("domain.com") and web-app ("app.domain.com") in one project to Vercel

Unanswered
Atlantic mackerel posted this in #help-forum
Open in Discord
Atlantic mackerelOP
Hi all,

I have a web-app deployed to "app.domain.com" but now want to deploy a landing-page for my web-app at "domain.com". Can I deploy the landing-page under the same NextJS project or would I need two separate projects/deployments?

If it is possible to have in one project, what would the NextJS setup look like in terms of routing and how would I setup the domains in Vercel. Thanks!

7 Replies

you need one project per Next.js app/website. so technically no, you can't use a single project for more than one application.
what you can do is create a monorepo that holds both next apps in a single repository whith a tool like Turborepo and then deploy that single repository to Vercel.
when importing the repository on Vercel, it will automatically detect that it's a monorepo and it will create one project for each app inside it
Atlantic mackerelOP
Awesome, thanks milo. I guess one other option if I don't want to use turborepo, is to add a new "website" directory to my web-app repository, create a new Vercel project and run the build deploy scripts off of "website" dir?
This way I can create all the code in one repo but it would deploy to 2 separate Vercel projects.
I'm afraid that won't work. you can connect a repo only to a single project unless it's a monorepo built with either Lerna, Nx or Turborepo. that's the only case in which one repo can be linked to multiple projects
Atlantic mackerelOP
Yeah, I see that but I can create a 2nd Vercel project and point it to the website directory