Skip to main content

Installation

This document will walk you through the process of installing Subjektify in your project. By the end of this guide, you will have the necessary tools installed to begin developing decentralized applications (dApps) within the Web3 ecosystem.

Prerequisites​

Before you begin the installation process, ensure your system meets the following requirements:

  • Node.js: Subjektify requires Node.js to run. Install the latest LTS version of Node.js from Node.js official website.
  • Git: You will need Git for version control and to clone repositories. Download it from Git's official site.
  • A Text Editor: We recommend using Visual Studio Code for a streamlined development experience. Download it from Visual Studio Code's website.

Scaffold a New Namespace​

To start a new Subjektify project, run the following command in your project directory:

npx subjektify init

This command initializes a new project with the required configuration files and directory structure within your project's directory. The interactive CLI will provide you with various namespace templates, or just the configuration file

Project Structure​

Understanding the project structure generated by Subjektify is crucial for efficient development. Here is a breakdown of the key directories:

my.namespace
β”œβ”€β”€ subjects
β”‚ β”œβ”€β”€ universe.subjekt
β”œβ”€β”€ subjektify.config.(js|ts)
β”œβ”€β”€ package.json
└── README.md

Directory and File Details​

  • subjects/: This directory contains files defining the subjects in your project, using the Subjekt Interface Definition Language (Subjekt IDL). These files help in modeling the data and behavior of your dApp.
  • subjektify.config.(js|ts): The main configuration file for your Subjektify project. It specifies how the project should be built and run, including configurations for plugins and other settings.
  • package.json: Manages npm package dependencies for your project. It includes scripts and dependencies necessary for building and running your application.
  • README.md: A markdown file providing a basic introduction to your project, setup instructions, and other essential information.

Building the Subjekt model​

To build your subjekt model, which can be used from within the SubjektifyRuntimeEnvironment, run:

npx subjektify build

This command will build the Subjekt model and write the JSON abstract syntax tree in the defined outputDirectory.

Generate code​

Generate necessary client-side libraries or smart contracts using Subjektify’s code generation tool:

npx subjektify codegen

This will build your Subjekt model to produce interoperable code that can be used in your dApp frontend or blockchain.

Versioning​

Managing versions within Subjektify is straightforward. Update your subjektify.config.(js|ts) to reflect new versions as you iterate your namespace:

{
"version": "1.0.1"
}

Each version update should correspond to the standards defined in Semantic Versioning.

Your next steps would be configuring your Subjekty's namespace to fully extend and tailor your decentralized application to your needs.