A common complaint I hear about hack days, and development in general is that there is far too much up front investment in boilerplate infrastructure.
To get a simple React app running you need to spend half the day just getting webpack and babel working, and then you need to work on your API and have to pick a framework.
This is where Takeoff comes in. It’s a development environment designed for rapid prototyping. To do this it has some opinions.
It’s created using docker containers, and there are some simple npm commands that out of the box give you:
- A Hapi-powered API that uses nodemon to hot reload on any changes. You can simply add a plugin to a whitelist configuration and once the server restarts your API endpoints are available. Also provided is a user creation and authentication component that provides a JSON Web Token for the front end, so you don’t have to build one.
- A React app that comes packed with React Router v4, Redux and hot reloading. Any changes you make are immediately reflected in the front end. The app is set up to allow you to easily add components, and again out of the box there are login/logout components, and a user component that uses scopes and the API middleware provided.
- A Postgres database, out of the box with simple configuration. The Hapi app uses Sequelize to connect, and you can create migrations and models (again in the documentation). This can easily be replaced with MySQL, SQLite or even a different adaptor such as CouchDB.
- A Ngnix server that proxies it all. This means your frontend app is available on http://localhost and the API server on http://localhost/api. You can configure this to add other services upstream.
All of these are behind two commands, npm run build:dev and npm run up:dev. When you build the image you can then start it using the up command. The repository has some documentation to get you going, and more will be added.
The core focus of Takeoff is to have a working project by the end of the day, and for that is makes some choices.
It was inspired by the article Dockerize your app and keep hot-reloading and aims to provide some out-of-the-box tools to make the rapid development part simpler.
One area I’d like to improve is providing more out of the box adaptors, such as different database types. But if you have any better ideas, or would like to contribute to helping improve rapid development please feel free to open an issue.