Project Structure

This page describes the various files and folders you will find in a new project, and explains the Foundation project tools.

Project Files and Folders

The 'compiled' Folder

The compiled folder is used to hold all of your game assets, and your compiled game code (JavaScript). You should place your assets (images, audio, and any HTML pages) directly into this folder.

When you compile your project, your Typescript code will be compiled to JavaScript and copied into this folder as the game.js file. Avoid manual editing of the game.js file as any changes you make will be overwritten the next time you compile.

Here you will also find the game.html file which will be used as the main file (entry point) for your build targets and debugging. This file is not overwritten or modified by the compile process, you can safely modify its contents (but not its name).

The 'core' Folder

The core folder contains the compiled Foundation core library against which your project is built. The core's definition file is located in this folder, and can be referenced at core/foundation-core.d.ts.

The 'tools' Folder

A collection of scripts which can be run to perform actions on your project. Available tools are itemized and explained at the bottom of this page.

The 'output' Folder

Your build target outputs will be available in this folder. This folder will not be created until you have performed your first build.

The 'project.json' File

The general configuration file for your project. This file will be auto-generated when you create your project. Configuration options specific to build targets can also be added here. The following is an example of the default file generated for a new project:

  "core": {
    "version": "0.8.0"
  "project": {
    "name": "Your Project Name",
    "description": "Description of your project",
    "author": {
      "name": "Your Name",
      "email": "",
      "href": ""
    "tools": "../../tools",
    "version": "0.1.0",
    "main_files": {
      "desktop": "game.html",
      "mobile" : "game-mobile.html"
  "nwjs": {
    "window": {
      "position": "center",
      "resizable": false,
      "width": 800,
      "height": 480,
      "frame": true,
      "toolbar": false
    "chromium-args": "--force-gpu-rasterization"
  "cordova": {
    "widget": {
      "id": "com.yourDomain.yourApp"
    "plugins": [

The 'tsconfig.json' File

Configuration file used internally to compile your project. Avoid modifying this file.

...and Your Game Code

Last, but most definitely not least, you will place all of your Typescript files in this location (or in custom sub-folders). Avoid adding Typescript files to any of the existing (above-mentioned) folders as the compile process ignores these locations.

Moving a Project Folder

If you want to move an individual project out of the foundation/projects directory you may do so by simply cutting and pasting to a new location. However, you will need to modify the project's project.json file so that the project knows where to find the foundation\tools directory. Find the :project:tools property in the project.json file and update its value with a relative or absolute path to your foundation\tools directory.

Project Tools

To use any of the following project tools, open a terminal / console in a project's directory and run the commands shown below.


Compiles your project and launches it in a stand-alone debugging window. You can access Chrome Developer Tools in this stand-alone window by pressing the F12 key. If you want to relaunch the previous debug build without recompiling, you can add the nocompile argument:

node tools/debug
node tools/debug nocompile


Compiles your game code to the compiled directory (see directory description above).

node tools/compile


Builds your project for one or more specified targets. See Build Targets for more.


Imports a named content bundle. See Content Bundles for more.


If you have moved a project folder to a newer version of Foundation, running this command will update your project's core files and tools. If the current core version of your project and the version you are updating to are known to be incompatible, the update will fail. You can force an update by adding the force argument.

Important: you should ALWAYS keep a backup of your project when updating just in case something goes wrong. The update script will do its best to ensure your update path is safe before proceeding, but accidents do happen.

node tools/update
node tools/update force