Welcome to the Yao documentation! ## What is Yao? Yao is an **all-in-one application engine** that enables developers to create web apps, REST APIs, business applications, and more, with AI as a development partner. ### Generative Programming Generative Programming is the core concept of Yao. It means that you can generate code using AI, GUI, or by writing code. The Yao DSL is designed to be **human-readable**, easy to write, **AI-friendly**, and easily extendable. ### All-in-one App Engine Yao has a built-in suite of tools essential for application development, such as: - **TS/JS/DSL Runtime**: A runtime that can directly run TypeScript, JavaScript, and DSL code. - **HTTP Server**: A powerful HTTP server that can handle any HTTP request, for REST APIs, web pages, etc. - **Process Engine**: Hundreds of processes that cover the needs of over 90% of applications. - **UI Components**: UI components that support AI-powered inputs and can be used in DSL code with simple syntax to build dashboards, admin panels, and more. - **Template Engine**: A component-based template engine that can generate any web page. - **AI Connector**: A connector that integrates AI models for use within your application. - **Database**: A powerful ORM for database interactions.s - **File System**: File system operations that can be used in your application. More features can be found in the **[Why Yao document](getting-started/why-yao)**. All these features are packaged into a single executable with no package or toolchain dependencies. **Just download and run it to start building your application.** Yao can bring you a whole new development experience, increasing your development efficiency by several times. ## Quickstart To get started with Yao, follow these steps: ### Step 1: Install Yao Follow the Installation guide to install Yao on your machine or server. You only need one installation per machine or server. Linux and macOS: ```bash curl -fsSL https://yaoapps.com/install.sh | bash ``` Windows (**WSL2 Required**): ```powershell powershell -c "irm yaoapps.com/install.ps1 | iex" ``` 👉 [Installation guide](getting-started/installation) ### Step 2: Create a New Project Create a new project: Run the following command to create a new project: ```bash # Create an empty directory for your project mkdir /path/to/your/project # Enter the project directory cd /path/to/your/project # use yao start command to start application server # Use `Ctrl + C` to stop the server. yao start ``` The first time run `yao start` in an **empty directory**, Yao will create a new project in the current directory. Open the browser and visit `http://127.0.0.1:5099` to see the default web page. (Replace the IP address and port with yours) ### Step 3: Run a Process to See How Yao Works **Process** is a core concept in Yao. It represents a function that can be run directly or referenced in your code. Yao includes many internal processes that meet the needs of over 90% of applications. You can also define your own processes using TypeScript, GRPC plugins, or other methods. Open a new terminal, **enter the project directory**, and run the following commands: ```bash # # Run internal processes # # Use the utils.* process to run a utility process. # The process is defined in Yao’s source code. # You can find it in the Yao project at the following link: # https://github.com/YaoApp/yao/blob/840dae4b163811347598c740f43d43be065d01fa/engine/process.go#L30 # yao run utils.app.Ping # This will return the version of Yao. # Use the models.* process to query the database. # The Model DSL is defined in the models/tests/pet.mod.yao file within your project directory. # The first argument is the ID of the pet, and the second argument is the query. # If the argument is an object, use the '::' prefix to pass the object as a string. yao run models.tests.pet.Find 1 '::{}' # Returns all fields of the pet. yao run models.tests.pet.Find 1 '::{"select": ["id", "name"]}' # Returns only the id and name of the pet. # # Run a process defined using TypeScript # # Use the scripts.* process to run a TypeScript process. # The TypeScript process is defined in the scripts/tests/hello.ts file within your project directory. # Command-line arguments will be passed to the TypeScript function as parameters. yao run scripts.tests.Hello 'Hello, Yao!' # Returns 'Hello, Yao!' ``` ## How to Read the Documentation There are three types of documents in the Yao documentation: 1. **Documentation** These documents provide an overview of Yao’s features and concepts. 2. **Tutorials** These documents provide step-by-step instructions for building applications with Yao. 3. **References** These documents provide detailed information about Yao DSL, processes, JSAPI, and more. ### Documentation On the left side of the screen, you can find the navigation menu. The docs are organized sequentially, from basic to advanced. You can read them in order to get a better understanding of Yao. **Practice is the best way to learn.** We recommend that you follow the documentation and try to build a simple application to get started. ### Tutorials The tutorials are organized by scenario, such as building a website, REST API, admin panel, business app, etc. You can find the tutorials in the **[Uses](/uses)** section of the website. Each tutorial provides step-by-step instructions for building an application. 👉 [Uses](/uses) Choose a tutorial based on your needs: | Tutorial | Description | Link | | ------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | **Website** | A tutorial for building a website. (in progress) | 👉 [Website](/docs/tutorials/en-us/website/overview) | | **REST API** | A tutorial for building a REST API. (in progress) | 👉 [REST API](/docs/tutorials/en-us/api/overview) | | **Admin Panel** | A tutorial for building an admin panel. (in progress) | 👉 [Admin Panel](/docs/tutorials/en-us/admin-panel/overview) | | **Command-Line Tool** | A tutorial for building a Command-Line Tool. (in progress) | 👉 [Command-Line Tool](/docs/tutorials/en-us/cli/overview) | | **Business Application** | A tutorial for building an business application. (in progress) | 👉 [Business Application](/docs/tutorials/en-us/business/overview) | | **Edge Application** | A tutorial for building an application deployed on edge devices. (in progress) | 👉 [Edge Application](/docs/tutorials/en-us/edge/overview) | ### References The references provide detailed information about Yao DSL, processes, JSAPI, and more. You can find the references at the end of the navigation menu. | Reference | Description | Link | | ------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------ | | **Yao Command** | A complete list of all commands available in the Yao CLI, along with their descriptions. | 👉 [Yao Command](references/yao-command) | | **Yao Process** | A detailed list of all Yao internal processes and their descriptions. | 👉 [Yao Processes](references/yao-process) | | **Yao Runtime** | A complete list of all Yao runtime APIs along with their descriptions. | 👉 [Yao Runtime](references/yao-runtime) | | **Yao DSL** | A complete list of all Yao Widget DSLs and their descriptions. | 👉 [Yao DSL](references/yao-dsl) | | **Query DSL** | A detailed list of all database Query DSLs with their descriptions. | 👉 [Query DSL](references/query-dsl) | | **UI Components** | A complete list of all UI components in Yao DSL with their descriptions. | 👉 [UI Components](references/ui-components) | | **Template Engine** | A detailed list of all template engine APIs with their descriptions. | 👉 [Template Engine](references/template-engine) |