A CLI to generate an example full-stack application to speed up your learning and development
To make building with Duffel even easier, we offer a command-line interface for generating a full-stack application with Duffel's SDK integrated along with a simple flight booking example (See supported frameworks/languages for the available options).
To use this tool, make sure you have either yarn or npm installed, then run the following command:
Shell (using yarn)
yarn create duffel-app
You will be guided through selecting the front end and back end language/framework, and finally inputting your Duffel access token which can be found on your tokens page on the Duffel dashboard. Only test tokens are allowed to ensure that real orders won't be booked accidentally (you can change this later on if you wish).
After that, the tool will create your app folder with two folders inside: client and server. Simply start the server by going inside the server directory and following the instructions. Then finally, you can run yarn start from within the client folder. Your browser will open http://localhost:3000 once that's done.
This is what you will see after starting the client
The page contains a working flight booking example that you can play around with. As this example uses the Duffel API, the orders created through this will be visible on your orders page.
Within the code, you will be able to see how the Duffel API endpoints are used in combination to create an order. You can also evolve the example further to explore more of Duffel's capabilities. The sky is the limit!
We have kept the example application relatively simple to make it easier to learn and play around with. This will not be suitable for production out of the box.
We highly recommend using a test token for this example application. Using the live token will mean that any orders made within this example application will end up making real orders to the airlines.
The Duffel access token you use during the initial setup will be written to the files under the env folder under DUFFEL_ACCESS_TOKEN variable. You can manually change this if you wish to use another token.