|
1 | 1 | --- |
2 | 2 | title: Quick start |
3 | | -description: Learn how to create, run, and manage Actors using Apify CLI. |
| 3 | +description: Learn how to create, run, and deploy Actors using Apify CLI. |
4 | 4 | --- |
5 | 5 |
|
6 | | -Learn how to create, run, and manage Actors using Apify CLI. |
| 6 | +Learn how to create, run, and deploy [Actors](https://docs.apify.com/actors) using Apify CLI. |
7 | 7 |
|
8 | | -## Prerequisites |
| 8 | +## Before you start |
9 | 9 |
|
10 | | -Before you begin, make sure you have the Apify CLI installed on your system. If you haven't installed it yet, follow the [installation guide](./installation.md). |
| 10 | +- [Install Apify CLI](./installation.md). |
| 11 | +- [Create an Apify account](https://console.apify.com/sign-up). |
11 | 12 |
|
12 | | -## Step 1: Create your Actor |
| 13 | +## 1. Create an Actor |
13 | 14 |
|
14 | | -Run the following command in your terminal. It will guide you step by step through the creation process. |
| 15 | +To create an Actor, run the following command in your terminal: |
15 | 16 |
|
16 | 17 | ```bash |
17 | 18 | apify create |
18 | 19 | ``` |
19 | 20 |
|
20 | | -:::info Explore Actor templates |
| 21 | +The CLI then asks you for the following: |
21 | 22 |
|
22 | | -The Apify CLI will prompt you to choose a template. Browse the [full list of templates](https://apify.com/templates) to find the best fit for your Actor. |
| 23 | +1. Name your Actor. Use lowercase letters, numbers, and hyphens. |
| 24 | +1. Select a type of Actor to create: web scraper, AI agent, API and data pipeline, or browser automation. Let's choose **web scraper**. |
| 25 | +1. Choose the programming language: JavaScript, TypeScript, or Python. Let's choose **JavaScript**. |
| 26 | +1. Based on your choice, the CLI suggests Actor templates. For this tutorial, let's choose **Crawlee and Cheerio**. |
| 27 | + |
| 28 | +:::tip Explore Actor templates |
| 29 | + |
| 30 | +To find a template that best suits your needs, browse the [full list of templates](https://apify.com/templates). |
23 | 31 |
|
24 | 32 | ::: |
25 | 33 |
|
26 | | -## Step 2: Run your Actor |
| 34 | +The CLI creates a new directory with the boilerplate code and installs all project dependencies. |
27 | 35 |
|
28 | | -Once the Actor is initialized, you can run it: |
| 36 | +## 2. Run your Actor |
29 | 37 |
|
30 | | -```bash |
31 | | -apify run |
32 | | -``` |
| 38 | +You can run the code locally, with simulated Apify [environment variables](https://docs.apify.com/actors/development/environment-variables). The results of the Actor run are saved to your disk. |
33 | 39 |
|
34 | | -You'll see output similar to this in your terminal: |
| 40 | +1. Navigate to the Actor directory: |
35 | 41 |
|
36 | | -```bash |
37 | | -INFO System info {"apifyVersion":"3.4.3","apifyClientVersion":"2.12.6","crawleeVersion":"3.13.10","osType":"Darwin","nodeVersion":"v22.17.0"} |
38 | | -Extracted heading { level: 'h1', text: 'Your full‑stack platform for web scraping' } |
39 | | -Extracted heading { level: 'h3', text: 'TikTok Scraper' } |
40 | | -Extracted heading { level: 'h3', text: 'Google Maps Scraper' } |
41 | | -Extracted heading { level: 'h3', text: 'Instagram Scraper' } |
42 | | -``` |
| 42 | + ```bash |
| 43 | + cd your-actor-name |
| 44 | + ``` |
43 | 45 |
|
44 | | -## Step 3: Push your Actor |
| 46 | +1. Run your Actor: |
45 | 47 |
|
46 | | -Once you are ready, you can push your Actor to the Apify platform, where you can schedule runs, or make the Actor public for other developers. |
| 48 | + ```bash |
| 49 | + apify run |
| 50 | + ``` |
47 | 51 |
|
48 | | -### Login to Apify Console |
| 52 | +### View the results |
49 | 53 |
|
50 | | -```bash |
51 | | -apify login |
52 | | -``` |
| 54 | +Local runs store their data in the `storage` directory: |
53 | 55 |
|
54 | | -:::note Create an Apify account |
| 56 | +| Path | Contents | |
| 57 | +| --- | --- | |
| 58 | +| `storage/datasets/default/` | Results the Actor added to its default dataset. One JSON file per item. | |
| 59 | +| `storage/key_value_stores/default/` | Records the Actor read or wrote, including its input. | |
| 60 | +| `storage/request_queues/default/` | Requests the Actor enqueued. | |
55 | 61 |
|
56 | | -Before you can interact with the Apify Console, [create an Apify account](https://console.apify.com/). |
57 | | -When you run `apify login`, you can choose one of the following methods: |
58 | 62 |
|
59 | | -- Sign in via the Apify Console in your browser — recommended. |
60 | | -- Provide an [Apify API token](https://console.apify.com/settings/integrations) — alternative method. |
| 63 | +## 3. Deploy your Actor |
61 | 64 |
|
62 | | -The interactive prompt will guide you through either option. |
| 65 | +By deploying your Actor to the Apify platform, you can run your code on Apify's infrastructure, schedule runs, and monitor logs and stored data. |
63 | 66 |
|
64 | | -::: |
| 67 | +### Log in to Apify Console |
65 | 68 |
|
66 | | -### Push to Apify Console |
| 69 | +To log in, run: |
67 | 70 |
|
68 | 71 | ```bash |
69 | | -apify push |
| 72 | +apify login |
70 | 73 | ``` |
71 | 74 |
|
72 | | -## Step 4: Call your Actor (optional) |
| 75 | +You can then choose one of the following methods: |
73 | 76 |
|
74 | | -You can run your Actor on the Apify platform. In the following example, the command runs `apify/hello-world` on the Apify platform. |
| 77 | +- _(Recommended)_ Sign in through the Apify Console in your browser. |
| 78 | +- Provide an [Apify API token](https://console.apify.com/settings/integrations). |
| 79 | +
|
| 80 | +### Push your Actor to Apify |
| 81 | +
|
| 82 | +To upload your Actor's source code and build it on the Apify platform, run: |
75 | 83 |
|
76 | 84 | ```bash |
77 | | -apify call apify/hello-world |
| 85 | +apify push |
78 | 86 | ``` |
79 | 87 |
|
| 88 | +The CLI creates the Actor in your account, shows the build log, and prints a link to your Actor in Apify Console when the build succeeds. |
| 89 | + |
80 | 90 | ## Next steps |
81 | 91 |
|
82 | | -- Check the [command reference](./reference.md) for more information about individual commands. |
83 | | -- If you have a problem with the Apify CLI, check the [troubleshooting](./troubleshooting.md) guide. |
84 | | -- Learn more about [Actors](https://docs.apify.com/platform/actors). |
| 92 | +- For a full list of available commands, see the [command reference](./reference.md). |
| 93 | +- For details on how to automate the development process, see [Continuous integration](https://docs.apify.com/actors/development/deployment/continuous-integration). |
| 94 | +- Once your first Actor is ready, [publish it on Apify Store](https://docs.apify.com/actors/publishing) and set up monetization to start earning. |
0 commit comments