Skip to content

Conversation

@haroun
Copy link
Contributor

@haroun haroun commented Sep 9, 2025

Summary

Enable multisite on astro

This PR requires 3 additional PRs before merging

What are the specific steps to test this change?

Backend

  1. cd backend
  2. npm install github:apostrophecms/multisite-dashboard
  3. npm install github:apostrophecms/apostrophe
  4. npm run dev
  5. create two websites site1 and site2

Frontend

  1. cd frontend
  2. npm install github:apostrophecms/apostrophe-astro
  3. npm run dev
  4. access dashboard.localhost:4321, site1.localhost:4321 and site2.localhost:4321

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@haroun haroun self-assigned this Sep 9, 2025
@linear
Copy link

linear bot commented Sep 9, 2025

PRO-8178 Create a starter-kit-astro-apollo-assembly so that customers like iCIMS can use it as an example for Astro + multisite

iCIMS wants to do Astro and they are multisite. Time to catch up with our friends at Michelin.

We haven't set up Astro with multisite before, but we know Michelin is doing it with great success.

Tech design

  • The starter-kit-apollo-pro repo is the right starting point to fork this new repo because it has great palette implementation (wait for PRO-8060 to land before forking) and it has the other Pro modules, thoughtfully chosen and configured for compatibility.
  • We don't need to subdivide frontend into dashboard and sites. Astro support for the dashboard itself is not important and to be clear, we should not spend a single minute attempting it right now. We will just proxy the dashboard straight through to ApostropheCMS, leaving only the sites, so the structure of frontend doesn't have to change.
  • Therefore new components don't have to be written, the widget and page templates from apollo-pro are fine.
  • Just like the apostrophe backend, the astro frontend should respond for any hostname, e.g. dashboard.localhost, site1.localhost etc., unless perhaps something is picky about the vite config for local dev. In which case, solve that.
  • Astro is passing on the Host header with everything else via apostrophe-astro, therefore the backend should automatically pass back the content for the right site.
  • So, an Astro proxy rule to proxy the entire dashboard.* site to Apostrophe is the only change that should be needed in principle to get the existing frontend to work with a multisite version of backend.
  • Basic theme support: I do not think we want fancy theme support with a whole directory structure etc. We should just make sure the current site's theme is passed to Astro and therefore Astro components can look at it or ignore it, as they see fit. We can do more later if it seems warranted.

Acceptance Criteria

  • The dashboard should work without any Astro stuff, except that the whole dashboard site should be proxied straight through from Astro to ApostropheCMS (http://dashboard.localhost:4321 must work).
  • Individual sites must successfully serve their individual content, allow editing on the page, etc. like normal.
  • Astro components must be able to determine the value of theme for the site they are rendering. However we don't need two fully tricked out themes right now, just a basic demonstration that a distinction can be recognized by the Astro frontend.

Remember…

  • Michelin is already doing this. There is no big secret, it shouldn't be hard; we could even ask for a peep at their multisite astro project if we get stuck at all.

@@ -0,0 +1,71 @@
{% extends data.outerLayout %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /login page DOES come from apostrophe, so a basic layout that supports it is still appropriate

@haroun haroun requested a review from boutell September 11, 2025 08:58
Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to test this out with an actual apostrophecms hosting setup before approving. I'm not 100% sure that portMapping and aposHost: '*' provide quite enough information in that scenario but they might.

@boutell
Copy link
Member

boutell commented Sep 11, 2025

I will also have to think about how to explain the ramifications for a client like icims who is self-hosted, but first I'll validate that it can work in our own environment so I have something to explain.

@boutell
Copy link
Member

boutell commented Sep 12, 2025

It looks like portMapping isn't needed at all, I've started a separate discussion with Harouna around that.

@haroun haroun requested a review from boutell September 16, 2025 14:48
boutell and others added 17 commits September 22, 2025 14:34
…r-kit-astro-apollo-assembly into feature/deploy-test

* 'feature/deploy-test' of github.com:apostrophecms/starter-kit-astro-apollo-assembly:
  silly oversights
  use main
  ignore release-id
  use the right branch
  remove modules/ subdir with unused code
  call things what the root package.json calls them
  production-start script matching the environment settings in the migrate and build scripts
  APOS_UPLOADFS_ASSETS=1 consistently used
  dashboards have assets too!
  orphan logging
  well that was simple? maybe? 🙏
* main:
  little things
  Response to first comments
  Emojis
  Minor README update
  Minor detail change
  First stab at README update
* pro-8178-add-multisite:
  little things
  Response to first comments
  Emojis
  Minor README update
  Minor detail change
  First stab at README update
@haroun haroun merged commit 1b656f4 into main Nov 5, 2025
1 check passed
@haroun haroun deleted the pro-8178-add-multisite branch November 5, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants