Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sources/platform/actors/development/quick-start/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ There's more than one way to build an Actor. Pick the path that fits how you wor

<CardGrid>
<Card
title="Local development"
desc="Develop with the Apify CLI in your own editor and terminal, then deploy."
title="Develop locally"
desc="Build, test, and deploy on your own machine using your preferred IDE."
to="/actors/development/quick-start/locally"
/>
<Card
title="Web IDE"
desc="Develop in the browser, with zero local setup."
title="Use the Apify web IDE"
desc="Start coding immediately in your browser using Apify Console."
to="/actors/development/quick-start/web-ide"
/>
<Card
Expand Down
152 changes: 0 additions & 152 deletions sources/platform/actors/development/quick-start/locally.md

This file was deleted.

118 changes: 118 additions & 0 deletions sources/platform/actors/development/quick-start/locally.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
title: Develop Actors locally
sidebar_label: Develop locally
sidebar_position: 1
description: Get started with the Apify CLI to develop Actors locally.
slug: /actors/development/quick-start/locally
pagination_next: null
pagination_prev: null
---

import PromptButton from "@site/src/components/PromptButton";
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";


To develop Actors locally, use the [Apify CLI](/cli/docs). You can use your own code editor and version control system. The CLI simulates the Apify environment so you can test the Actor before you deploy it.

## Before you start

- [Install the Apify CLI](/cli/docs/installation).
- [Create an Apify account](https://console.apify.com/sign-in).

## Create and run an Actor

To create and run your new Actor locally, use the following commands:

```bash
apify create my-actor-name
cd my-actor-name
apify run
```

For a detailed tutorial, see the [Apify CLI quick start](/cli/docs/quick-start).

## Explore the Actor

The `apify create` command creates a directory with boilerplate code. The exact structure and contents of the directory depend on the template that you choose.

<Tabs>
<TabItem value="JavaScript">
```text
my-actor/
├── .actor/
│ ├── actor.json # Actor configuration
│ ├── input_schema.json
│ ├── output_schema.json
│ └── dataset_schema.json
├── src/
│ └── main.js # Main logic of the Actor
├── storage/ # Local storage
├── Dockerfile # Container image definition
├── README.md
├── AGENTS.md # Instructions for coding agents
└── package.json
```
</TabItem>
<TabItem value="Python">
```text
my-actor/
├── .actor/
│ ├── actor.json # Actor configuration
│ ├── input_schema.json
│ ├── output_schema.json
│ └── dataset_schema.json
├── my_actor/
│ └── main.py # Main logic of the Actor
├── storage/ # Local storage
├── Dockerfile # Container image definition
├── README.md
├── AGENTS.md # Instructions for coding agents
└── requirements.txt
```
</TabItem>
</Tabs>

### `.actor` directory

The `.actor` directory contains the Actor configuration:

- The [`actor.json`](/actors/development/actor-definition/actor-json) file defines the Actor's name, description, version, and other settings. It links your local development project to an Actor on the Apify platform.
- The [`input_schema.json`](/actors/development/actor-definition/input-schema) file defines the input parameters for an Actor.
- The [`output_schema.json`](/actors/development/actor-definition/output-schema) file specifies where an Actor stores its output and defines templates for accessing that output.
- The [`dataset_schema.json`](/storage/dataset-schema) file defines the structure and presentation of data produced by an Actor.

### Actor's input

Each Actor accepts an `input` object that tells it what to do. The object uses JSON format and lives in `storage/key_value_stores/default/INPUT.json`.

Local input comes from `INPUT.json` that you can edit manually. On the platform, input comes from the form generated by [`input_schema.json`](/actors/development/actor-definition/input-schema). Change the schema first, then update `INPUT.json` to match. Otherwise, the Actor works locally but fails validation on the platform.

### Actor's output

The [`output_schema.json`](/actors/development/actor-definition/output-schema) file defines where the Actor stores its results and how to access them. It builds on the [dataset schema](/storage/dataset-schema) and the [key-value store schema](/storage/key-value-store-schema).

### Actor's storage

The `storage` directory holds the data your Actor reads and writes when it runs locally. It mirrors the three storage types the Apify platform creates for every run:

| Path | Platform equivalent | Contents |
| --- | --- | --- |
| `storage/datasets/default/` | The run's default [dataset](/storage/dataset) | Structured results, one JSON file per item. |
| `storage/key_value_stores/default/` | The run's default [key-value store](/storage/key-value-store) | Files and data records. Works well for screenshots, PDFs, or persisting Actor state as JSON files. |
| `storage/request_queues/default/` | The run's default [request queue](/storage/request-queue) | Requests the Actor enqueued. |

Local storage persists between runs. To clear the default storages, run `apify run --purge`.

## Deploy to the Apify platform

There are two ways to deploy your Actor code to the Apify platform:

- Run the `apify push` command. It uploads the directory and starts a build. To control to which version the build belongs, use `--version` and `--build-tag` flags.
- Host your Actor's source code in a [Git repository](/actors/development/deployment/source-types#git-repository). Then, to rebuild the Actor on every push, add a webhook. For details, see [GitHub integration](/integrations/github#build-automatically-on-every-push).

## Next steps

- For a full list of commands, see the [Apify CLI command reference](/cli/docs/reference).
- For Actor configuration details, see [Actor definition](/actors/development/actor-definition).
- To automate your Actor development process, see [Continuous integration](/actors/development/deployment/continuous-integration).
14 changes: 7 additions & 7 deletions src/utils/quick-start-prompt.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const QUICK_START_PROMPT = `Follow this step-by-step workflow::

**Step 1: Verify Prerequisites**
**Step 1: Verify prerequisites**

First, verify the user's environment by running these commands:

\`\`\`bash
node --version # Requires Node.js 16 or higher
node --version # Requires Node.js 20 or higher
npm --version
apify --version # Check if Apify CLI is already installed
\`\`\`
Expand All @@ -17,9 +17,9 @@ If any prerequisites are missing, guide the user through installation before pro
npm install -g apify-cli
\`\`\`

**Step 3: Create a New Actor**
**Step 3: Create a new Actor**

**Note for AI Tools**: If you're an AI assistant that cannot run interactive commands (like the Gemini CLI), inform the user that the \`apify create\` command requires interactive input and cannot be executed automatically. Suggest they run this workflow in tools that support interactive commands like Cursor, or GitHub Copilot.
**Note for AI tools**: If you're an AI assistant that cannot run interactive commands (like the Gemini CLI), inform the user that the \`apify create\` command requires interactive input and cannot be executed automatically. Suggest they run this workflow in tools that support interactive commands like Cursor, or GitHub Copilot.

Explain that this will prompt for actor name and template selection.

Expand All @@ -29,21 +29,21 @@ apify create

Direct users to explore templates at https://apify.com/templates.

**Step 4: Navigate to the Actor Directory**
**Step 4: Navigate to the Actor directory**

\`\`\`bash
cd [actor-name] # Use the actual name they chose in step 3
\`\`\`

**Step 5: Run the Actor Locally**
**Step 5: Run the Actor locally**

Explain that this will run the actor locally.

\`\`\`bash
apify run
\`\`\`

**Step 6: Next Steps**
**Step 6: Next steps**

Explain that the user can deploy the actor to Apify, but they first need to log in to Apify:

Expand Down
Loading