and here is some code I've used in the past, maybe it can help you get started:
Using dbconnfw As DbConnInfo = BRApi.Database.CreateFrameworkDbConnInfo(si)
Using dbconnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
'Get the solution code 3 digit identifier
Dim solutionCode As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "HelpAboutSolutionCode_AMGH")
'Inzialize the zip object
Dim xfprojObj As New XFProject()
xfprojObj.DefaultZipFileName = $"{datetime.Now:yyyyMMddHHmm}_{solutionCode}"
xfprojObj.TopFolderPath = solutionCode
'OBJECTS LIST
'Business Rules
Dim businessRulesList As List(Of String) = BRApi.Database.ExecuteSql(dbconnapp, $"SELECT DISTINCT Name FROM BusinessRule WHERE Name LIKE '%{solutionCode}%'", False).AsEnumerable().Select(Function(lambda) lambda.item("Name").tostring()).tolist()
For Each brName As String In businessRulesList
Dim xfProjItem As New XFProjectItem(xfprojectitemtype.BusinessRule,"",brName,True)
xfprojObj.ProjectItems.Add(xfProjItem)
Next brName
'Dashboard Maintenance unit
Dim dashboardMaintUnitList As New List(Of String) From {$"OpenPlace Template ({solutionCode})"}
For Each dsMaintUnit As String In dashboardMaintUnitList
Dim xfProjItem As New XFProjectItem(xfprojectitemtype.DashboardMaintenanceUnit,"",dsMaintUnit,True)
xfprojObj.ProjectItems.Add(xfProjItem)
Next dsMaintUnit
'Dashboard Profile
Dim dashboardProfilesList As New List(Of String) From {$"OpenPlace Template ({solutionCode})"}
For Each dsProfile As String In dashboardProfilesList
Dim xfProjItem As New XFProjectItem(xfprojectitemtype.DashboardProfile,"",dsProfile,True)
xfprojObj.ProjectItems.Add(xfProjItem)
Next dsProfile
'Data Management Jobs
Dim dmGroupsList As New List(Of String) From {$"Export Solution ({solutionCode})"}
For Each dmGroup As String In dmGroupsList
Dim xfProjItem As New XFProjectItem(xfprojectitemtype.DataManagementGroup,"",dmGroup,True)
xfprojObj.ProjectItems.Add(xfProjItem)
Next dmGroup
'Process the export
Dim zipByte As Byte() = XfProjectWcf.ExtractXFProjectZipFile(dbconnfw,dbconnApp,xfprojObj)
Dim targetFileInfo As New XFFileInfo(filesystemlocation.ApplicationDatabase,path.Combine("Documents","Users",stringhelper.RemoveSystemCharacters(si.UserName,False,False),xfprojObj.DefaultZipFileName & ".zip"))
Dim targetFile As New XFFile(targetFileInfo,String.Empty,zipByte)
brapi.FileSystem.InsertOrUpdateFile(si, targetFile)
'Extract the xfProject xml file
Dim targetXFProjInfo As New XFFileInfo(filesystemlocation.ApplicationDatabase,path.Combine("Documents","Users",stringhelper.RemoveSystemCharacters(si.UserName,False,False),xfprojObj.DefaultZipFileName & ".xfproj"))
Dim targetXFProjFile As New XFFile(targetXFProjInfo,String.Empty,xfprojObj.WriteXmlStringAsBytes(si))
brapi.FileSystem.InsertOrUpdateFile(si, targetXFProjFile)
End Using
End Using