Tutorials
Setup your enviroment
Configure your app
subdomain locally
A TurboStack production application is separated in a domain that hosts the landing page for marketing purposes and an app
subdomain that hosts the application itself.
It’s a common practice in the industry to use an app
subdomain to separate your application from your landing page.
This practice has been adopted for these reasons:
- Organization: A subdomain allows for better organization of content. The main domain can focus on marketing and support, while the
app
subdomain is dedicated to the application itself. This separation make the navigation and user experience smoother. - Security: Using an
app
subdomain can help implement specific security measure tailored to the application. For example, common cases do not have to handle any public page different than/sign-in
. - Tracking Segmentation: An
app
subdomain simplify tracking. You can segment traffic and user behavior more easily between the application and the marketing site, helping you find specific insights.
With all reasons explained, we need to setup our /etc/hosts
file to point the subdomain app.localhost
to the address 127.0.0.1
.
- In your terminal, open the
/etc/hosts
file in your favorite editor
- Add the following line at the end of the file:
- In your terminal, open the
/etc/hosts
file in your favorite editor
- Add the following line at the end of the file:
- Open Notepad as Administrator:
Click the Start menu, type Notepad, right-click on it, and select Run as administrator. This step is crucial as the hosts file requires admin privileges to edit. - Open the
/etc/hosts
file:
In Notepad, click on File > Open. Selecthosts
file at the following path:
- Add the following line at the end of the file:
- Click File > Save to save your changes. You can then close Notepad.
- (optional) Sometimes, you may need to flush the DNS cache for changes to take effect. To do this, run the following command in your terminal:
With all things done, you can open http://app.localhost:3000
and you will see a page like this: