The module is split into two layers: a Drupal CMS backend and a Next.js frontend. They communicate through two custom endpoints.
What lives in Drupal:
- A space_calendar paragraph type with an optional heading field (field_sc_label)
- A settings form at /admin/config/services/space-calendar where you control three values: the NASA DONKI API base URL, your API key, and a cache duration in seconds
- A public endpoint at /api/space-calendar/config that returns those three values as JSON so the frontend can read them at runtime
- A public endpoint at /api/resolve-path?path=/calendar that resolves any Drupal URL alias to the matching node type and UUID, powering the CMS-driven routing
What lives in Next.js:
- A catch-all route [...slug] that intercepts any URL, asks Drupal what node lives there, fetches its paragraph components, and renders them.
- An internal API route at /api/space-events that reads the NASA credentials from Drupal, builds the request to NASA DONKI, and returns the events to the browser
- A SpaceCalendar React client component with a calendar grid, event type tabs (FLR, CME, GST, SEP), and an events panel on the right
How a request flows:
- You visit
/calendarin the browser - Next.js asks Drupal
/api/resolve-path?path=/calendarand gets back{ type: "calendar_event", uuid: "..." } - Next.js fetches the node via JSON:API, finds the
space_calendarparagraph infield_components, and renders theSpaceCalendarcomponent - The component calls
/api/space-events?type=FLR&startDate=...&endDate=... - That Next.js route asks Drupal
/api/space-calendar/configfor the API key, then callshttps://api.nasa.gov/DONKI/FLRwith your key and the date range - NASA returns the event data, which flows back to the component and populates the calendar