node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »

@takeoff/takeoff

Takeoff Rapid Development Toolkit

Takeoff is a toolkit for rapid development and prototyping applications.

Takeoff itself is a command line tool installed via npm and has a command line interface for creating and managing Takeoff environments. Environments are created based on Blueprints.

Install Takeoff

Installing takeoff is simple, via NPM.

npm install -g @takeoff/takeoff
takeoff init <myenv>
cd <myenv>
takeoff start # This starts the default environment container in `envs/default` 

To see how this all works, it's all explained below.

It starts with a blueprint

Blueprints are repositories with some batteries included applications and configurations for containers. Takeoff uses these to build a full working environment in minutes. A blueprint generally contains a backend component, a frontend, a database and an ingress server.

Currently Takeoff only ships with the default blueprint (but it's relativly easy to create new ones!) called takeoff-blueprint-basic and it provides:

  • A node 8 API server powered by Hapi. Using node 8 allows the use of async/await to make code more readable. Included in the application is a User system for username/password login and basic user management, 2 levels (admin and user - and easily extendible). There is also a JSON Web Token (JWT) authentication system that gives you control over access to your API endpoints.

  • A React Frontend with React Router V4, Redux and ReactStrap (Bootstrap 4). The frontend comes with a basic Dashboard layout and homepage. A login page with some basic validation allows you to log in (the default login is admin/password Do not expect this to be a fully secure environment). Once logged in you have a basic user CRUD application to manage users, and a navigation bar that you can customise.

Disclaimer: If you build an app with this you wish you deploy, you are responsible for your own security.

  • A Postgres 9 database. Within the Hapi application, Sequelize is used as the database connection and ORM. Here we can use this to create migrations and seeds, as well as create simple or complex model types as you like. The postgres also comes with a simple configuration file.

  • A Nginx ingress server, by default running on port 80 (which means you get http://localhost or http:// as your address. If you cannot run on port 80, it can be configured in the docker-compose.yml by changing the first number of the pair (e.g "8080:80")

Under the hood is uses docker and docker-compose to minimise the hassle out of setting up frontend, backend and database servers (support for minikube is coming soon).

The best part though is of course kept till last.

Using Docker volumes, the development files for the applications sit on your local computer file system, however the applications run within docker and hot reload on changes. This means you can switch between your code and browser in seconds and see the changes and not have to worry about manually compiling before seeing your changes. On the server side this is accomplished with nodemon and on the clientside with webpack using hot reloading, so in most cases you don't need to refresh the browser at all.

If you ever get disconnected from your docker sessions afer starting them up, you can type takeoff start again and you will reconnect to see any log output.

Why Takeoff?

Takeoff is designed to cut out those first few crucial hours where you are setting up your project environment, such as babel and webpack configurations, user authentication or even just selecting a framework. It's perfect for hackdays, rapid prototypes, teaching new coders by having a pre-configured environment in just 4 simple commands.

It cut out the scary/annoying bit and gets right to the fun bit!

Open Source Sponsorship

Takeoff is provided as-is for free via Open Source. If you find Takeoff useful then please click below to help support with basic costs such as the domain name.

Sponsor

System Dependencies

This software has some dependencies, and currently has only been fully tested on Linux using Docker Community Edition.

First install this, Once installed you will have the docker and docker-compose commands. You also need git and node >= 8.4.0.

Up and running

You should now have a server running at http://localhost. You can access the API via http://localhost/api.

After installing, you will this folder structure in your Takeoff environment

    -|
     |- blueprints/basic # The basic blueprint that Takeoff ships 
     |- envs/default # The default environment installed 
        |- env # Folders with the source code you can change 
            |- api # This is the Hapi API Server 
            |- app # This is the frontend app 
            |- nginx # Nginx configuration 
            |- db # Postgres DB config 
        |- docker # This is where all the docker configurations are kept 
            |- docker-compose.yml # The glue file for your services 
            |- api # This is the Hapi API Server 
            |- app # This is the frontend app 
            |- nginx # Nginx configuration 
            |- db # Postgres DB config 

Blueprint Cache

When you install a new blueprint, it is cached in the blueprints folder; this way when you create a new environment below it uses your local copy. If you want to update a blueprint, for now go into the folder and type git pull origin master. A command will be coming for this soon.

Creating new environments

Unofficially there are two blueprints:

  • The default blueprint (takeoff-blueprint-basic is installed as the default environment in the env folder and basic in the blueprints folder.

When you want to create a new environment you can type:

    takeoff new <environment>
    takeoff start <environment>

This will start up your new named environment using the basic blueprint. Make sure you have stopped any other environments running unless you have changed ingress port assignments.

There is also a Wordpress Blueprint, you can find out more about installing it via it's documentation (it may currently be broken, and I want to make this into a more general PHP blueprint anyway).

Platform Support

Currently only Linux is fully tested and supported out the box, but support for other OS is coming (testers and contributors welcome!). There is a page for Windows Users to provide extra information in the quest to get it working.

Documentation

References