Repository: teleporthq/teleport-code-generators
Pull request #256 (2019-06-06 19:24:55)

Refactor/project packer interfaces

codecov[bot]: # [Codecov](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256?src=pr&el=h1) Report
> Merging [#256](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256?src=pr&el=desc) into [master](https://codecov.io/gh/teleporthq/teleport-code-generators/commit/bc1b0d0e88a47c25b4b05ad94504b8fb60328c41?src=pr&el=desc) will **decrease** coverage by `0.29%`.
> The diff coverage is `61.97%`.

[![Impacted file tree graph](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/graphs/tree.svg?width=650&token=LI2WPEFm1R&height=150&src=pr)](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##           master     #256     +/-   ##
=========================================
- Coverage   70.17%   69.87%   -0.3%     
=========================================
  Files          86       86             
  Lines        3111     3100     -11     
  Branches      611      603      -8     
=========================================
- Hits         2183     2166     -17     
+ Misses        914      912      -2     
- Partials       14       22      +8
```


| [Impacted Files](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [packages/teleport-project-packer/src/constants.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtcHJvamVjdC1wYWNrZXIvc3JjL2NvbnN0YW50cy50cw==) | `100% <ø> (ø)` | :arrow_up: |
| [packages/teleport-project-packer/src/errors.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtcHJvamVjdC1wYWNrZXIvc3JjL2Vycm9ycy50cw==) | `100% <ø> (ø)` | :arrow_up: |
| [packages/teleport-project-packer/src/utils.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtcHJvamVjdC1wYWNrZXIvc3JjL3V0aWxzLnRz) | `71.42% <0%> (+1.98%)` | :arrow_up: |
| [packages/teleport-github-gateway/src/index.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtZ2l0aHViLWdhdGV3YXkvc3JjL2luZGV4LnRz) | `44.44% <100%> (ø)` | :arrow_up: |
| [...ges/teleport-github-gateway/src/github-instance.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtZ2l0aHViLWdhdGV3YXkvc3JjL2dpdGh1Yi1pbnN0YW5jZS50cw==) | `32.46% <100%> (ø)` | :arrow_up: |
| [packages/teleport-publisher-github/src/index.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtcHVibGlzaGVyLWdpdGh1Yi9zcmMvaW5kZXgudHM=) | `82.69% <100%> (+3.06%)` | :arrow_up: |
| [...ackages/teleport-shared/src/utils/project-utils.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtc2hhcmVkL3NyYy91dGlscy9wcm9qZWN0LXV0aWxzLnRz) | `53.8% <20%> (+1.22%)` | :arrow_up: |
| [...es/teleport-project-packer-playground/src/index.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtcHJvamVjdC1wYWNrZXItcGxheWdyb3VuZC9zcmMvaW5kZXgudHM=) | `83.01% <45.45%> (-8.65%)` | :arrow_down: |
| [packages/teleport-github-gateway/src/utils.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtZ2l0aHViLWdhdGV3YXkvc3JjL3V0aWxzLnRz) | `14.75% <50%> (ø)` | :arrow_up: |
| [packages/teleport-project-packer/src/index.ts](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree#diff-cGFja2FnZXMvdGVsZXBvcnQtcHJvamVjdC1wYWNrZXIvc3JjL2luZGV4LnRz) | `83.78% <58.33%> (-2.89%)` | :arrow_down: |
| ... and [5 more](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256?src=pr&el=footer). Last update [bc1b0d0...70ac7e2](https://codecov.io/gh/teleporthq/teleport-code-generators/pull/256?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/packages/teleport-github-gateway/src/github-instance.ts b/packages/teleport-github-gateway/src/github-instance.ts
index 9f2a143d..43e83c76 100644
--- a/packages/teleport-github-gateway/src/github-instance.ts
+++ b/packages/teleport-github-gateway/src/github-instance.ts
@@ -1,6 +1,6 @@
 import Github from 'github-api'
 
-import { GithubAuthMeta } from '@teleporthq/teleport-types'
+import { ServiceAuth } from '@teleporthq/teleport-types'
 
 import {
   DEFAULT_REF,
@@ -23,13 +23,13 @@ import { createBase64GithubFileBlob } from './utils'
 
 export default class GithubInstance {
   private githubApi = null
-  private auth: GithubAuthMeta = null
+  private auth: ServiceAuth = null
 
-  constructor(auth: GithubAuthMeta = {}) {
+  constructor(auth: ServiceAuth = {}) {
     this.authorize(auth)
   }
 
-  public authorize(auth: GithubAuthMeta = {}) {
+  public authorize(auth: ServiceAuth = {}) {
     this.auth = auth
 
     if (auth.basic) {
diff --git a/packages/teleport-github-gateway/src/index.ts b/packages/teleport-github-gateway/src/index.ts
index 33657f68..4c197edf 100644
--- a/packages/teleport-github-gateway/src/index.ts
+++ b/packages/teleport-github-gateway/src/index.ts
@@ -1,4 +1,4 @@
-import { GithubAuthMeta } from '@teleporthq/teleport-types'
+import { ServiceAuth } from '@teleporthq/teleport-types'
 
 import GithubInstance from './github-instance'
 import { createEmptyFolder, fetchFilesContent } from './utils'
@@ -11,10 +11,10 @@ import {
   GithubCommitMeta,
 } from './types'
 
-export const createGithubGateway: GithubGatewayFactory = (auth: GithubAuthMeta = {}) => {
+export const createGithubGateway: GithubGatewayFactory = (auth: ServiceAuth = {}) => {
   const githubInstance = new GithubInstance(auth)
 
-  const getRepository = async (repoIdentity: RepositoryIdentity, authData?: GithubAuthMeta) => {
+  const getRepository = async (repoIdentity: RepositoryIdentity, authData?: ServiceAuth) => {
     authorizeGithubInstance(authData)
 
     const { data } = await githubInstance.getRepoContent(repoIdentity)
@@ -26,22 +26,22 @@ export const createGithubGateway: GithubGatewayFactory = (auth: GithubAuthMeta =
     return fetchFilesContent(data as GithubFile[], emptyFolder, filesFetcherMeta)
   }
 
-  const getUserRepositories = async (username: string, authData?: GithubAuthMeta) => {
+  const getUserRepositories = async (username: string, authData?: ServiceAuth) => {
     authorizeGithubInstance(authData)
     return githubInstance.getUserRepositories(username)
   }
 
-  const createRepository = async (repository: NewRepository, authData?: GithubAuthMeta) => {
+  const createRepository = async (repository: NewRepository, authData?: ServiceAuth) => {
     authorizeGithubInstance(authData)
     return githubInstance.createRepository(repository)
   }
 
-  const commitFilesToRepo = async (commitMeta: GithubCommitMeta, authData: GithubAuthMeta) => {
+  const commitFilesToRepo = async (commitMeta: GithubCommitMeta, authData: ServiceAuth) => {
     authorizeGithubInstance(authData)
     return githubInstance.commitFilesToRepo(commitMeta)
   }
 
-  const authorizeGithubInstance = (authData?: GithubAuthMeta): void => {
+  const authorizeGithubInstance = (authData?: ServiceAuth): void => {
     if (!authData) {
       return
     }
diff --git a/packages/teleport-github-gateway/src/types.ts b/packages/teleport-github-gateway/src/types.ts
index ec3f6fe9..643c30aa 100644
--- a/packages/teleport-github-gateway/src/types.ts
+++ b/packages/teleport-github-gateway/src/types.ts
@@ -1,16 +1,13 @@
-import { GithubAuthMeta, GeneratedFolder } from '@teleporthq/teleport-types'
+import { ServiceAuth, GeneratedFolder } from '@teleporthq/teleport-types'
 import GithubInstance from './github-instance'
 
-export type GithubGatewayFactory = (auth?: GithubAuthMeta) => GithubGateway
+export type GithubGatewayFactory = (auth?: ServiceAuth) => GithubGateway
 
 export interface GithubGateway {
-  getRepository: (repo: RepositoryIdentity, auth?: GithubAuthMeta) => Promise<GeneratedFolder>
-  getUserRepositories: (username: string, auth?: GithubAuthMeta) => Promise<GithubRepositoryData[]>
-  commitFilesToRepo: (commitMeta: GithubCommitMeta, auth?: GithubAuthMeta) => Promise<string>
-  createRepository: (
-    repository: NewRepository,
-    auth?: GithubAuthMeta
-  ) => Promise<GithubRepositoryData>
+  getRepository: (repo: RepositoryIdentity, auth?: ServiceAuth) => Promise<GeneratedFolder>
+  getUserRepositories: (username: string, auth?: ServiceAuth) => Promise<GithubRepositoryData[]>
+  commitFilesToRepo: (commitMeta: GithubCommitMeta, auth?: ServiceAuth) => Promise<string>
+  createRepository: (repository: NewRepository, auth?: ServiceAuth) => Promise<GithubRepositoryData>
 }
 
 export interface RepositoryIdentity {
diff --git a/packages/teleport-github-gateway/src/utils.ts b/packages/teleport-github-gateway/src/utils.ts
index e7f66667..8e11f7ba 100644
--- a/packages/teleport-github-gateway/src/utils.ts
+++ b/packages/teleport-github-gateway/src/utils.ts
@@ -1,5 +1,5 @@
 import fetch from 'cross-fetch'
-import { GeneratedFolder, GeneratedFile, GithubAuthMeta } from '@teleporthq/teleport-types'
+import { GeneratedFolder, GeneratedFile, ServiceAuth } from '@teleporthq/teleport-types'
 import { GithubFile, FilesFetcherMeta, GithubCreateResponse } from './types'
 
 import { DEFAULT_REF, GITHUB_API_BASE_URL } from './constants'
@@ -89,7 +89,7 @@ const getFileContent = async (
 export const createBase64GithubFileBlob = async (
   file: GeneratedFile,
   repository: string,
-  auth?: GithubAuthMeta
+  auth?: ServiceAuth
 ): Promise<GithubCreateResponse> => {
   const url = `${GITHUB_API_BASE_URL}/repos/${repository}/git/blobs`
 
@@ -102,7 +102,7 @@ export const createBase64GithubFileBlob = async (
   return { data }
 }
 
-const createAuthHeader = (auth?: GithubAuthMeta): string => {
+const createAuthHeader = (auth?: ServiceAuth): string => {
   if (!auth) {
     return null
   }
diff --git a/packages/teleport-project-generator-react-basic/src/component-generators.ts b/packages/teleport-project-generator-react-basic/src/component-generators.ts
index 1f84ffbf..8c594a46 100644
--- a/packages/teleport-project-generator-react-basic/src/component-generators.ts
+++ b/packages/teleport-project-generator-react-basic/src/component-generators.ts
@@ -15,7 +15,7 @@ import {
   Mapping,
   ChunkDefinition,
   ComponentGenerator,
-  ProjectGeneratorOptions,
+  GeneratorOptions,
 } from '@teleporthq/teleport-types'
 
 import reactProjectMapping from './react-project-mapping.json'
@@ -64,12 +64,12 @@ export const createHtmlEntryFile = (projectUIDL: ProjectUIDL, options) => {
   return htmlFile
 }
 
-export const createComponentGenerator = (options: ProjectGeneratorOptions): ComponentGenerator => {
+export const createComponentGenerator = (options: GeneratorOptions): ComponentGenerator => {
   const reactGenerator = createReactComponentGenerator('CSSModules')
 
   reactGenerator.addMapping(reactProjectMapping as Mapping)
-  if (options.customMapping) {
-    reactGenerator.addMapping(options.customMapping)
+  if (options.mapping) {
+    reactGenerator.addMapping(options.mapping)
   }
 
   return reactGenerator
diff --git a/packages/teleport-project-generator-react-basic/src/index.ts b/packages/teleport-project-generator-react-basic/src/index.ts
index fefa3951..dfec41d8 100644
--- a/packages/teleport-project-generator-react-basic/src/index.ts
+++ b/packages/teleport-project-generator-react-basic/src/index.ts
@@ -27,26 +27,30 @@ import { Validator, Parser } from '@teleporthq/teleport-uidl-validator'
 
 import {
   ComponentFactoryParams,
-  ProjectGeneratorOptions,
+  GeneratorOptions,
   GeneratedFile,
   GenerateProjectFunction,
-  TemplateDefinition,
+  GeneratedFolder,
   ComponentUIDL,
-  Mapping,
+  ProjectStructure,
 } from '@teleporthq/teleport-types'
 
-export const createReactBasicGenerator = (generatorOptions: ProjectGeneratorOptions = {}) => {
+export const createReactBasicGenerator = (generatorOptions: GeneratorOptions = {}) => {
   const validator = new Validator()
   const reactGenerator = createComponentGenerator(generatorOptions)
 
-  const addCustomMapping = (mapping: Mapping) => {
-    reactGenerator.addMapping(mapping)
-  }
-
   const generateProject: GenerateProjectFunction = async (
     input: Record<string, unknown>,
-    template: TemplateDefinition = {},
-    options: ProjectGeneratorOptions = {}
+    template: GeneratedFolder = {
+      name: 'teleport-project',
+      files: [],
+      subFolders: [],
+    },
+    structure: ProjectStructure = {
+      componentsPath: DEFAULT_COMPONENT_FILES_PATH,
+      pagesPath: DEFAULT_PAGE_FILES_PATH,
+    },
+    options: GeneratorOptions = {}
   ) => {
     // Step 0: Validate project input and transform to UIDL and validate content of UIDL
     if (!options.skipValidation) {
@@ -61,19 +65,12 @@ export const createReactBasicGenerator = (generatorOptions: ProjectGeneratorOpti
     if (!contentValidationResult.valid) {
       throw new Error(contentValidationResult.errorMsg)
     }
-    // Step 1: Add any custom mappings found in the options
-    if (options.customMapping) {
-      reactGenerator.addMapping(options.customMapping)
-    }
 
     const { components = {}, root } = uidl
     const routeNodes = extractRoutes(root)
 
     // Step 2: The first level conditionals become the pages
-    const localDependenciesPrefix = generateLocalDependenciesPrefix(template, {
-      defaultComponentsPath: DEFAULT_COMPONENT_FILES_PATH,
-      defaultPagesPath: DEFAULT_PAGE_FILES_PATH,
-    })
+    const localDependenciesPrefix = generateLocalDependenciesPrefix(structure)
 
     const pagePromises = routeNodes.map((routeNode) => {
       const { value, node } = routeNode.content
@@ -143,7 +140,7 @@ export const createReactBasicGenerator = (generatorOptions: ProjectGeneratorOpti
     }
 
     // Step 9: Create the package.json file
-    const packageFile = createPackageJSONFile(options.sourcePackageJson || DEFAULT_PACKAGE_JSON, {
+    const packageFile = createPackageJSONFile(DEFAULT_PACKAGE_JSON, {
       dependencies: collectedDependencies,
       projectName: uidl.name,
     })
@@ -151,27 +148,25 @@ export const createReactBasicGenerator = (generatorOptions: ProjectGeneratorOpti
     const distFiles: GeneratedFile[] = [packageFile]
 
     // Step 10: Build the folder structure
-    template.meta = template.meta || {}
-
     const filesWithPath = [
       {
         path: [],
         files: distFiles,
       },
       {
-        path: template.meta.srcFilesPath || DEFAULT_SRC_FILES_PATH,
+        path: structure.srcFilesPath || DEFAULT_SRC_FILES_PATH,
         files: srcFiles,
       },
       {
-        path: template.meta.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
+        path: structure.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
         files: componentFiles,
       },
       {
-        path: template.meta.pagesPath || DEFAULT_PAGE_FILES_PATH,
+        path: structure.pagesPath || DEFAULT_PAGE_FILES_PATH,
         files: pageFiles,
       },
       {
-        path: template.meta.staticFilesPath || DEFAULT_STATIC_FILES_PATH,
+        path: structure.staticFilesPath || DEFAULT_STATIC_FILES_PATH,
         files: staticFiles,
       },
     ]
@@ -185,7 +180,6 @@ export const createReactBasicGenerator = (generatorOptions: ProjectGeneratorOpti
   }
 
   return {
-    addCustomMapping,
     generateProject,
   }
 }
diff --git a/packages/teleport-project-generator-react-next/src/component-generators.ts b/packages/teleport-project-generator-react-next/src/component-generators.ts
index 22cbb40c..a58d30c9 100644
--- a/packages/teleport-project-generator-react-next/src/component-generators.ts
+++ b/packages/teleport-project-generator-react-next/src/component-generators.ts
@@ -4,7 +4,7 @@ import { createGenerator } from '@teleporthq/teleport-component-generator'
 import prettierJS from '@teleporthq/teleport-postprocessor-prettier-js'
 
 import {
-  ProjectGeneratorOptions,
+  GeneratorOptions,
   ComponentGenerator,
   ChunkDefinition,
   Mapping,
@@ -15,12 +15,12 @@ import { FILE_TYPE } from '@teleporthq/teleport-shared/lib/constants'
 import { createDocumentComponentAST } from './utils'
 import nextMapping from './next-mapping.json'
 
-export const createReactGenerator = (options: ProjectGeneratorOptions): ComponentGenerator => {
+export const createReactGenerator = (options: GeneratorOptions): ComponentGenerator => {
   const reactGenerator = createReactComponentGenerator('StyledJSX')
 
   reactGenerator.addMapping(nextMapping as Mapping)
-  if (options.customMapping) {
-    reactGenerator.addMapping(options.customMapping)
+  if (options.mapping) {
+    reactGenerator.addMapping(options.mapping)
   }
 
   return reactGenerator
diff --git a/packages/teleport-project-generator-react-next/src/index.ts b/packages/teleport-project-generator-react-next/src/index.ts
index abd763ec..6569e752 100644
--- a/packages/teleport-project-generator-react-next/src/index.ts
+++ b/packages/teleport-project-generator-react-next/src/index.ts
@@ -22,27 +22,31 @@ import {
 import { Validator, Parser } from '@teleporthq/teleport-uidl-validator'
 
 import {
-  ProjectGeneratorOptions,
+  GeneratorOptions,
   ComponentFactoryParams,
   GeneratedFile,
   GenerateProjectFunction,
-  TemplateDefinition,
+  ProjectStructure,
   ComponentUIDL,
-  Mapping,
+  GeneratedFolder,
 } from '@teleporthq/teleport-types'
 
-export const createReactNextGenerator = (generatorOptions: ProjectGeneratorOptions = {}) => {
+export const createReactNextGenerator = (generatorOptions: GeneratorOptions = {}) => {
   const validator = new Validator()
   const reactGenerator = createReactGenerator(generatorOptions)
 
-  const addCustomMapping = (mapping: Mapping) => {
-    reactGenerator.addMapping(mapping)
-  }
-
   const generateProject: GenerateProjectFunction = async (
     input: Record<string, unknown>,
-    template: TemplateDefinition = {},
-    options: ProjectGeneratorOptions = {}
+    template: GeneratedFolder = {
+      name: 'teleport-project',
+      files: [],
+      subFolders: [],
+    },
+    structure: ProjectStructure = {
+      componentsPath: DEFAULT_COMPONENT_FILES_PATH,
+      pagesPath: DEFAULT_PAGE_FILES_PATH,
+    },
+    options: GeneratorOptions = {}
   ) => {
     // Step 0: Validate project input
     if (!options.skipValidation) {
@@ -56,10 +60,6 @@ export const createReactNextGenerator = (generatorOptions: ProjectGeneratorOptio
     if (!contentValidationResult.valid) {
       throw new Error(contentValidationResult.errorMsg)
     }
-    // Step 1: Add any custom mappings found in the options
-    if (options.customMapping) {
-      reactGenerator.addMapping(options.customMapping)
-    }
 
     const { components = {}, root } = uidl
     const routeNodes = extractRoutes(root)
@@ -68,10 +68,7 @@ export const createReactNextGenerator = (generatorOptions: ProjectGeneratorOptio
     const documentComponentFile = createDocumentFile(uidl)
 
     // Step 3: The first level conditional nodes are taken as project pages
-    const localDependenciesPrefix = generateLocalDependenciesPrefix(template, {
-      defaultComponentsPath: DEFAULT_COMPONENT_FILES_PATH,
-      defaultPagesPath: DEFAULT_PAGE_FILES_PATH,
-    })
+    const localDependenciesPrefix = generateLocalDependenciesPrefix(structure)
 
     const pagePromises = routeNodes.map((routeNode) => {
       const { value, node } = routeNode.content
@@ -137,30 +134,28 @@ export const createReactNextGenerator = (generatorOptions: ProjectGeneratorOptio
     }
 
     // Step 8: External dependencies are added to the package.json file from the template project
-    const packageFile = createPackageJSONFile(options.sourcePackageJson || DEFAULT_PACKAGE_JSON, {
+    const packageFile = createPackageJSONFile(DEFAULT_PACKAGE_JSON, {
       dependencies: collectedDependencies,
       projectName: uidl.name,
     })
     const distFiles: GeneratedFile[] = [packageFile]
 
     // Step 9: Build the folder structure
-    template.meta = template.meta || {}
-
     const filesWithPath = [
       {
         path: [],
         files: distFiles,
       },
       {
-        path: template.meta.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
+        path: structure.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
         files: componentFiles,
       },
       {
-        path: template.meta.pagesPath || DEFAULT_PAGE_FILES_PATH,
+        path: structure.pagesPath || DEFAULT_PAGE_FILES_PATH,
         files: pageFiles,
       },
       {
-        path: template.meta.staticFilesPath || DEFAULT_STATIC_FILES_PATH,
+        path: structure.staticFilesPath || DEFAULT_STATIC_FILES_PATH,
         files: staticFiles,
       },
     ]
@@ -174,7 +169,6 @@ export const createReactNextGenerator = (generatorOptions: ProjectGeneratorOptio
   }
 
   return {
-    addCustomMapping,
     generateProject,
   }
 }
diff --git a/packages/teleport-project-generator-vue-basic/src/component-generators.ts b/packages/teleport-project-generator-vue-basic/src/component-generators.ts
index fcdc36c9..99dd5fd0 100644
--- a/packages/teleport-project-generator-vue-basic/src/component-generators.ts
+++ b/packages/teleport-project-generator-vue-basic/src/component-generators.ts
@@ -15,7 +15,7 @@ import {
   ProjectUIDL,
   Mapping,
   ChunkDefinition,
-  ProjectGeneratorOptions,
+  GeneratorOptions,
   ComponentGenerator,
 } from '@teleporthq/teleport-types'
 
@@ -67,13 +67,13 @@ export const createHtmlEntryFile = (projectUIDL: ProjectUIDL, options) => {
   return htmlFile
 }
 
-export const createVueGenerator = (options: ProjectGeneratorOptions): ComponentGenerator => {
+export const createVueGenerator = (options: GeneratorOptions): ComponentGenerator => {
   const vueGenerator = createVueComponentGenerator({
     mapping: vueProjectMapping as Mapping,
   })
 
-  if (options.customMapping) {
-    vueGenerator.addMapping(options.customMapping)
+  if (options.mapping) {
+    vueGenerator.addMapping(options.mapping)
   }
 
   return vueGenerator
diff --git a/packages/teleport-project-generator-vue-basic/src/index.ts b/packages/teleport-project-generator-vue-basic/src/index.ts
index d95174c6..7d9cf94e 100644
--- a/packages/teleport-project-generator-vue-basic/src/index.ts
+++ b/packages/teleport-project-generator-vue-basic/src/index.ts
@@ -22,27 +22,31 @@ import { extractRoutes } from '@teleporthq/teleport-shared/lib/utils/uidl-utils'
 import { Validator, Parser } from '@teleporthq/teleport-uidl-validator'
 
 import {
-  ProjectGeneratorOptions,
+  GeneratorOptions,
   ComponentFactoryParams,
   GeneratedFile,
   GenerateProjectFunction,
-  TemplateDefinition,
-  Mapping,
   ComponentUIDL,
+  GeneratedFolder,
+  ProjectStructure,
 } from '@teleporthq/teleport-types'
 
-export const createVueBasicGenerator = (generatorOptions: ProjectGeneratorOptions = {}) => {
+export const createVueBasicGenerator = (generatorOptions: GeneratorOptions = {}) => {
   const validator = new Validator()
   const vueGenerator = createVueGenerator(generatorOptions)
 
-  const addCustomMapping = (mapping: Mapping) => {
-    vueGenerator.addMapping(mapping)
-  }
-
   const generateProject: GenerateProjectFunction = async (
     input: Record<string, unknown>,
-    template: TemplateDefinition = {},
-    options: ProjectGeneratorOptions = {}
+    template: GeneratedFolder = {
+      name: 'teleport-project',
+      files: [],
+      subFolders: [],
+    },
+    structure: ProjectStructure = {
+      componentsPath: DEFAULT_COMPONENT_FILES_PATH,
+      pagesPath: DEFAULT_PAGE_FILES_PATH,
+    },
+    options: GeneratorOptions = {}
   ) => {
     // Step 0: Validate project input
     if (!options.skipValidation) {
@@ -56,19 +60,12 @@ export const createVueBasicGenerator = (generatorOptions: ProjectGeneratorOption
     if (!contentValidationResult.valid) {
       throw new Error(contentValidationResult.errorMsg)
     }
-    // Step 1: Add any custom mappings found in the options
-    if (options.customMapping) {
-      vueGenerator.addMapping(options.customMapping)
-    }
 
     const { components = {}, root } = uidl
     const routes = extractRoutes(root)
 
     // Step 2: The first level conditional nodes are taken as project pages
-    const localDependenciesPrefix = generateLocalDependenciesPrefix(template, {
-      defaultComponentsPath: DEFAULT_COMPONENT_FILES_PATH,
-      defaultPagesPath: DEFAULT_PAGE_FILES_PATH,
-    })
+    const localDependenciesPrefix = generateLocalDependenciesPrefix(structure)
 
     const pagePromises = routes.map((routeNode) => {
       const { value, node } = routeNode.content
@@ -139,37 +136,32 @@ export const createVueBasicGenerator = (generatorOptions: ProjectGeneratorOption
     }
 
     // Step 8: External dependencies are added to the package.json file from the template project
-    const packageJSONFile = createPackageJSONFile(
-      options.sourcePackageJson || DEFAULT_PACKAGE_JSON,
-      {
-        dependencies: collectedDependencies,
-        projectName: uidl.name,
-      }
-    )
+    const packageJSONFile = createPackageJSONFile(DEFAULT_PACKAGE_JSON, {
+      dependencies: collectedDependencies,
+      projectName: uidl.name,
+    })
     const distFiles = [packageJSONFile]
 
     // Step 9: Build the folder structure
-    template.meta = template.meta || {}
-
     const filesWithPath = [
       {
         path: [],
         files: distFiles,
       },
       {
-        path: template.meta.srcFilesPath || DEFAULT_SRC_FILES_PATH,
+        path: structure.srcFilesPath || DEFAULT_SRC_FILES_PATH,
         files: srcFiles,
       },
       {
-        path: template.meta.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
+        path: structure.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
         files: componentFiles,
       },
       {
-        path: template.meta.pagesPath || DEFAULT_PAGE_FILES_PATH,
+        path: structure.pagesPath || DEFAULT_PAGE_FILES_PATH,
         files: pageFiles,
       },
       {
-        path: template.meta.publicFiles || DEFAULT_PUBLIC_FILES_PATH,
+        path: structure.publicFiles || DEFAULT_PUBLIC_FILES_PATH,
         files: publicFiles,
       },
     ]
@@ -183,7 +175,6 @@ export const createVueBasicGenerator = (generatorOptions: ProjectGeneratorOption
   }
 
   return {
-    addCustomMapping,
     generateProject,
   }
 }
diff --git a/packages/teleport-project-generator-vue-nuxt/src/component-generators.ts b/packages/teleport-project-generator-vue-nuxt/src/component-generators.ts
index cf7e92fe..cbac44b1 100644
--- a/packages/teleport-project-generator-vue-nuxt/src/component-generators.ts
+++ b/packages/teleport-project-generator-vue-nuxt/src/component-generators.ts
@@ -10,7 +10,7 @@ import {
   ProjectUIDL,
   Mapping,
   ChunkDefinition,
-  ProjectGeneratorOptions,
+  GeneratorOptions,
   ComponentGenerator,
 } from '@teleporthq/teleport-types'
 
@@ -44,13 +44,13 @@ export const createHtmlEntryFile = (projectUIDL: ProjectUIDL, options) => {
   return htmlFile
 }
 
-export const createVueGenerator = (options: ProjectGeneratorOptions): ComponentGenerator => {
+export const createVueGenerator = (options: GeneratorOptions): ComponentGenerator => {
   const vueGenerator = createVueComponentGenerator({
     mapping: nuxtMapping as Mapping,
   })
 
-  if (options.customMapping) {
-    vueGenerator.addMapping(options.customMapping)
+  if (options.mapping) {
+    vueGenerator.addMapping(options.mapping)
   }
 
   return vueGenerator
diff --git a/packages/teleport-project-generator-vue-nuxt/src/index.ts b/packages/teleport-project-generator-vue-nuxt/src/index.ts
index 6eaafde0..a02a786c 100644
--- a/packages/teleport-project-generator-vue-nuxt/src/index.ts
+++ b/packages/teleport-project-generator-vue-nuxt/src/index.ts
@@ -23,27 +23,31 @@ import { extractRoutes } from '@teleporthq/teleport-shared/lib/utils/uidl-utils'
 import { Validator, Parser } from '@teleporthq/teleport-uidl-validator'
 
 import {
-  ProjectGeneratorOptions,
+  GeneratorOptions,
   ComponentFactoryParams,
   GeneratedFile,
+  GeneratedFolder,
   GenerateProjectFunction,
-  TemplateDefinition,
+  ProjectStructure,
   ComponentUIDL,
-  Mapping,
 } from '@teleporthq/teleport-types'
 
-export const createVueNuxtGenerator = (generatorOptions: ProjectGeneratorOptions = {}) => {
+export const createVueNuxtGenerator = (generatorOptions: GeneratorOptions = {}) => {
   const validator = new Validator()
   const vueGenerator = createVueGenerator(generatorOptions)
 
-  const addCustomMapping = (mapping: Mapping) => {
-    vueGenerator.addMapping(mapping)
-  }
-
   const generateProject: GenerateProjectFunction = async (
     input: Record<string, unknown>,
-    template: TemplateDefinition = {},
-    options: ProjectGeneratorOptions = {}
+    template: GeneratedFolder = {
+      name: 'teleport-project',
+      files: [],
+      subFolders: [],
+    },
+    structure: ProjectStructure = {
+      componentsPath: DEFAULT_COMPONENT_FILES_PATH,
+      pagesPath: DEFAULT_PAGE_FILES_PATH,
+    },
+    options: GeneratorOptions = {}
   ) => {
     // Step 0: Validate project input
     if (!options.skipValidation) {
@@ -57,19 +61,12 @@ export const createVueNuxtGenerator = (generatorOptions: ProjectGeneratorOptions
     if (!contentValidationResult.valid) {
       throw new Error(contentValidationResult.errorMsg)
     }
-    // Step 1: Add any custom mappings found in the options
-    if (options.customMapping) {
-      vueGenerator.addMapping(options.customMapping)
-    }
 
     const { components = {}, root } = uidl
     const routes = extractRoutes(root)
 
     // Step 2: The first level stateBranches (the pages) transformation in react components is started
-    const localDependenciesPrefix = generateLocalDependenciesPrefix(template, {
-      defaultComponentsPath: DEFAULT_COMPONENT_FILES_PATH,
-      defaultPagesPath: DEFAULT_PAGE_FILES_PATH,
-    })
+    const localDependenciesPrefix = generateLocalDependenciesPrefix(structure)
 
     const pagePromises = routes.map((routeNode) => {
       const { value: pageName, node } = routeNode.content
@@ -141,7 +138,7 @@ export const createVueNuxtGenerator = (generatorOptions: ProjectGeneratorOptions
     }
 
     // Step 8: External dependencies are added to the package.json file from the template project
-    const packageFile = createPackageJSONFile(options.sourcePackageJson || DEFAULT_PACKAGE_JSON, {
+    const packageFile = createPackageJSONFile(DEFAULT_PACKAGE_JSON, {
       dependencies: collectedDependencies,
       projectName: uidl.name,
     })
@@ -149,23 +146,21 @@ export const createVueNuxtGenerator = (generatorOptions: ProjectGeneratorOptions
     const distFiles = [htmlIndexFile, packageFile]
 
     // Step 9: Build the folder structure
-    template.meta = template.meta || {}
-
     const filesWithPath = [
       {
         path: [],
         files: distFiles,
       },
       {
-        path: template.meta.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
+        path: structure.componentsPath || DEFAULT_COMPONENT_FILES_PATH,
         files: componentFiles,
       },
       {
-        path: template.meta.pagesPath || DEFAULT_PAGE_FILES_PATH,
+        path: structure.pagesPath || DEFAULT_PAGE_FILES_PATH,
         files: pageFiles,
       },
       {
-        path: template.meta.staticFilesPath || DEFAULT_STATIC_FILES_PATH,
+        path: structure.staticFilesPath || DEFAULT_STATIC_FILES_PATH,
         files: staticFiles,
       },
     ]
@@ -179,7 +174,6 @@ export const createVueNuxtGenerator = (generatorOptions: ProjectGeneratorOptions
   }
 
   return {
-    addCustomMapping,
     generateProject,
   }
 }
diff --git a/packages/teleport-project-packer-playground/src/index.ts b/packages/teleport-project-packer-playground/src/index.ts
index 037130de..257e588c 100644
--- a/packages/teleport-project-packer-playground/src/index.ts
+++ b/packages/teleport-project-packer-playground/src/index.ts
@@ -1,10 +1,11 @@
 import {
   AssetsDefinition,
   PublisherResponse,
-  TemplateDefinition,
   ProjectUIDL,
   Mapping,
-  GithubAuthMeta,
+  ServiceAuth,
+  GeneratedFolder,
+  RemoteTemplateDefinition,
 } from '@teleporthq/teleport-types'
 
 import { createProjectPacker } from '@teleporthq/teleport-project-packer'
@@ -35,7 +36,8 @@ import { GENERATOR_NOT_FOUND, PUBLISHER_NOT_FOUND } from './errors'
 export interface PackerFactoryParams {
   technology?: TechnologyDefinition
   publisher?: PublisherDefinition
-  template?: TemplateDefinition
+  template?: GeneratedFolder
+  remoteTemplateDefinition?: RemoteTemplateDefinition
   assets?: AssetsDefinition
 }
 
@@ -43,7 +45,7 @@ export interface TechnologyDefinition {
   type: string
   meta?: {
     variation?: string
-    customMapping?: Mapping
+    mapping?: Mapping
   }
 }
 
@@ -55,7 +57,7 @@ export interface PublisherDefinition {
     projectName?: string
   }
   github?: {
-    authMeta?: GithubAuthMeta
+    authMeta?: ServiceAuth
     repositoryOwner?: string
     repository?: string
     masterBranch?: string
@@ -86,8 +88,8 @@ const projectPublishers: Record<string, SupportedPublishers> = {
   [PUBLISHERS.GITHUB]: createGithubPublisher,
 }
 
-const getGithubRemoteDefinition = (username: string, repo: string) => {
-  return { remote: { githubRepo: { username, repo } } }
+const getGithubRemoteDefinition = (username: string, repo: string): RemoteTemplateDefinition => {
+  return { username, repo, provider: 'github' }
 }
 
 const projectTemplates = {
@@ -138,11 +140,6 @@ export const createPlaygroundPacker = (params: PackerFactoryParams = {}) => {
       return { success: false, payload: PUBLISHER_NOT_FOUND }
     }
 
-    const templateByTechnology =
-      technology && technology.type ? projectTemplates[technology.type] : projectTemplates.ReactNext
-
-    const projectTemplate = packParams.template || template || templateByTechnology
-
     const projectGenerator = generatorFactory({ ...packTechnology.meta })
 
     const meta =
@@ -152,7 +149,23 @@ export const createPlaygroundPacker = (params: PackerFactoryParams = {}) => {
     packer.setAssets(projectAssets)
     packer.setGeneratorFunction(projectGenerator.generateProject)
     packer.setPublisher(projectPublisher)
-    packer.setTemplate(projectTemplate)
+
+    const remoteGithubTemplate =
+      projectTemplates[packTechnology.type] || projectTemplates[TEMPLATES.REACT_NEXT]
+
+    if (packParams.template) {
+      // First priority for the template passed as a param for pack()
+      packer.setTemplate(packParams.template)
+    } else if (packParams.remoteTemplateDefinition) {
+      // Second priority for the remote template definition passed as param for pack()
+      await packer.loadTemplate(packParams.remoteTemplateDefinition)
+    } else if (template) {
+      // Third priority for the template passed to the factory function
+      packer.setTemplate(template)
+    } else {
+      // Fourth priority for the remote definition associated with the technology (default to next.js)
+      await packer.loadTemplate(remoteGithubTemplate)
+    }
 
     return packer.pack(projectUIDL)
   }
diff --git a/packages/teleport-project-packer/src/constants.ts b/packages/teleport-project-packer/src/constants.ts
index 68a1a805..f0b56a11 100644
--- a/packages/teleport-project-packer/src/constants.ts
+++ b/packages/teleport-project-packer/src/constants.ts
@@ -1,9 +1,7 @@
 export const GITHUB_API_BASE_URL = 'https://api.github.com'
 
 export const DEFAULT_TEMPLATE = {
-  templateFolder: {
-    name: 'teleport-project',
-    files: [],
-    subFolders: [],
-  },
+  name: 'teleport-project',
+  files: [],
+  subFolders: [],
 }
diff --git a/packages/teleport-project-packer/src/errors.ts b/packages/teleport-project-packer/src/errors.ts
index b39b5b6d..70f9c488 100644
--- a/packages/teleport-project-packer/src/errors.ts
+++ b/packages/teleport-project-packer/src/errors.ts
@@ -1,4 +1,3 @@
-export const NO_REMOTE_TEMPLATE_PROVIDED = 'No remote definition of template provided'
 export const NO_GENERATOR_FUNCTION_PROVIDED = 'No generator function provided'
 export const NO_PUBLISHER_PROVIDED = 'No publisher provided'
 
diff --git a/packages/teleport-project-packer/src/index.ts b/packages/teleport-project-packer/src/index.ts
index 6a251be3..35c0cb02 100644
--- a/packages/teleport-project-packer/src/index.ts
+++ b/packages/teleport-project-packer/src/index.ts
@@ -3,22 +3,19 @@ import {
   Publisher,
   GenerateProjectFunction,
   PublisherResponse,
-  TemplateDefinition,
-  LoadTemplateResponse,
   ProjectUIDL,
+  GeneratedFolder,
+  RemoteTemplateDefinition,
 } from '@teleporthq/teleport-types'
 import { injectAssetsToProject, fetchTemplate } from './utils'
-import {
-  NO_GENERATOR_FUNCTION_PROVIDED,
-  NO_PUBLISHER_PROVIDED,
-  NO_REMOTE_TEMPLATE_PROVIDED,
-} from './errors'
+import { NO_GENERATOR_FUNCTION_PROVIDED, NO_PUBLISHER_PROVIDED } from './errors'
 import { DEFAULT_TEMPLATE } from './constants'
 
 export interface PackerFactoryParams {
   publisher?: Publisher<any, any>
   generatorFunction?: GenerateProjectFunction
-  template?: TemplateDefinition
+  template?: GeneratedFolder
+  remoteTemplateDefinition?: RemoteTemplateDefinition
   assets?: AssetsDefinition
 }
 
@@ -26,16 +23,17 @@ export type PackerFactory = (
   params?: PackerFactoryParams
 ) => {
   pack: (projectUIDL?: ProjectUIDL, params?: PackerFactoryParams) => Promise<PublisherResponse<any>>
-  loadTemplate: (template?: TemplateDefinition) => Promise<LoadTemplateResponse>
+  loadTemplate: (remoteTemplateDefinition: RemoteTemplateDefinition) => Promise<GeneratedFolder>
   setPublisher: <T, U>(publisher: Publisher<T, U>) => void
   setGeneratorFunction: (generatorFunction: GenerateProjectFunction) => void
   setAssets: (assets: AssetsDefinition) => void
-  setTemplate: (template: TemplateDefinition) => void
+  setTemplate: (templateFolder: GeneratedFolder) => void
 }
 
 export const createProjectPacker: PackerFactory = (params: PackerFactoryParams = {}) => {
   let { assets, generatorFunction, publisher, template } = params
-  let templateLoaded = false
+
+  template = template || DEFAULT_TEMPLATE
 
   const setPublisher = <T, U>(publisherToSet: Publisher<T, U>): void => {
     publisher = publisherToSet
@@ -49,37 +47,24 @@ export const createProjectPacker: PackerFactory = (params: PackerFactoryParams =
     assets = assetsToSet
   }
 
-  const setTemplate = (templateToSet: TemplateDefinition): void => {
-    template = templateToSet
+  const setTemplate = (templateFolder: GeneratedFolder): void => {
+    template = templateFolder
   }
 
   const loadTemplate = async (
-    templateToLoad?: TemplateDefinition
-  ): Promise<LoadTemplateResponse> => {
-    template = templateToLoad || template || DEFAULT_TEMPLATE
-
-    if (template.templateFolder) {
-      return { success: true, payload: template.templateFolder }
-    }
-
-    if (!template.remote) {
-      return { success: false, payload: NO_REMOTE_TEMPLATE_PROVIDED }
-    }
-
+    remoteDefinition: RemoteTemplateDefinition
+  ): Promise<GeneratedFolder> => {
     try {
-      template.templateFolder = await fetchTemplate(template.remote)
-      templateLoaded = true
-      return { success: true, payload: template.templateFolder }
+      template = await fetchTemplate(remoteDefinition)
+      return template // TODO: is this useful?
     } catch (err) {
-      return { success: false, payload: err }
+      throw err // TODO: error handling here?
     }
   }
 
   const pack = async (uidl: ProjectUIDL, packParams: PackerFactoryParams = {}) => {
     const definedProjectUIDL = uidl
 
-    const packTemplate = packParams.template || template
-
     const packGeneratorFunction = packParams.generatorFunction || generatorFunction
     if (!packGeneratorFunction) {
       return { success: false, payload: NO_GENERATOR_FUNCTION_PROVIDED }
@@ -92,14 +77,15 @@ export const createProjectPacker: PackerFactory = (params: PackerFactoryParams =
 
     const packAssets = packParams.assets || assets
 
-    if (!templateLoaded || packParams.template) {
-      const loaded = await loadTemplate(packTemplate)
-      if (!loaded.success) {
-        return loaded
-      }
+    let templateFolder = packParams.template || template
+    if (!packParams.template && packParams.remoteTemplateDefinition) {
+      templateFolder = await loadTemplate(packParams.remoteTemplateDefinition)
     }
 
-    const { assetsPath, outputFolder } = await packGeneratorFunction(definedProjectUIDL, template)
+    const { assetsPath, outputFolder } = await packGeneratorFunction(
+      definedProjectUIDL,
+      templateFolder
+    )
 
     const project = await injectAssetsToProject(outputFolder, packAssets, assetsPath)
 
diff --git a/packages/teleport-project-packer/src/utils.ts b/packages/teleport-project-packer/src/utils.ts
index c219a4b2..30a834a3 100644
--- a/packages/teleport-project-packer/src/utils.ts
+++ b/packages/teleport-project-packer/src/utils.ts
@@ -9,11 +9,9 @@ import {
 } from '@teleporthq/teleport-types'
 
 export const fetchTemplate = async (template: RemoteTemplateDefinition) => {
-  if (template.githubRepo) {
-    const authData = template.githubRepo.auth || {}
-    const githubGateway = createGithubGateway(authData)
-    return githubGateway.getRepository(template.githubRepo)
-  }
+  const authData = template.auth || {}
+  const githubGateway = createGithubGateway(authData)
+  return githubGateway.getRepository(template)
 }
 
 export const injectAssetsToProject = async (
diff --git a/packages/teleport-publisher-github/src/index.ts b/packages/teleport-publisher-github/src/index.ts
index b622ca60..ca58f4f1 100644
--- a/packages/teleport-publisher-github/src/index.ts
+++ b/packages/teleport-publisher-github/src/index.ts
@@ -1,4 +1,4 @@
-import { GeneratedFolder, PublisherFactory, GithubAuthMeta } from '@teleporthq/teleport-types'
+import { GeneratedFolder, PublisherFactory, ServiceAuth } from '@teleporthq/teleport-types'
 
 import { publishToGithub, generateProjectFiles } from './utils'
 import { GithubFactoryParams, GithubPublisher, GithubPublishMeta } from './types'
@@ -86,7 +86,7 @@ export const createGithubPublisher: PublisherFactory<GithubFactoryParams, Github
     }
   }
 
-  const findRepositoryOwner = (auth: GithubAuthMeta, options: GithubFactoryParams): string => {
+  const findRepositoryOwner = (auth: ServiceAuth, options: GithubFactoryParams): string => {
     if (auth && auth.basic && auth.basic.username) {
       return auth.basic.username
     }
diff --git a/packages/teleport-publisher-github/src/types.ts b/packages/teleport-publisher-github/src/types.ts
index df0d69d2..9745a898 100644
--- a/packages/teleport-publisher-github/src/types.ts
+++ b/packages/teleport-publisher-github/src/types.ts
@@ -1,5 +1,5 @@
 import {
-  GithubAuthMeta,
+  ServiceAuth,
   PublisherFactoryParams,
   Publisher,
   GeneratedFolder,
@@ -7,7 +7,7 @@ import {
 import { GithubFile } from '../../teleport-github-gateway/lib/types'
 
 export interface GithubFactoryParams extends PublisherFactoryParams {
-  authMeta?: GithubAuthMeta
+  authMeta?: ServiceAuth
   repositoryOwner?: string
   repository?: string
   masterBranch?: string
@@ -29,7 +29,7 @@ export interface GithubPublisher extends Publisher<GithubFactoryParams, string>
 }
 
 export interface GithubPublishMeta {
-  authMeta: GithubAuthMeta
+  authMeta: ServiceAuth
   repository: string
   repositoryOwner: string
   masterBranch?: string
diff --git a/packages/teleport-shared/src/utils/project-utils.ts b/packages/teleport-shared/src/utils/project-utils.ts
index 80fb52af..4bbc4ae5 100644
--- a/packages/teleport-shared/src/utils/project-utils.ts
+++ b/packages/teleport-shared/src/utils/project-utils.ts
@@ -16,7 +16,7 @@ import {
   ComponentFactoryParams,
   ComponentGeneratorOutput,
   GeneratedFolder,
-  TemplateDefinition,
+  ProjectStructure,
   HastNode,
   FilesPathRecord,
   ProjectUIDL,
@@ -251,24 +251,9 @@ export const createFile = (name: string, fileType: string, content: string): Gen
   return { name, fileType, content }
 }
 
-interface LocalDependenciesMeta {
-  defaultComponentsPath: string | string[]
-  defaultPagesPath: string | string[]
-}
-
-export const generateLocalDependenciesPrefix = (
-  template: TemplateDefinition,
-  meta: LocalDependenciesMeta
-): string => {
-  const initialComponentsPath =
-    template && template.meta && template.meta.componentsPath
-      ? template.meta.componentsPath
-      : [].concat(meta.defaultComponentsPath)
-
-  const initialPagesPath =
-    template && template.meta && template.meta.pagesPath
-      ? template.meta.pagesPath
-      : [].concat(meta.defaultPagesPath)
+export const generateLocalDependenciesPrefix = (structure: ProjectStructure): string => {
+  const initialComponentsPath = structure.componentsPath
+  const initialPagesPath = structure.pagesPath
 
   let dependencyPrefix = ''
 
@@ -340,18 +325,14 @@ const elementsFromArrayAreEqual = (arrayOfElements: string[]): boolean => {
 
 export const injectFilesInFolderStructure = (
   filePathRecords: FilesPathRecord[],
-  template: TemplateDefinition
+  template: GeneratedFolder
 ): GeneratedFolder => {
-  template.meta = template.meta || {}
-
-  let { templateFolder } = template
-
   for (const filePathRecord of filePathRecords) {
     const { path, files } = filePathRecord
-    templateFolder = injectFilesToPath(templateFolder, path, files)
+    template = injectFilesToPath(template, path, files)
   }
 
-  return templateFolder
+  return template
 }
 
 const injectFilesToPath = (
diff --git a/packages/teleport-types/src/generators.ts b/packages/teleport-types/src/generators.ts
index b191ff19..1ebae254 100644
--- a/packages/teleport-types/src/generators.ts
+++ b/packages/teleport-types/src/generators.ts
@@ -128,13 +128,6 @@ export interface ComponentGeneratorOutput {
   dependencies: Record<string, string>
 }
 
-export interface ProjectGeneratorOptions {
-  sourcePackageJson?: PackageJSON
-  distPath?: string
-  customMapping?: Mapping
-  skipValidation?: boolean
-}
-
 export interface PackageJSON {
   name: string
   description: string
@@ -177,8 +170,9 @@ export interface ProjectGeneratorOutput {
 
 export type GenerateProjectFunction = (
   input: Record<string, unknown>,
-  template?: TemplateDefinition,
-  options?: ProjectGeneratorOptions
+  template?: GeneratedFolder,
+  structure?: ProjectStructure,
+  options?: GeneratorOptions
 ) => Promise<ProjectGeneratorOutput>
 
 export type GenerateComponentFunction = (
@@ -223,23 +217,16 @@ export interface AssetInfo {
   type: string
 }
 
-export interface TemplateDefinition {
-  templateFolder?: GeneratedFolder
-  remote?: RemoteTemplateDefinition
-  meta?: Record<string, string[]>
-}
+export type ProjectStructure = Record<string, string[]>
 
 export interface RemoteTemplateDefinition {
-  githubRepo?: GithubProjectMeta
-}
-
-export interface GithubProjectMeta {
+  provider: 'github'
   username: string
   repo: string
-  auth?: GithubAuthMeta
+  auth?: ServiceAuth
 }
 
-export interface GithubAuthMeta {
+export interface ServiceAuth {
   basic?: {
     username: string
     password: string
@@ -247,17 +234,6 @@ export interface GithubAuthMeta {
   token?: string
 }
 
-export type TemplateProvider<T> = (
-  config?: T
-) => {
-  getTemplateAsFolder: (meta?: T) => Promise<GeneratedFolder>
-}
-
-export interface LoadTemplateResponse {
-  success: boolean
-  payload: GeneratedFolder | string | Error
-}
-
 export interface FilesPathRecord {
   path: string[]
   files: GeneratedFile[]


Test patch:
diff --git a/packages/teleport-project-generator-react-basic/__tests__/end2end/index.ts b/packages/teleport-project-generator-react-basic/__tests__/end2end/index.ts
index 2d78ec80..58b04615 100644
--- a/packages/teleport-project-generator-react-basic/__tests__/end2end/index.ts
+++ b/packages/teleport-project-generator-react-basic/__tests__/end2end/index.ts
@@ -17,7 +17,7 @@ describe('React Basic Project Generator', () => {
     const result = await generator.generateProject(projectUIDL, template)
 
     expect(result.assetsPath).toBeDefined()
-    expect(result.outputFolder.name).toBe(template.templateFolder.name)
+    expect(result.outputFolder.name).toBe(template.name)
     expect(result.outputFolder.files[0].name).toBe('package')
 
     const srcFolder = result.outputFolder.subFolders[0]
@@ -37,10 +37,10 @@ describe('React Basic Project Generator', () => {
 
   it('works when validation step is skiped', async () => {
     const options = { skipValidation: true }
-    const result = await generator.generateProject(invalidUidlSample, template, options)
+    const result = await generator.generateProject(invalidUidlSample, template, undefined, options)
 
     expect(result.assetsPath).toBeDefined()
-    expect(result.outputFolder.name).toBe(template.templateFolder.name)
+    expect(result.outputFolder.name).toBe(template.name)
     expect(result.outputFolder.files[0].name).toBe('package')
 
     const srcFolder = result.outputFolder.subFolders[0]
diff --git a/packages/teleport-project-generator-react-basic/__tests__/end2end/template-definition.json b/packages/teleport-project-generator-react-basic/__tests__/end2end/template-definition.json
index 1aa4e93f..fc7380a6 100644
--- a/packages/teleport-project-generator-react-basic/__tests__/end2end/template-definition.json
+++ b/packages/teleport-project-generator-react-basic/__tests__/end2end/template-definition.json
@@ -1,29 +1,27 @@
 {
-  "templateFolder": {
-    "name": "react-basic",
-    "files": [],
-    "subFolders": [
-      {
-        "name": "src",
-        "files": [],
-        "subFolders": [
-          {
-            "name": "components",
-            "files": [],
-            "subFolders": []              
-          },
-          {
-            "name": "pages",
-            "files": [],
-            "subFolders": []              
-          },
-          {
-            "name": "static",
-            "files": [],
-            "subFolders": []              
-          }
-        ]
-      }
-    ]
-  }
+  "name": "react-basic",
+  "files": [],
+  "subFolders": [
+    {
+      "name": "src",
+      "files": [],
+      "subFolders": [
+        {
+          "name": "components",
+          "files": [],
+          "subFolders": []              
+        },
+        {
+          "name": "pages",
+          "files": [],
+          "subFolders": []              
+        },
+        {
+          "name": "static",
+          "files": [],
+          "subFolders": []              
+        }
+      ]
+    }
+  ]
 }
\ No newline at end of file
diff --git a/packages/teleport-project-generator-react-next/__tests__/end2end/index.ts b/packages/teleport-project-generator-react-next/__tests__/end2end/index.ts
index c1b5bba6..d5464912 100644
--- a/packages/teleport-project-generator-react-next/__tests__/end2end/index.ts
+++ b/packages/teleport-project-generator-react-next/__tests__/end2end/index.ts
@@ -17,7 +17,7 @@ describe('React Next Project Generator', () => {
     const { assetsPath, outputFolder } = await generator.generateProject(projectUIDL, template)
 
     expect(assetsPath).toBeDefined()
-    expect(outputFolder.name).toBe(template.templateFolder.name)
+    expect(outputFolder.name).toBe(template.name)
     expect(outputFolder.files[0].name).toBe('package')
 
     const components = outputFolder.subFolders[0]
@@ -34,10 +34,10 @@ describe('React Next Project Generator', () => {
   })
   it('works when validation step is skiped', async () => {
     const options = { skipValidation: true }
-    const result = await generator.generateProject(invalidUidlSample, template, options)
+    const result = await generator.generateProject(invalidUidlSample, template, undefined, options)
 
     expect(result.assetsPath).toBeDefined()
-    expect(result.outputFolder.name).toBe(template.templateFolder.name)
+    expect(result.outputFolder.name).toBe(template.name)
     expect(result.outputFolder.files[0].name).toBe('package')
 
     const components = result.outputFolder.subFolders[0]
diff --git a/packages/teleport-project-generator-react-next/__tests__/end2end/template-definition.json b/packages/teleport-project-generator-react-next/__tests__/end2end/template-definition.json
index 61c56c58..54cd783b 100644
--- a/packages/teleport-project-generator-react-next/__tests__/end2end/template-definition.json
+++ b/packages/teleport-project-generator-react-next/__tests__/end2end/template-definition.json
@@ -1,23 +1,21 @@
 {
-  "templateFolder": {
-    "name": "react-next",
-    "files": [],
-    "subFolders": [
-      {
-        "name": "components",
-        "files": [],
-        "subFolders": []              
-      },
-      {
-        "name": "pages",
-        "files": [],
-        "subFolders": []              
-      },
-      {
-        "name": "static",
-        "files": [],
-        "subFolders": []              
-      }
-    ]
-  }
+  "name": "react-next",
+  "files": [],
+  "subFolders": [
+    {
+      "name": "components",
+      "files": [],
+      "subFolders": []              
+    },
+    {
+      "name": "pages",
+      "files": [],
+      "subFolders": []              
+    },
+    {
+      "name": "static",
+      "files": [],
+      "subFolders": []              
+    }
+  ]
 }
\ No newline at end of file
diff --git a/packages/teleport-project-generator-vue-basic/__tests__/end2end/index.ts b/packages/teleport-project-generator-vue-basic/__tests__/end2end/index.ts
index 72b09bb0..573c2e88 100644
--- a/packages/teleport-project-generator-vue-basic/__tests__/end2end/index.ts
+++ b/packages/teleport-project-generator-vue-basic/__tests__/end2end/index.ts
@@ -17,7 +17,7 @@ describe('Vue Basic Project Generator', () => {
     const result = await generator.generateProject(projectUIDL, template)
 
     expect(result.assetsPath).toBeDefined()
-    expect(result.outputFolder.name).toBe(template.templateFolder.name)
+    expect(result.outputFolder.name).toBe(template.name)
   })
   it('throws error when invalid UIDL sample is used', async () => {
     const result = generator.generateProject(invalidUidlSample, template)
@@ -27,9 +27,9 @@ describe('Vue Basic Project Generator', () => {
 
   it('works when validation step is skiped', async () => {
     const options = { skipValidation: true }
-    const result = await generator.generateProject(invalidUidlSample, template, options)
+    const result = await generator.generateProject(invalidUidlSample, template, undefined, options)
 
     expect(result.assetsPath).toBeDefined()
-    expect(result.outputFolder.name).toBe(template.templateFolder.name)
+    expect(result.outputFolder.name).toBe(template.name)
   })
 })
diff --git a/packages/teleport-project-generator-vue-basic/__tests__/end2end/template-definition.json b/packages/teleport-project-generator-vue-basic/__tests__/end2end/template-definition.json
index 62fdd8ee..e10112c4 100644
--- a/packages/teleport-project-generator-vue-basic/__tests__/end2end/template-definition.json
+++ b/packages/teleport-project-generator-vue-basic/__tests__/end2end/template-definition.json
@@ -1,29 +1,27 @@
 {
-  "templateFolder": {
-    "name": "vue-basic",
-    "files": [],
-    "subFolders": [
-      {
-        "name": "src",
-        "files": [],
-        "subFolders": [
-          {
-            "name": "components",
-            "files": [],
-            "subFolders": []              
-          },
-          {
-            "name": "views",
-            "files": [],
-            "subFolders": []              
-          },
-          {
-            "name": "public",
-            "files": [],
-            "subFolders": []              
-          }
-        ]
-      }
-    ]
-  }
+  "name": "vue-basic",
+  "files": [],
+  "subFolders": [
+    {
+      "name": "src",
+      "files": [],
+      "subFolders": [
+        {
+          "name": "components",
+          "files": [],
+          "subFolders": []              
+        },
+        {
+          "name": "views",
+          "files": [],
+          "subFolders": []              
+        },
+        {
+          "name": "public",
+          "files": [],
+          "subFolders": []              
+        }
+      ]
+    }
+  ]
 }
\ No newline at end of file
diff --git a/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/index.ts b/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/index.ts
index b1239082..0dd0e53c 100644
--- a/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/index.ts
+++ b/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/index.ts
@@ -17,7 +17,7 @@ describe('Vue Nuxt Project Generator', () => {
     const result = await generator.generateProject(projectUIDL, template)
 
     expect(result.assetsPath).toBeDefined()
-    expect(result.outputFolder.name).toBe(template.templateFolder.name)
+    expect(result.outputFolder.name).toBe(template.name)
   })
 
   it('throws error when invalid UIDL sample is used', async () => {
@@ -28,8 +28,8 @@ describe('Vue Nuxt Project Generator', () => {
 
   it('works when validation step is skiped', async () => {
     const options = { skipValidation: true }
-    const result = await generator.generateProject(invalidUidlSample, template, options)
+    const result = await generator.generateProject(invalidUidlSample, template, undefined, options)
     expect(result.assetsPath).toBeDefined()
-    expect(result.outputFolder.name).toBe(template.templateFolder.name)
+    expect(result.outputFolder.name).toBe(template.name)
   })
 })
diff --git a/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/template-definition.json b/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/template-definition.json
index f1baee8b..4876e325 100644
--- a/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/template-definition.json
+++ b/packages/teleport-project-generator-vue-nuxt/__tests__/end2end/template-definition.json
@@ -1,23 +1,21 @@
 {
-  "templateFolder": {
-    "name": "vue-nuxt",
-    "files": [],
-    "subFolders": [
-      {
-        "name": "components",
-        "files": [],
-        "subFolders": []              
-      },
-      {
-        "name": "pages",
-        "files": [],
-        "subFolders": []              
-      },
-      {
-        "name": "static",
-        "files": [],
-        "subFolders": []              
-      }
-    ]
-  }
+  "name": "vue-nuxt",
+  "files": [],
+  "subFolders": [
+    {
+      "name": "components",
+      "files": [],
+      "subFolders": []              
+    },
+    {
+      "name": "pages",
+      "files": [],
+      "subFolders": []              
+    },
+    {
+      "name": "static",
+      "files": [],
+      "subFolders": []              
+    }
+  ]
 }
\ No newline at end of file
diff --git a/packages/teleport-project-packer-playground/__tests__/index.ts b/packages/teleport-project-packer-playground/__tests__/index.ts
index b93d04ee..d6ae5288 100644
--- a/packages/teleport-project-packer-playground/__tests__/index.ts
+++ b/packages/teleport-project-packer-playground/__tests__/index.ts
@@ -47,13 +47,6 @@ describe('project packer playground', () => {
     expect(packer.pack).toBeDefined()
   })
 
-  it('should load template', async () => {
-    const packer = createPlaygroundPacker()
-    const { success, payload } = await packer.loadTemplate(reactNextVariation.template)
-    expect(success).toBeTruthy()
-    expect(payload).toBe(reactNextVariation.template.templateFolder)
-  })
-
   it('should pack react basic project', async () => {
     const packer = createPlaygroundPacker()
     const factoryParams: PackerFactoryParams = JSON.parse(JSON.stringify(reactBasicVariation))
diff --git a/packages/teleport-project-packer-playground/__tests__/react-basic-variation.json b/packages/teleport-project-packer-playground/__tests__/react-basic-variation.json
index 58f7fcba..5babcf7d 100644
--- a/packages/teleport-project-packer-playground/__tests__/react-basic-variation.json
+++ b/packages/teleport-project-packer-playground/__tests__/react-basic-variation.json
@@ -6,39 +6,37 @@
     "type": "Disk"
   },
   "template": {
-    "templateFolder": {
-      "name": "react-basic",
-      "files": [],
-      "subFolders": [
-        {
-          "name": "src",
-          "files": [],
-          "subFolders": [
-            {
-              "name": "components",
-              "files": [],
-              "subFolders": []              
-            },
-            {
-              "name": "pages",
-              "files": [],
-              "subFolders": []              
-            },
-            {
-              "name": "static",
-              "files": [],
-              "subFolders": []              
-            }
-          ]
-        }
-      ]
-    },
-    "meta": {
-      "componentsPath": [
-        "components",
-        "playground-components"
-      ]
-    }
+    "name": "react-basic",
+    "files": [],
+    "subFolders": [
+      {
+        "name": "src",
+        "files": [],
+        "subFolders": [
+          {
+            "name": "components",
+            "files": [],
+            "subFolders": []              
+          },
+          {
+            "name": "pages",
+            "files": [],
+            "subFolders": []              
+          },
+          {
+            "name": "static",
+            "files": [],
+            "subFolders": []              
+          }
+        ]
+      }
+    ]
+  },
+  "structure": {
+    "componentsPath": [
+      "components",
+      "playground-components"
+    ]
   },
   "assets": {}
 }
\ No newline at end of file
diff --git a/packages/teleport-project-packer-playground/__tests__/react-next-variation.json b/packages/teleport-project-packer-playground/__tests__/react-next-variation.json
index 60c77d88..2c13578e 100644
--- a/packages/teleport-project-packer-playground/__tests__/react-next-variation.json
+++ b/packages/teleport-project-packer-playground/__tests__/react-next-variation.json
@@ -9,33 +9,31 @@
     "type": "Disk"
   },
   "template": {
-    "templateFolder": {
-      "name": "react-next",
-      "files": [],
-      "subFolders": [
-        {
-          "name": "components",
-          "files": [],
-          "subFolders": []              
-        },
-        {
-          "name": "pages",
-          "files": [],
-          "subFolders": []              
-        },
-        {
-          "name": "static",
-          "files": [],
-          "subFolders": []              
-        }
-      ]
-    },
-    "meta": {
-      "componentsPath": [
-        "components",
-        "playground-components"
-      ]
-    }
+    "name": "react-next",
+    "files": [],
+    "subFolders": [
+      {
+        "name": "components",
+        "files": [],
+        "subFolders": []              
+      },
+      {
+        "name": "pages",
+        "files": [],
+        "subFolders": []              
+      },
+      {
+        "name": "static",
+        "files": [],
+        "subFolders": []              
+      }
+    ]
+  },
+  "structure": {
+    "componentsPath": [
+      "components",
+      "playground-components"
+    ]
   },
   "assets": {}
 }
\ No newline at end of file
diff --git a/packages/teleport-project-packer-playground/__tests__/vue-basic-variation.json b/packages/teleport-project-packer-playground/__tests__/vue-basic-variation.json
index edb1dce5..c14b7e40 100644
--- a/packages/teleport-project-packer-playground/__tests__/vue-basic-variation.json
+++ b/packages/teleport-project-packer-playground/__tests__/vue-basic-variation.json
@@ -6,40 +6,38 @@
     "type": "Disk"
   },
   "template": {
-    "templateFolder": {
-      "name": "vue-basic",
-      "files": [],
-      "subFolders": [
-        {
-          "name": "src",
-          "files": [],
-          "subFolders": [
-            {
-              "name": "components",
-              "files": [],
-              "subFolders": []              
-            },
-            {
-              "name": "views",
-              "files": [],
-              "subFolders": []              
-            },
-            {
-              "name": "public",
-              "files": [],
-              "subFolders": []              
-            }
-          ]
-        }
-      ]
-    },
-    "meta": {
-      "componentsPath": [
-        "src",
-        "components",
-        "playground-components"
-      ]
-    }
+    "name": "vue-basic",
+    "files": [],
+    "subFolders": [
+      {
+        "name": "src",
+        "files": [],
+        "subFolders": [
+          {
+            "name": "components",
+            "files": [],
+            "subFolders": []              
+          },
+          {
+            "name": "views",
+            "files": [],
+            "subFolders": []              
+          },
+          {
+            "name": "public",
+            "files": [],
+            "subFolders": []              
+          }
+        ]
+      }
+    ]
+  },
+  "structure": {
+    "componentsPath": [
+      "src",
+      "components",
+      "playground-components"
+    ]
   },
   "assets": {}
 }
\ No newline at end of file
diff --git a/packages/teleport-project-packer-playground/__tests__/vue-nuxt-variation.json b/packages/teleport-project-packer-playground/__tests__/vue-nuxt-variation.json
index 70d07800..d14b7819 100644
--- a/packages/teleport-project-packer-playground/__tests__/vue-nuxt-variation.json
+++ b/packages/teleport-project-packer-playground/__tests__/vue-nuxt-variation.json
@@ -6,33 +6,31 @@
     "type": "Disk"
   },
   "template": {
-    "templateFolder": {
-      "name": "vue-nuxt",
-      "files": [],
-      "subFolders": [
-        {
-          "name": "components",
-          "files": [],
-          "subFolders": []              
-        },
-        {
-          "name": "pages",
-          "files": [],
-          "subFolders": []              
-        },
-        {
-          "name": "static",
-          "files": [],
-          "subFolders": []              
-        }
-      ]
-    },
-    "meta": {
-      "componentsPath": [
-        "components",
-        "playground-components"
-      ]
-    }
+    "name": "vue-nuxt",
+    "files": [],
+    "subFolders": [
+      {
+        "name": "components",
+        "files": [],
+        "subFolders": []              
+      },
+      {
+        "name": "pages",
+        "files": [],
+        "subFolders": []              
+      },
+      {
+        "name": "static",
+        "files": [],
+        "subFolders": []              
+      }
+    ]
+  },
+  "structure": {
+    "componentsPath": [
+      "components",
+      "playground-components"
+    ]
   },
   "assets": {}
 }
\ No newline at end of file
diff --git a/packages/teleport-project-packer-test/src/constants.ts b/packages/teleport-project-packer-test/src/constants.ts
new file mode 100644
index 00000000..ed69f5a2
--- /dev/null
+++ b/packages/teleport-project-packer-test/src/constants.ts
@@ -0,0 +1,9 @@
+export const GITHUB_TEMPLATE_OWNER = 'teleporthq'
+
+export const REACT_BASIC_GITHUB_PROJECT = 'teleport-project-template-react-basic'
+
+export const REACT_NEXT_GITHUB_PROJECT = 'teleport-project-template-react-next'
+
+export const VUE_GITHUB_PROJECT = 'teleport-project-template-vue-basic'
+
+export const VUE_NUXT_GITHUB_PROJECT = 'teleport-project-template-vue-nuxt'
diff --git a/packages/teleport-project-packer-test/src/index.ts b/packages/teleport-project-packer-test/src/index.ts
index 3bdf65be..d5b5b243 100644
--- a/packages/teleport-project-packer-test/src/index.ts
+++ b/packages/teleport-project-packer-test/src/index.ts
@@ -6,7 +6,15 @@ import vueGenerator from '@teleporthq/teleport-project-generator-vue-basic'
 import vueNuxtGenerator from '@teleporthq/teleport-project-generator-vue-nuxt'
 
 import { createDiskPublisher } from '@teleporthq/teleport-publisher-disk'
-import { ProjectUIDL } from '@teleporthq/teleport-types'
+import { ProjectUIDL, RemoteTemplateDefinition } from '@teleporthq/teleport-types'
+
+import {
+  GITHUB_TEMPLATE_OWNER,
+  REACT_BASIC_GITHUB_PROJECT,
+  REACT_NEXT_GITHUB_PROJECT,
+  VUE_GITHUB_PROJECT,
+  VUE_NUXT_GITHUB_PROJECT,
+} from './constants'
 
 import projectUIDL from '../../../examples/uidl-samples/project.json'
 
@@ -17,13 +25,32 @@ const generators = {
   'vue-nuxt': vueNuxtGenerator,
 }
 
+const getGithubRemoteDefinition = (username: string, repo: string): RemoteTemplateDefinition => {
+  return { username, repo, provider: 'github' }
+}
+
+const templates = {
+  'react-basic': getGithubRemoteDefinition(GITHUB_TEMPLATE_OWNER, REACT_BASIC_GITHUB_PROJECT),
+  'react-next': getGithubRemoteDefinition(GITHUB_TEMPLATE_OWNER, REACT_NEXT_GITHUB_PROJECT),
+  'vue-basic': getGithubRemoteDefinition(GITHUB_TEMPLATE_OWNER, VUE_GITHUB_PROJECT),
+  'vue-nuxt': getGithubRemoteDefinition(GITHUB_TEMPLATE_OWNER, VUE_NUXT_GITHUB_PROJECT),
+}
+
 const publisher = createDiskPublisher({
   outputPath: 'dist',
 })
 
 const packProject = async (projectType: string) => {
+  const remoteTemplate = templates[projectType] as RemoteTemplateDefinition
+
+  // fill in with your github token - https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
+  remoteTemplate.auth = {
+    token: '<your-token-here>',
+  }
+
   projectPacker.setPublisher(publisher)
   projectPacker.setGeneratorFunction(generators[projectType].generateProject)
+  await projectPacker.loadTemplate(remoteTemplate)
 
   const result = await projectPacker.pack(projectUIDL as ProjectUIDL)
 
@@ -31,10 +58,14 @@ const packProject = async (projectType: string) => {
 }
 
 const run = async () => {
-  await packProject('react-basic')
-  await packProject('react-next')
-  await packProject('vue-basic')
-  await packProject('vue-nuxt')
+  try {
+    await packProject('react-basic')
+    await packProject('react-next')
+    await packProject('vue-basic')
+    await packProject('vue-nuxt')
+  } catch (e) {
+    console.info(e)
+  }
 }
 
 run()
diff --git a/packages/teleport-project-packer/__tests__/index.ts b/packages/teleport-project-packer/__tests__/index.ts
index 84980a44..aaac4c72 100644
--- a/packages/teleport-project-packer/__tests__/index.ts
+++ b/packages/teleport-project-packer/__tests__/index.ts
@@ -9,7 +9,6 @@ import templateDefinition from './template-definition.json'
 import {
   ProjectUIDL,
   AssetsDefinition,
-  TemplateDefinition,
   Publisher,
   ProjectGeneratorOutput,
   GeneratedFolder,
@@ -17,11 +16,7 @@ import {
 } from '@teleporthq/teleport-types'
 
 import { createProjectPacker } from '../src'
-import {
-  NO_REMOTE_TEMPLATE_PROVIDED,
-  NO_GENERATOR_FUNCTION_PROVIDED,
-  NO_PUBLISHER_PROVIDED,
-} from '../src/errors'
+import { NO_GENERATOR_FUNCTION_PROVIDED, NO_PUBLISHER_PROVIDED } from '../src/errors'
 import { DEFAULT_TEMPLATE } from '../src/constants'
 
 const assetFile = readFileSync(join(__dirname, 'asset.png'))
@@ -52,7 +47,7 @@ describe('teleport generic project packer', () => {
     const packer = createProjectPacker()
 
     const assets: AssetsDefinition = { assets: [] }
-    const template: TemplateDefinition = {}
+    const template: GeneratedFolder = DEFAULT_TEMPLATE
     const publisher = createDummyPublisher()
 
     expect(() => packer.setAssets(assets)).not.toThrow()
@@ -60,39 +55,12 @@ describe('teleport generic project packer', () => {
     expect(() => packer.setPublisher(publisher)).not.toThrow()
   })
 
-  it('should load default template if no template definition is provided', async () => {
-    const packer = createProjectPacker()
-
-    const { success, payload } = await packer.loadTemplate()
-    expect(success).toBeTruthy()
-    expect(JSON.stringify(payload)).toBe(JSON.stringify(DEFAULT_TEMPLATE.templateFolder))
-  })
-
-  it('should load template if template folder is described in the definition', async () => {
-    const packer = createProjectPacker({
-      template: templateDefinition,
-    })
-
-    const { success, payload } = await packer.loadTemplate()
-    expect(success).toBeTruthy()
-    expect(JSON.stringify(payload)).toBe(JSON.stringify(templateDefinition.templateFolder))
-  })
-
-  it('should fail to load template if no folder or remote meta is described in the definition', async () => {
-    const packer = createProjectPacker({
-      template: {},
-    })
-
-    const { success, payload } = await packer.loadTemplate()
-    expect(success).toBeFalsy()
-    expect(payload).toBe(NO_REMOTE_TEMPLATE_PROVIDED)
-  })
-
   it('should fail to pack if no generator function is provided', async () => {
     const packer = createProjectPacker()
 
     const { success, payload } = await packer.pack(projectJson as ProjectUIDL, {
       template: templateDefinition,
+      remoteTemplateDefinition: { provider: 'github', username: 'test', repo: 'test' },
     })
     expect(success).toBeFalsy()
     expect(payload).toBe(NO_GENERATOR_FUNCTION_PROVIDED)
@@ -134,6 +102,33 @@ describe('teleport generic project packer', () => {
     expect(project.files[1].name).toBe('template')
     expect(project.files[1].content).toBeDefined()
   })
+
+  it('takes the templateFolder with priority over the remote template definitions', async () => {
+    const publisher = createDummyPublisher()
+    const packer = createProjectPacker({
+      publisher,
+      generatorFunction: dummyGeneratorFunction,
+      assets: assetsData,
+    })
+
+    const { success, payload } = await packer.pack(projectJson as ProjectUIDL, {
+      template: templateDefinition,
+    })
+    expect(success).toBeTruthy()
+
+    const { project } = payload
+    const assetsFolder = project.subFolders.find((subFolder) => {
+      return subFolder.name === 'static'
+    })
+
+    expect(assetsFolder.files[0]).toBeDefined()
+
+    expect(project.files[0].name).toBe('uidl')
+    expect(project.files[0].content).toBeDefined()
+
+    expect(project.files[1].name).toBe('template')
+    expect(project.files[1].content).toBeDefined()
+  })
 })
 
 const createDummyPublisher = (): Publisher<ProjectUIDL, string> => {
@@ -155,7 +150,7 @@ const createDummyPublisher = (): Publisher<ProjectUIDL, string> => {
 
 const dummyGeneratorFunction = async (
   uidl: ProjectUIDL,
-  template: TemplateDefinition
+  template: GeneratedFolder
 ): Promise<ProjectGeneratorOutput> => {
   const uidlFile: GeneratedFile = {
     name: 'uidl',
@@ -169,8 +164,8 @@ const dummyGeneratorFunction = async (
     content: JSON.stringify(template),
   }
 
-  template.templateFolder.files.push(uidlFile)
-  template.templateFolder.files.push(templateFile)
+  template.files.push(uidlFile)
+  template.files.push(templateFile)
 
-  return { assetsPath: 'static', outputFolder: template.templateFolder }
+  return { assetsPath: 'static', outputFolder: template }
 }
diff --git a/packages/teleport-project-packer/__tests__/template-definition.json b/packages/teleport-project-packer/__tests__/template-definition.json
index 61c56c58..54cd783b 100644
--- a/packages/teleport-project-packer/__tests__/template-definition.json
+++ b/packages/teleport-project-packer/__tests__/template-definition.json
@@ -1,23 +1,21 @@
 {
-  "templateFolder": {
-    "name": "react-next",
-    "files": [],
-    "subFolders": [
-      {
-        "name": "components",
-        "files": [],
-        "subFolders": []              
-      },
-      {
-        "name": "pages",
-        "files": [],
-        "subFolders": []              
-      },
-      {
-        "name": "static",
-        "files": [],
-        "subFolders": []              
-      }
-    ]
-  }
+  "name": "react-next",
+  "files": [],
+  "subFolders": [
+    {
+      "name": "components",
+      "files": [],
+      "subFolders": []              
+    },
+    {
+      "name": "pages",
+      "files": [],
+      "subFolders": []              
+    },
+    {
+      "name": "static",
+      "files": [],
+      "subFolders": []              
+    }
+  ]
 }
\ No newline at end of file