Time to Complete
This guide should take you 10 minutes to complete.
It's easy to build a GraphQL API using TakeShape. Follow along with our quickstart guide to set up a project and call it from your application.
Start by creating a free account. TakeShape is free up to 10k monthly API requests, so you can try out or even build a basic application risk-free. After you pass 10k monthly requests, you'll simply be charged based on your usage.
While you don't need to provide a credit card to use TakeShape, we recommend adding a credit card to any projects in production to avoid any potential service interruptions when you exceed the free limit. You can add a credit card in your project's billing settings.
Next, we'll create a blank project. For our
Source, we'll select "Blank Project". Let's name our new project "Travel Blog".
After you create the project, you'll be taken to your project's dashboard. It offers quick access to the steps you'll need to finish setting up your project, which are the same as you'll find in this guide. We encourage you to stick with this guide for now, but know that the dashboard will always be there for you for future projects!
In the first step on the dashboard, click on the "Connect Service" link to add a new service. From the grid of available services, select the "GraphQL" provider. In the following form, fill in details for the public Countries GraphQL API:
Once the service is configured, save it. TakeShape will then examine the service you connected and suggest queries and mutations from that service to add to your API. Go ahead and select the
Countries_country query, which will return details of a specific country.
After selecting your query and selecting "Save", you'll see your schema now includes the query and all the remote shapes it depends upon:
These shapes are added since they're all returned by the
Countries_country query, and they all have the
Countries namespace since they belong to the service.
Now it's time to test your new API! Use the API tab to switch over to the API Explorer. Paste in this query and click the "Run" button:
In the response, you'll get back information about Japan, along with some analytics about your query's performance. Open up the bottom Debugger panel to see more detail about how your requests perform.
Finally, it's time to call your API from your local machine!
Here's the command:
You'll see that there's two pieces of data you need
The first thing you'll want to do is create a
.env file in your project that includes the secrets
When you're in your project in the TakeShape web client, you can find your project's endpoint in the sidebar of the API tab.
You can create an API Key from within the API tab. Pick the
dev permission for your key, then save it. After saving, you'll be presented with a one-time secret string. Copy it into your
Once you've got your secrets, install some libraries to help make your request:
Now, querying TakeShape is as simple as making a network request:
Run this file with
node takeshape.client.js and you'll see it return your data!
Join TakeShape's community Slack group to meet other TakeShape users, share your projects, and get personal support from the TakeShape team!
We've built a gallery of starter projects using different static site generators, application frameworks, and connected services to help kickstart your next Jamstack project. Check out their repos, reference the code, and use them as the starting point for building on your own.