Want to try fastn for your company's website?
Book a Demo

Hello World

In this part we will install fastn on your machine and create a hello world fastn program.

The name of package manager for fastn language is fastn.

We will begin by installing fastn on your machine. Install fastn.

You can open installation page in a new tab, and follow the instructions. You can continue this course after installing fastn.

Let's create our Hello World program

Let's create a fastn package and start coding Hello World.
ℹ️
What is fastn package?

fastn package is a folder that requires atleast two files

  • FASTN.ftd
  • index.ftd
There can be any number of .ftd file but these two files are essential.

Create a new folder and rename it as expander, anywhere in your machine. Let's say in your Desktop folder.

Open the newly created folder in any text editor. We recommend Sublime Text or VS Code for working with FTD.

Open the folder and add two new files, FASTN.ftd and index.ftd to create the fastn package.

FASTN.ftd

It is a special file which keeps package configuration related data like

  • package name
  • package dependencies
  • sitemap, etc
Import the special library, fastn
Import fastn
-- import: fastn
Lang:
ftd
Then, we create a new fastn package after giving line-space
Create a fastn package
-- fastn.package: <project-name>
Lang:
ftd

index.ftd

To print Hello World, we are using ftd.text section
Code
-- ftd.text: Hello World
Lang:
ftd

Create a local server and run the URL in the web-browser to see the text displayed.

Make sure that the directory points to the expander folder you created.
Terminal command to create local server
fastn serve
Lang:
ftd

Using just one line code, we displayed the Hello Worlds.

You have successfully completed the Part 1.

Continue with the part 2 now.