You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Create your first Actor using the Apify Console IDE or locally.**
11
+
**Create your first Actor using the Apify Web IDE or locally in your IDE.**
11
12
12
13
---
13
14
14
-
:::note
15
+
:::info Before you build
15
16
16
17
Before you start building your own Actor, try out a couple of existing Actors from [Apify Store](https://apify.com/store). See the [Running Actors](../../running/index.md) section for more information on running existing Actors.
17
18
18
19
:::
19
20
20
-
## Language
21
+
## Technology stack
21
22
22
23
Any code that can run inside of a Docker container can be turned into Apify [Actor](../../index.mdx). This gives you freedom in choosing your technical stack, including programming language and technologies.
23
24
24
25
But to fully benefit from running on top of the Apify platform, we recommend you choose either JavaScript/Node.js or Python, where Apify provides first-level support regarding its SDK, API clients, and learning materials.
25
26
26
-
For these languages, you can also choose from many code templates that help you to kickstart your project quickly:
27
+
For these languages, you can also [choose from many code templates](https://apify.com/templates) that help you to kickstart your project quickly.
- Using the **Web IDE** in [Apify Console](https://console.apify.com). This is the fastest way to kick-start your Actor development and try out the Apify platform.
37
-
- Develop your Actor **locally** and only deploy to the Apify platform when it is production ready. This way, you benefit from your local setup for a better development and debugging experience. After you are done with the development, you can easily [deploy](./deployment) your Actor to Apify platform.
35
+
### Local development
38
36
39
-
Now, let's start with:
37
+
Develop your Actor locally in your IDE and only deploy to the Apify platform when it is production ready.
This way, you benefit from your local setup for a better development and debugging experience. After you are done with the development, you can [deploy](./deployment) your Actor to the Apify platform.
You need to have [Node.js](https://nodejs.org/en/) version 16 or higher with `npm` installed on your computer.
14
+
This guide walks you through the full lifecycle of an Actor. You'll start by creating and running it locally with the Apify CLI, then learn to configure its input and data storage. Finally, you will deploy the Actor to the Apify platform, making it ready to run in the cloud.
15
15
16
-
:::
16
+
### Prerequisites
17
17
18
-
## Install Apify CLI
18
+
-[Node.js](https://nodejs.org/en/) version 16 or higher with `npm` installed on your computer.
19
+
- The [Apify CLI](/cli/docs/installation) installed.
20
+
- Optional: To deploy your Actor, [sign in](https://console.apify.com/sign-in).
19
21
20
-
### MacOS/Linux
22
+
### Step 1: Create your Actor
21
23
22
-
You can install the Apify CLI via the [Homebrew package manager](https://brew.sh/).
24
+
Use Apify CLI to create a new Actor:
23
25
24
26
```bash
25
-
brew install apify-cli
27
+
apify create
26
28
```
27
29
28
-
### Other platforms
30
+
The CLI will ask you to:
29
31
30
-
Use [NPM](https://www.npmjs.com/) to install the Apify CLI.
32
+
1. Name your Actor (e.g., `your-actor-name`)
33
+
2. Choose a programming language (`JavaScript`, `TypeScript`, or `Python`)
34
+
3. Select a development template
35
+
:::info Explore Actor templates
31
36
32
-
```bash
33
-
npm -g install apify-cli
34
-
```
37
+
Browse the [full list of templates](https://apify.com/templates) to find the best fit for your Actor.
35
38
36
-
Visit [Apify CLI documentation](https://docs.apify.com/cli/) for more information regarding installation and advanced usage.
39
+
:::
37
40
38
-
## Create your Actor
41
+
The CLI will:
39
42
40
-
To create a new Actor, use the following command:
43
+
- Create a `your-actor-name` directory with boilerplate code
44
+
- Install all project dependencies
45
+
46
+
Now, you can navigate to your new Actor directory:
41
47
42
48
```bash
43
-
apify create
49
+
cd your-actor-name
44
50
```
45
51
46
-
The CLI will prompt you to:
52
+
### Step 2: Run your Actor
47
53
48
-
1._Name your Actor_: Enter a descriptive name for your Actor, such as `your-actor-name`
49
-
1._Choose a programming language_: Select the language you want to use for your Actor (JavaScript, TypeScript, or Python).
50
-
1._Select a development template_: Choose a template from the list of available options.
54
+
Run your Actor with:
51
55
52
-
After selecting the template, the CLI will:
56
+
```bash
57
+
apify run
58
+
```
53
59
54
-
- Create a `your-actor-name` directory with the boilerplate code.
55
-
- Install all project dependencies
60
+
:::tip Clear data with --purge
56
61
57
-

62
+
During development, use `apify run --purge`. This clears all results from previous runs, so it's as if you're running the Actor for the first time.
58
63
59
-
Navigate to the newly created Actor directory:
64
+
:::
65
+
66
+
You'll see output similar to this in your terminal:
60
67
61
68
```bash
62
-
cd your-actor-name
69
+
INFO System info {"apifyVersion":"3.4.3","apifyClientVersion":"2.12.6","crawleeVersion":"3.13.10","osType":"Darwin","nodeVersion":"v22.17.0"}
70
+
Extracted heading { level: 'h1', text: 'Your full‑stack platform for web scraping' }
As you can see inthe logs, the Actor extracts text from a web page. The main logic lives in`src/main.js`. Depending on your template, this file may be `src/main.ts` (TypeScript) or `src/main.py` (Python).
66
77
67
-
After creating your Actor, explore the source code in your preferred code editor, We'll use the `Crawlee + Puppeteer + Chrome` template code as an example, but all Actor templates follow a similar organizational pattern. The important directories and filer are:
78
+
In the next step, we’ll explore the results in more detail.
68
79
69
-
### `src` Directory
80
+
### Step 3: Explore the Actor
70
81
71
-
-`src/main.js`: This file contains the actual code of your Actor
82
+
Let's explore the Actor structure.
72
83
73
-
###`.actor`Directory
84
+
#### The `.actor` folder
74
85
75
-
-[`actor.json`](https://docs.apify.com/platform/actors/development/actor-definition/actor-json): This file defines the Actor's configuration, such as input and output specifications.
76
-
-[`Dockerfile`](https://docs.apify.com/platform/actors/development/actor-definition/dockerfile): This file contains instructions for building the Docker image for your Actor.
86
+
The `.actor` folder contains the Actor configuration. The `actor.json` file defines the Actor's name, description, and other settings. Find more info in the [actor.json](https://docs.apify.com/platform/actors/development/actor-definition/actor-json) definition.
77
87
78
-
###`storage` Directory
88
+
#### Actor's `input`
79
89
80
-
- This directory emulates the [Apify Storage](../../../storage/index.md)
To change the `INPUT.json`, edit the `input_schema.json`in the `.actor` folder first.
88
95
89
-
To run your Actor locally, use the following command:
96
+
This JSON Schema validates input automatically (no error handling needed), powers the Actor's user interface, generates API docs, and enables smart integration with tools like Zapier or Make by auto-linking input fields.
90
97
91
-
```bash
92
-
apify run
93
-
```
98
+
:::
94
99
95
-
After executing this command, you will see the Actor's log output in your terminal. The results of the Actor's execution will be stored in the local dataset located in the `storage/datasets/default` directory.
100
+
Find more info in the [Input schema](/platform/actors/development/actor-definition/input-schema) documentation.
The Actor system provides two storage types for files and results: [key-value](/platform/storage/key-value-store) store and [dataset](/platform/storage/dataset).
100
105
101
-
Running the Actor locally allows you to test and debug your code before deploying it to the Apify platform.
106
+
##### Key-value store
102
107
103
-
:::
108
+
The key-value store saves and reads files or data records. Key-value stores work well for screenshots, PDFs, or persisting Actor state as JSON files.
109
+
110
+
##### Dataset
111
+
112
+
The dataset stores a series of data objects from web scraping, crawling, or data processing jobs. You can export datasets to JSON, CSV, XML, RSS, Excel, or HTML formats.
113
+
114
+
#### Actor's `output`
115
+
116
+
You define the Actor output using the Output schema files:
- [Key-value Store Schema Specification](/platform/actors/development/actor-definition/key-value-store-schema)
106
120
107
-
Once you are satisfied with your Actor, to deploy it to the Apify platform, follow these steps:
121
+
The system uses this to generate an immutable JSON file that tells users where to find the Actor's results.
108
122
109
-
1._Sign in to Apify with the CLI tool_
123
+
### Step 4: Deploy your Actor
124
+
125
+
Let's now deploy your Actor to the Apify platform, where you can run the Actor on a scheduled basis, or you can make the Actor public for other users.
126
+
127
+
1. Login first:
110
128
111
129
```bash
112
130
apify login
113
131
```
114
132
115
-
This command will prompt you to provide your API token that you can find in Console.
133
+
:::info Your Apify token location
116
134
117
-
1. _Push your Actor to the Apify platform_
135
+
After you successfully login, your Apify token is stored in`~/.apify/auth.json`, or `C:\Users\<name>\.apify` based on your system.
136
+
137
+
:::
138
+
139
+
2. Push your Actor to the Apify platform:
118
140
119
141
```bash
120
142
apify push
121
143
```
122
144
123
-
This command will upload your Actor's code and configuration to the Apify platform, where it can be executed and managed.
124
-
125
-
:::note Actor monetization
145
+
### Step 5: It's Time to Iterate!
126
146
127
-
If you have successfully completed your first Actor, you may consider [sharing it with other users and monetizing it](../../publishing/index.mdx). The Apify platform provides opportunities to publish and monetize your Actors, allowing you to share your work with the community and potentially generate revenue.
147
+
Good job! 🎉 You're ready to develop your Actor. You can make changes to your Actor and implement your use case.
128
148
129
-
:::
149
+
## Next steps
130
150
131
-
By following these steps, you can seamlessly deploy your Actors to the Apify platform, enabling you to leverage its scalability, reliability, and advanced features for your web scraping and data processing projects.
151
+
- Visit the [Apify Academy](/academy) to access a comprehensive collection of tutorials, documentation, and learning resources.
152
+
- To understand Actors in detail, read the [Actor Whitepaper](https://whitepaper.actor/).
153
+
- Check [Continuous integration](../deployment/continuous_integration.md) documentation to automate your Actor development process.
154
+
- After you finish building your first Actor, you can [share it with other users and even monetize it](../../publishing/index.mdx).
0 commit comments