Skip to content

Commit c301d94

Browse files
Finish the first version of new quick start
1 parent 45c98ed commit c301d94

File tree

2 files changed

+66
-46
lines changed

2 files changed

+66
-46
lines changed

sources/platform/actors/development/quick_start/start_locally.md

Lines changed: 64 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ slug: /actors/development/quick-start/locally
1111

1212
## What you'll learn
1313

14-
- tbd
15-
14+
- How to create and run your first Actor locally using Apify CLI
15+
- How to understand and configure Actor input, output, and storage
16+
- How to deploy your Actor to the Apify platform
1617

1718
## Prerequisites
1819

@@ -50,90 +51,107 @@ The Apify CLI will prompt you to:
5051

5152
## Step 2: Run your Actor
5253

53-
- tbd (see the result as soon as possible)
54+
After creating your Actor, you can run it with:
5455

55-
## Step 3: Explore the Result
56+
```bash
57+
apify run
58+
```
5659

57-
- tbd (see the result - AHA moment, I get data)
58-
- explain the "code"
60+
:::tip
5961

60-
## Step 4: Deploy your Actor
62+
During development, use `apify run --purge`. This command clears all results from previous runs, so it’s as if you’re running the Actor for the first time.
6163

62-
- tbd
64+
:::
6365

64-
## Step 5: It's time to build!
66+
This command runs your Actor, and you’ll see output similar to the following in your terminal:
6567

66-
- Encourage developers to edit actors, build interesting stuff, etc.
67-
- Optional...
68+
```bash
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' }
71+
Extracted heading { level: 'h3', text: 'TikTok Scraper' }
72+
Extracted heading { level: 'h3', text: 'Google Maps Scraper' }
73+
Extracted heading { level: 'h3', text: 'Instagram Scraper' }
74+
```
6875
69-
## Next Steps
76+
As you can see in the logs, the Actor extracts text from a web page. All the main logic is defined in `src/main.js`. Depending on the template you chose, this file may also be `src/main.ts` (for TypeScript) or `src/main.py` (for Python).
7077
71-
- tbd (deploy)
78+
In the next step, we’ll explore the results in more detail.
7279
73-
<!-- ## Explore the source code in your editor
80+
## Step 3: Explore the Actor
7481
75-
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:
82+
<!-- TODO: Add more examples -->
7683
77-
### `src` Directory
84+
The following section will explain the Actor in more details.
7885
79-
- `src/main.js`: This file contains the actual code of your Actor
86+
### The `.actor` folder
8087
81-
### `.actor` Directory
88+
The Actor configuration is in the folder `.actor`. The file `actor.json` defines the Actor's configuration, such as name, description, etc. You can find more info in [actor.json](https://docs.apify.com/platform/actors/development/actor-definition/actor-json) definition.
8289
83-
- [`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.
84-
- [`Dockerfile`](https://docs.apify.com/platform/actors/development/actor-definition/dockerfile): This file contains instructions for building the Docker image for your Actor.
90+
### Actor's `input`
8591
86-
### `storage` Directory
92+
Each Actor accepts an `input object`, which tells it what it should do. The object is passed in JSON format, and you can find it in `storage/key_value_stores/default/INPUT.json`.
8793
88-
- This directory emulates the [Apify Storage](../../../storage/index.md)
89-
- [Dataset](../../../storage/dataset.md)
90-
- [Key-Value Store](../../../storage/key_value_store.md)
91-
- [Request Queue](../../../storage/request_queue.md)
94+
:::info
9295
93-
![Actor source code](./images/actor-local-code.png)
96+
To change the `INPUT.json`, edit first the `input_schema.json` in the `.actor` folder.
9497
95-
## Run it locally
98+
This JSON Schema not only validates input automatically (so you don't need to handle input errors in your code), but also powers the Actor's user interface, generates API docs, and enables smart integration with tools like Zapier or Make by auto-linking input fields.
9699
97-
To run your Actor locally, use the following command:
100+
:::
98101
99-
```bash
100-
apify run
101-
```
102+
You can find more info in the [Input schema](/platform/actors/development/actor-definition/input-schema) documentation.
102103
103-
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.
104+
### Actor's `storage`
104105
105-
![Actor source code](./images/actor-local-run.png)
106+
The Actor system provides two specialized storages that can be used by Actors for storing files and results: `key-value` store and `dataset`.
106107
107-
:::note Local testing & debugging
108+
#### Key-value store
108109
109-
Running the Actor locally allows you to test and debug your code before deploying it to the Apify platform.
110+
The key-value store is a simple data storage that is used for saving and reading files or data records.
110111
111-
:::
112+
Key-value stores are ideal for saving things like screenshots, PDFs, or to persist the state of Actors e.g. as a JSON file.
113+
114+
#### Dataset
115+
116+
The dataset is an append-only storage that allows you to store a series of data objects such as results from web scraping, crawling, or data processing jobs. You or your users can then export the dataset to formats such as JSON, CSV, XML, RSS, Excel, or HTML.
117+
118+
### Actor's `output`
112119
113-
## Deploy it to Apify platform
120+
While the input object provides a standardized way to invoke Actors, Actors can also generate an output object, which is a standardized way to display, consume, and integrate Actors’ results.
121+
122+
You can define how the Actor output looks using the Output schema file. The system uses this information to automatically generate an immutable JSON file, which tells users where to find the results produced by the Actor.
123+
124+
## Step 4: Deploy your Actor
114125
115-
Once you are satisfied with your Actor, to deploy it to the Apify platform, follow these steps:
126+
Let's now deploy your Actor to the Apify platform, where you can for example run the Actor on scheduled basis, or you can make the Actor public for other users.
116127
117-
1. _Sign in to Apify with the CLI tool_
128+
1. First of all, you need to login:
118129
119130
```bash
120131
apify login
121132
```
122133
123-
This command will prompt you to provide your API token that you can find in Console.
134+
:::info
135+
After you succesfull login, your Apify token is stored in `~/.apify/auth.json`, or `C:\Users\<name>\.apify` based on your system.
136+
:::
124137
125-
1. _Push your Actor to the Apify platform_
138+
1. Now, you can push your Actor to the Apify platform:
126139
127140
```bash
128141
apify push
129142
```
130143
131-
This command will upload your Actor's code and configuration to the Apify platform, where it can be executed and managed.
144+
## Step 5: It's time to build!
145+
146+
Good job, you have done it! 🎉 From here, you can develop your Actor.
132147
133-
:::note Actor monetization
148+
:::tip Actor monetization
134149
135-
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.
150+
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.
136151
137-
:::
152+
:::
153+
154+
## Next Steps
138155
139-
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. -->
156+
- If you want to understand Actors in more details, read the [Actor Whitepaper](https://whitepaper.actor/).
157+
- Check [Continuous integration](../deployment/continuous_integration.md) documentation to automate your Actor development process.

sources/platform/actors/development/quick_start/start_web_ide.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import TabItem from '@theme/TabItem';
1414

1515
---
1616

17+
<!-- TODO: Revisit, make it more like start_locally, but keep the content, only add steps, etc. -->
18+
1719
## Create the Actor
1820

1921
:::note Prerequisites

0 commit comments

Comments
 (0)