> ## Documentation Index
> Fetch the complete documentation index at: https://moonshot.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Simple app

> Design an AI product that tells you if something is a good idea

<Note>This guide assumes you've run Moonshot AI Designer in Figma and added your OpenAI API key as described in the [Quickstart guide](/quickstart).</Note>

## What we'll build

<Frame caption="Example of a product that answers a yes or no question and provides a reason.">
  <img src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/examples/simple-app/end-result.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=5a6f4faa46c489d82c9a3efdb7e0b620" width="1200" height="624" data-path="images/examples/simple-app/end-result.png" />
</Frame>

## Steps to reproduce

After a few builds these steps will become second nature. Once setup, you'll only need to update your prompt to see how your design responds to AI.

<Steps>
  <Step title="Add text nodes">
    Add text placeholders for the question and reasoning. Make sure to name your text laters appropriately to make syncing data easier later on.

    <Frame caption="Add one text node for the question and one for the description.">
      <img src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/examples/simple-app/add-text-nodes.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=c39e275d71bf6a7f7e244ab584a0cac7" width="1718" height="990" data-path="images/examples/simple-app/add-text-nodes.png" />
    </Frame>

    <br />
  </Step>

  <Step title="Create a multi-variant component">
    Let's create a component with three different variants: `Yes`, `No`, and `Null`. We need a `Null` variant to use before we make our first request or if we decide to reset the variable. These names can be upper or lower case, and you can name the variant property anything you like—for the purpose of this example we'll name it "Response".

    <Frame>
      <img src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/component-variants.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=60e68875a3b6d1644e573e157592a423" width="1676" height="656" data-path="images/component-variants.png" />
    </Frame>

    <Note>This requires knowing how to work with components and component variants. Read more about [working with components](/basics/working-with-components.mdx).</Note>

    <br />
  </Step>

  <Step title="Create a local variable">
    Click on "Local variables" in Figma's right panel (you may need to unselect a frame or node to see it). Create a new text variable called "Yes or No".

    <Frame>
      <img src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/variables.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=a102e21abc14e45d98e45eff2a51b99a" width="1356" height="932" data-path="images/variables.png" />
    </Frame>

    <Tip>Create a local variables collection for AI to stay organized and make data easier to sync.</Tip>

    <br />
  </Step>

  <Step title="Add an instance of your component to your design">
    This will allow you to sync data with this instance and not the component itself.

    <Frame>
      <img src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/examples/simple-app/apply-variable.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=402417aadb25e57761e38d8c29b8dcd5" width="1964" height="1090" data-path="images/examples/simple-app/apply-variable.png" />
    </Frame>

    <Note>Make sure to apply your local variable to the component property (int this case "Response").</Note>

    <br />
  </Step>

  <Step title="Apply auto layout">
    Select both text nodes and the component, then click to apply auto layout in Figma's right panel. This will ensure your design can adjust to varying levels of content. Learn more about [working with auto layout](/basics/working-with-auto-layout).

    Once this step is done the traditional design work for this example will be complete.

    <br />
  </Step>

  <Step title="Create a request">
    Run Moonshot AI Designer and create a request if none are created already. Give it a name and write out a directive for the **System** field that gives the model paramters to work with. Something like the following will work:

    ```text System prompt theme={"system"}
    You are a helpful assistant. Tell a user if something is a good idea or not.
    ```

    <br />
  </Step>

  <Step title="Define your schema">
    Next we'll define a structured JSON response to ensure data is reliably applied to your design after each request. To do this, click on "Define schema".

    <Frame>
      <img width="400px" src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/schema-variables.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=57684398a19fc13c334deff279c77ece" data-path="images/schema-variables.png" />
    </Frame>

    You can write your JSON by hand or use the prompt above the code field to generate one for you. For this example, feel free to copy and paste the following:

    ```json JSON schema theme={"system"}
    {
        "type": "object",
        "properties": {
            "question": {
            "type": "string"
            },
            "answer": {
            "type": "string",
            "enum": [
                "yes",
                "no"
            ]
            },
            "description": {
            "type": "string"
            }
        },
        "required": [
            "question",
            "answer",
            "description"
        ],
        "additionalProperties": false
    }
    ```

    <br />
  </Step>

  <Step title="Make an initial request">
    This will return your intial set of properties and accompanying data that you can then sync with your design. Ask a question in **Prompt** field and click "Make request".

    <Frame>
      <img width="400px" src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/examples/simple-app/initial-request.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=db9ca7289b2626df10b2c31d06d31d7e" data-path="images/examples/simple-app/initial-request.png" />
    </Frame>

    Once you get a request click on "View response" to view the data properties and values that you can apply to your design.

    <Frame>
      <img width="400px" src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/requests-response.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=7ff587a9756ae0d31da663d06a7a0138" data-path="images/requests-response.png" />
    </Frame>

    <br />
  </Step>

  <Step title="Sync response data with text nodes and variable">
    Click on a text node in your file and select the value you want to sync to it. You can also click on "View response" from the main Reqeusts view and then click on a response value and sync it with a text node or variable.

    <Frame>
      <img width="400px" src="https://mintcdn.com/thinklikellc/yUQYyXEaEJymQjZO/images/quickstart-sync-text.png?fit=max&auto=format&n=yUQYyXEaEJymQjZO&q=85&s=22e0046f5983a660e2a34421c4ad4eb4" data-path="images/quickstart-sync-text.png" />
    </Frame>

    Repeat with the other text node in your design and the local variable that is read by your component.

    <br />
  </Step>
</Steps>

Once you've synced response data with your design you can update your prompt in Moonshot AI Designer and make a new request to see your design respond to AI.
