2. Initializing The Template
Algokit Init
To get started, run the following Algokit command to initialize a template:
For this tutorial, I have chosen the name hello_world
for my project, which will be reflected throughout the rest of this content. If you choose a different name, some parts might be different for you.
Template Layout
After the init command finishes, you should have the following directory structure:
If you have experience with web development, most of this should look familiar. Below are the key directory and files
test/
hello_world.test.ts
hello_world.test.ts
is a test for our contract written with Jest. This tutorial won’t go too in-depth into testing, but it is a good example on how client-side contract interaction works
contracts/
hello_world.algo.ts
hello_world.algo.ts
is the most important file in the template. This is where our contract logic is defined. You might notice that this file has a .ts
extension, but also an .algo.ts
. The .algo.
is there solely to help tools like ESLint and TypeScript differentiate between regular TypeScript files and TEALScript files. The TEALScript compiler does not require the .algo.ts
extension but it is highly recommended to use. Any files without .algo.ts
extension in this template may be mistaken for TypeScript files that should be compiled into JavaScript (instead of TEAL), which may cause errors.
artifacts/
artifacts/
is the directory where all the files generated by the TEALScript compiler and algokit will go. We will go further in-depth on these artifacts in the next step of this tutorial.