The following are three sites to utilize to understand SharePoint site templates with site scripts.
Such aspects are useful when one wants to create a
customized site template in the Microsoft 365 SharePoint Online environment to
be available when creating new web sites:
SharePoint site template and site script overview:
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview
Get started creating site templates and site scripts:
Apply and customize SharePoint site templates: