Creating the Modern SharePoint site template using site script is only supported on SharePoint Online. SharePoint design and scripts can be used to create custom configured modern SharePoint sites with unique custom configurations.
The basic requirement is to connect the PowerShell with SharePoint. Run the below command in PowerShell to connect to SharePoint online before running the scripts.
A popup will show to enter the credentials of the user. After successfully entering the credentials the PowerShell will be connected to the SharePoint online.
The next step is to enter the script in notepad mentioning the Theme name, List name and description.
Now save the file with a random name in “.JSON” format to any document library of your PC.
Again go back to PowerShell and run the .JSON script by adding a title to get an id of the executed process.
Next is to execute another command in PowerShell by adding a design name and previous id created to add it to SharePoint online.
Finally, go to SharePoint and create a new Team site and click on “choose a design” now the newly customised design can be seen as shown below.
Thus the SharePoint custom site design has been created from site script.