Documentation

Installation

$ sudo npm install turbo-cli -g

Scaffolding Projects

Turbo scaffolds projects in three ways:

Static Projects

$ turbo new <MY_PROJECT_NAME>
$ cd <MY_PROJECT_NAME>
$ npm install
  • Static projects consist of conventional HTML/CSS/JS.
  • Included in assets are Bootstrap and JQuery.
  • The index.html imports a few Javascript modules: vendor.min.js, turbo.min.js, app.min.js
  • vendor.min.js is a minified bundle of imported Javascript files which can be found in the 'js' task in gulpfile.js
  • turbo.min.js is the Turbo CDN which provides the core functionality of the Turbo platform such as adding users, creating entities, sending emails, adding blog posts, and more.
  • app.min.js is a module with your custom functions. This is initially empty
  • The gulpfile.js config defines the build tasks which concatenate and minify the assets to a 'dist' directory

Add a Page to Static Projects

$ turbo page <PAGE_NAME>
  • This adds a new html document to the project called <PAGE_NAME>.html which includes the standard Turbo JS imports.

React/Redux Projects

$ turbo new <MY_PROJECT_NAME> --react
$ cd <MY_PROJECT_NAME>
$ npm install
  • This scaffolds a project with REACT/REDUX configured
  • The REACT/REDUX source code is in the 'src' directory
  • A webpack.config.js file is included with some basic webpack configuration. Feel free to adjust as needed.

React With Express Projects

$ turbo new <MY_PROJECT_NAME> --express
$ cd <MY_PROJECT_NAME>
$ npm install
  • This scaffolds a project with REACT/REDUX as well as an Express project.
  • The Express project code is under the 'server' directory
  • A webpack.config.js file is included with some basic webpack configuration. Feel free to adjust as needed.
  • Important: projects with Express are meant to be deployed on your own server and are not compliant with Turbo hosting. These projects should be deployed on a services such as AWS, Heroku, Digital Ocean, etc.

Add Express Server to Existing Projects

$ turbo server express
  • This adds an express server to existing projects

General Commands

Run Dev Server

$ turbo devserver
  • This runs a simple Express server and renders the root index.html from http://localhost:3000
  • For static projects, we recommend running the dev server throughout development because it accurately reflects the behavior of your site in deployment.
  • We also recommend running "gulp" in a separate tab. This invokes the build process whenever you make changes to JS or CSS files.
  • The dev server supports relative links for anchor tags. For example, href="/blog" works fine with the dev server running.

Build The Project

$ npm run build
  • This packages the project assets and concatenates/minifies the imports into the 'dist' directory.
  • IMPORTANT: This command should be executed before every deployment because the 'dist' directory gets deployed, NOT the assets
  • The gulpfile.js is where the configuration for the build process is defined. Register your custom assets here to include them in the build sequence.

Link to Turbo Project

$ turbo app <APP_ID>

Deploy to Staging

$ turbo deploy
  • Deploys your site to the Turbo staging environment. The staging URL is accessible on the internet and can be viewed by anyone.
  • When deploying updates, it may take a minute or two for the changes to take effect as we propagate your site to multiple servers
  • IMPORTANT: To deploy, your app must be linked to a Turbo project. To create a Turbo project, see here: https://www.turbo360.co/create
  • IMPORTANT: It is best practice to run "$ npm run build" before deploying in order to package assets and minify imports.

Deploy to Production

$ turbo deploy --prod
  • Deploys your site to the Turbo production environment. IMPORTANT: The production URL is NOT accessible on the internet and must be forwarded from a CNAME record in your DNS provider.
  • When deploying updates, it may take a minute or two for the changes to take effect as we propagate your site to multiple servers
  • IMPORTANT: To deploy, your app must be linked to a Turbo project. To create a Turbo project, see here: https://www.turbo360.co/create
  • IMPORTANT: It is best practice to run "$ npm run build" before deploying in order to package assets and minify imports.

Questions/Comments

If you have any questions, comments or feedback, feel free to contact us at matthew@turbo360.co