๐ Prerequisites
- Node.js 18+
- An asterai account
Overview
Youโll create a simple component that exports a greeting function, then run it locally in an environment.Steps
1. Install the CLI
2. Authenticate
Generate an API key from the console:3. Create a new component
4. Understanding the interface
The scaffoldedcomponent.wit defines a simple interface. If youโre
logged in, the CLI automatically sets your username as the namespace:
greet, which
takes a name and prints a greeting.
5. Understanding the implementation
The scaffoldedcomponent.ts implements the interface:
component.wit
(kebab-case hello-world becomes camelCase helloWorld in TypeScript).
6. Install dependencies and build
7. Push the component
Push your component to the registry:8. Create an environment
Create a new environment and add your component to it:9. Call your function
Call your componentโs function:hello World! ๐
10. Push to the cloud (optional)
To run your environment in the cloud, push it to the registry:๐ฏ Whatโs Next?
Youโve created a component and run it in an environment. From here you can:- โ Add more functions to your component
- ๐ฅ Import other components from the registry
- ๐ง Add configuration (environment variables, secrets) to your environment
- ๐ Compose multiple components in a single environment