3
7 Comments

Multiple web apps on one domain

Hi hackers,

I'm planning to create multiple front-end apps on the same top-level domain and want to have one backend (I think).

So my questions:
Are you guys using subdomains for this case? If so how you manage auth across all subdomains? Or maybe you have separated backends on every subdomain or app?

It's a good practice to do like this? or maybe I need to think about having isolated apps with their own backend? What do you think?

  1. 2

    Thank you for asking this question. I also wanted to know about it and now i read the comments and get some idea regarding my site: https://apkwheel.com
    I will research more and will share the results.

    1. 1

      I glad this post help you too. I will wait for your results. Good luck.

  2. 2

    I'm sure there are some drawbacks and not sure if it's well suited for enterprise solutions because I never really gave it much thought. I have few simple websites and don't need to think about those aspects just yet, so do your research based on your use case.
    Nevertheless, I achieve that with Docker. With containers you get your isolation by default no matter how many of them are running. You don't necessarily need subdomains because you can have a reverse proxy (which is also Dockerized).
    So without going into details: everything runs in their own containers - proxy server, all the front ends, all the back ends, all other services. The way to do it is to attach your proxy container to a front-tier (Docker) network. Front ends also to front-tier network. Back-ends to both - front and back tier networks. Databases + other (micro) services to back-tier network. Once you have everything on the right networks then it's just a matter of routing based on the host headers in your proxy. The proxy will also make it easier to manage ssl certs for all the websites as you'll only have one place for it to exist.
    I had 5 different (simple) websites running on one (DigitalOcean) droplet at some point with not issues

    1. 2

      Thank you for your detailed answer! I have used docker only in the local env, and I think I will not manage to do it in the sever, in a small period of time. But in the future, I think it is the right path to go.

      What DigitalOcean droplet price plan do you have? are you using external providers for deployment and etc? or just managing everything on your own in DigitalOcean?

      1. 2

        It's easier than you might think. Most of it is explained in docker reference pages for containers and docker-compose files.
        I am using a shared droplet for $10 per month. Doing everything myself with own simple scripts, but I recently took over a project that was using GitLab and really like it so I might switch to it at some point.

        1. 2

          Okay, will dive deep into it and do my research about it. Thank you for your help!!!

  3. 1

    Found some information about this!

    Having two Laravel backends with one database (with session): https://medium.com/@pagcosma/multi-subdomain-sessions-in-laravel-40fd31b199fa

    Having one Laravel backend: https://blog.pusher.com/laravel-subdomain-routing/

    Firebase Authentication across subdomains:
    https://dev.to/johncarroll/how-to-share-firebase-authentication-across-subdomains-1ka8

Trending on Indie Hackers
Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 19 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments