First Steps
Starting
This guide will walk you through setting up your Blok development environment and creating your first blok-based application. We aim to get you up and running as quickly as possible.
Prerequisites
Before you begin, ensure you have the following installed on your system:
- Node.js: Blok is built on Node.js. We recommend using the latest LTS version. You can download it from nodejs.org.
- npm (or yarn): npm is included with Node.js. If you prefer yarn, ensure it is installed.
Installation
The primary way to interact with Blok and manage your projects is through our Command Line Interface (CLI), nanoctl
.
You don’t need to install nanoctl
globally to start. You can use npx
to run the latest version directly:
Creating Your First Project
Let’s create a new Blok project. Open your terminal and run:
The CLI will guide you through the project creation process with an interactive interface:
This will create a new directory with the name you provided, containing a fully configured Blok project.
Project Structure
After creating a new project, you’ll have a directory structure like this:
Running Your First Application
The newly created project already includes a pre-configured example workflow called countries
that fetches country data from an API. To run it:
-
Navigate to your project directory:
-
Start the development server:
Note that you don’t need to run
npm install
as this is already handled during project creation. -
Open your browser and navigate to:
Or use a tool like curl:
You should receive a JSON response with country data. The name of the workflow file corresponds to the endpoint URL, so countries
is accessible at /countries
.
Next Steps
Now that you have a basic understanding of how to set up and run a Blok project, you can explore further:
- Learn more about Nodes - the building blocks of your application.
- Understand Workflows in more detail.
- Discover how Triggers initiate your workflows.
- Dive into the Context Object for data sharing.
- Explore the available Examples for more complex use cases.
- Deepen your knowledge with the Fundamentals section.
Happy building!