DEV Community

Cover image for Do you use subdomains?

Do you use subdomains?

madza profile image Madza ・1 min read

Subdomains are the part of a domain that comes before the main domain name and domain extension. They are created to organize and navigate to different sections of the website.

Do you use subdomains for your personal domain like

If so, could you elaborate on your reasons why do you prefer them over subdirectories like or buying a dedicated domain like

Discussion (16)

daviddalbusco profile image
David Dal Busco • Edited

For docs in a first place, always

Just think it's easy and quite common.

A couple of months ago I also split our ecosystem with a dedicated website and an app (prefixed app........) instead of a "monolyth".

Doing so I can have a slick and easy prerendered website and a PWA without SSR or pre-rendered complexity.

skirbunk profile image

I would say that,, and are all good ones.

daviddalbusco profile image
David Dal Busco

Yes indeed, specially the πŸ‘

Make me think, can also be a good one.

ezzabuzaid profile image

the docs subdomain is for API docs?

daviddalbusco profile image
David Dal Busco

I mostly do frontend work so a general docs or dedicated to the components but, yes I would say documenting the API would be a good fit, I guess. What do you think?

For example that's the docs of one of my side project.

Thread Thread
ezzabuzaid profile image

I'm in process of writing documentation for a frontend project and it is hosted on a virtual directory now, but will change it soon to a subdomain. thanks for your tip.

For backend projects, I don't think using docs as a subdomain for API IMO is a good idea because of versioning, you'll end up having different levels of subdomains like

Of course, it depends on how the project is structured.

Usually, I use subdomains for self-hosted projects and to create dedicated environments like

Thread Thread
daviddalbusco profile image
David Dal Busco

For api versioning you make a good point, I am agree with you.

It probably depends how it should be handled. It it has to appear in the URL, with sub-subdomain that ain't readable, fully agree, but, if the version is for example a state of the docs (like for example on date-fns) then I guess "docs" can still be use. Depends of the documentation UX I guess then.

dev.example / testing.example I do that too.

Thanks for your feedback!

peter279k profile image

Yes. I use the subdomains to let some services be Docker container and map them to specific subdomains.

nefomemes profile image
Nefomemes • Edited

I don't have a personal domain but...

Subdomain approach is good for differentiating between projects. So for example if I created a library then it would be on, then if I created a fullstack application website, it would just be on

One thing to note tho is keep your main domain short, otherwise it's not gonna be good. For example if the name of the app is BLThunderstorm and my domain is, it's gonna be, kinda sucks tbh and would kinda make it less memorable. It's better to have the domain short like, so it would just be, or if you really want to

andreidascalu profile image
Andrei Dascalu

There is one reason I prefer sub domains: you don’t need special configuration for routing.
You serve from root path and the subdomain is the job of the front-end webserver. Internal routing starts from /, no messing with prefixes.

madza profile image
Madza Author

Thanks for the insight πŸ‘πŸ˜‰

skirbunk profile image
Skirbunk • Edited

I'm very glad you asked this question because it really makes me think.

Traditionally, I use free services, so that's a subdomain, but as of recently I've been plugging into my 3 domains because HTTPS is free. All I did to get HTTPS was set my domain DNS to Cloudflare, added one A record to for the service IP in DNS, and added one CNAME record to www for @ in DNS.

What I've learned about using a subdomain is that it's always the child of the TLD, so if your visitors can block the first level domain because it's a service and just look at the subdomain as the focal point, then ya maybe. If you're wanting your visitors to focus only on that website, then you want a domain not a subdomain.

These are the questions I drew from your question.

  1. How do I want most of my visitors to get to the site?
  2. Is the website an addition to one that is already known?
  3. Do I expect visitors to remember more than one name?

These questions should help to make that decision.

jbrodriguez profile image
Juan Rodriguez

you can point subdomains to completely different infrastructure, I have subdomains running on netlify, vercel and a paid hosting service

moopet profile image
Ben Sinclair

Yes, yes I do.

An example is which, to be fair, I don't really make the most of.

Other times I split by purpose, like I've had different blogs on or which have been hosted on different services. I could host a proxy for them on the main domain, but that just seems like doubling my bandwidth for no good reason.

onerinas profile image

I think the subdomain approach is the best for new side projects. If you see traction, we can then buy a new domain 😎

raguay profile image
Richard Guay

yes, they are very useful for splitting up servers or type of stack being used.

Forem Open with the Forem app