Images, icons & files

What are the Private and Functions folders?

What are the Private and Functions folders?

The Private and Functions folders in the TeleportHQ Assets Manager are for developer files, not for images on your pages. The Private folder holds text files, such as a next.config.js, that are added to the top folder of your generated project when you publish or export. You show it with the Private Folder switch in Project settings → Editor → Preferences → Advanced features. The Functions folder holds .js files that run as server functions once your project is published.

The Private folder

The TeleportHQ Private folder is a place for configuration files and build scripts that your generated project needs. In the app's words, it "Contains sensitive information, such as configuration files or build scripts, which are essential for the project's development." Despite that wording, the Private folder doesn't hide or protect its files.

  • It accepts text files only: txt, xml, json, js, css, env, yml and yaml.
  • It can't contain folders.
  • When you publish or download your code, its files are added to the top folder of the generated project, next to files such as package.json. Files in Public go to the site's public files instead.

Show the Private folder

  1. In the TeleportHQ editor, at the bottom of the left sidebar, click the Project settings cog.
  2. In the Project settings panel, under Editor, click Preferences.
  3. In the drawer, click Advanced features.
  4. Click the switch next to Private Folder. It turns on and saves at once; there's no Save button.
The Private Folder switch in the TeleportHQ Advanced features settings, switched off

The Private folder now appears above Functions in the Assets Manager's Uploads tab. See How to turn on Advanced Features.

Add a file to the Private folder

  1. In the left sidebar, click Assets Manager, then Uploads.
  2. On the Private folder's row, click + (tooltip Upload asset).
  3. Pick your file, for example next.config.js.
  4. A Private files window warns: "Be careful, uploading incompatible or broken private files can potentially break the publication." Click Close. To stop seeing the warning, tick Don't show this again first.

To change a Private file later, right-click it and choose Edit. See How to edit uploaded text files.

The Functions folder

The TeleportHQ Functions folder holds JavaScript files that run on the server after your project is deployed. The app describes it as handling "Next.js cloud functions that run post-deployment, enabling dynamic server-side processes for your application." This is a feature for developers.

  • It takes .js files, and it can't contain folders. It's always shown in the Uploads tab, above Public.
  • To add a function, click + on the Functions folder's row (tooltip Upload asset) and pick your file, for example send-order.js.
  • When you publish, or download your project as Next.js code, each file becomes an API route: send-order.js answers at /api/send-order. Other code formats, such as HTML, leave the Functions folder out.
  • If a function imports an npm package, TeleportHQ adds that package to the project's dependencies.
  • After you publish to a TeleportHQ address, right-click a function file and choose Copy Function Link to Clipboard to copy its address. The option is greyed out until the project has been published to a TeleportHQ address.
The Functions folder in the TeleportHQ Uploads tab, with its + (Upload asset) button highlighted

Troubleshooting

"You can only upload text type files to the private folder (.txt, .xml, .yaml, .js, .json, .css, ...)" You uploaded another type of file, such as an image. It was removed from the Private folder. Upload images to Public instead.

"Error occurred while publishing" with "We noticed that you have added private files, which could be causing the error." A file in the Private folder may be breaking the build. Click Publish without private files to publish without them, then check and fix the file. See Publishing failed: what should I do?

Copy Function Link to Clipboard is greyed out The project hasn't been published to a TeleportHQ address yet. Publish it, then try again. See How to publish your site.

Good to know

  • The Public folder holds everything you use on your pages or offer for download.
  • Turning Private Folder off only hides the folder in the Assets Manager. The files in it are still added when you publish or download your code. To leave them out, delete them. See How to rename or delete files (and remove unused ones).
  • Point at the Private, Functions or Public folder name and its info icon to read what the folder is for.
Share

Related Articles

How to turn on Advanced Features

In the TeleportHQ editor, click the Project settings cog at the bottom of the left sidebar, open Editor → Preferences → Advanced features and flip the switch next to a feature; each switch saves at once, and there are five features, including Advanced Embeds and Private Folder.

How to edit uploaded text files

In the TeleportHQ Assets Manager, right-click an uploaded text file (txt, xml, json, js, css, env, yml or yaml) and choose Edit to change it in a code editor, then click Save; the file is updated in place, so its link keeps working and you don't upload it again.

How to keep passwords and API keys safe (Secrets)

TeleportHQ stores passwords, tokens and API keys as project Secrets, which the project owner manages in Project settings → Data & code → Secrets and links to credential fields with the plug button, instead of typing the value into each data source.

Publishing failed: what should I do?

When publishing a TeleportHQ site fails, the message names the reason - a build error (read the Build Logs in the Deployments tab), a page, component or style the code can't use, a plan limit such as forms, language slots or a Web App slot, a workflow security problem, private files, or a temporary error you can retry - and your live site stays as it was.

How to link to a file so visitors can download it

To let visitors open or download a file such as a PDF menu from your TeleportHQ site, upload it in the Assets Manager, right-click it and choose Copy Asset Link to Clipboard, then select a button, add a link and paste the address in the URL tab.

How to download your site as code (React, Next.js, Vue, HTML and more)

On a paid TeleportHQ plan (Pro or Premium), click Code at the top right of the editor, open the Download tab, pick a format such as HTML, React or Next and click Download ZIP to save your website's source code; a trial can't download code and web apps can't be downloaded.