Skip to content

Instantly share code, notes, and snippets.

Last active February 15, 2024 05:38
Show Gist options
  • Save jancurn/2dbe83fea77c439b1119fb3f118513e7 to your computer and use it in GitHub Desktop.
Save jancurn/2dbe83fea77c439b1119fb3f118513e7 to your computer and use it in GitHub Desktop.
Example of an Apify actor stored in a GitHub Gist.

This is an example of an Apify actor that is stored as GitHub Gist. Gists are useful if your actor has multiple source code files but you don't want to create a full Git repository for it or don't want to host your source files directly on Apify. All files of this Gist are provided under Apache 2.0 license.

Whenever you edit the Gist, you'll need to rebuild the actor.

Are you missing anything? Something not clear? Please let us know at


Contains the source code of the actor in Node.js.


The file used by NPM to maintain metadata about the package, such as list of dependencies. See NPM docs for more details.


Contains instructions for Docker how to build the image for the act. For more information, see Dockerfile reference.

The Markup file is used to generate a long description of the actor that is displayed in Apify Library.

const Apify = require('apify');
Apify.main(async () => {
// Get act input
const input = await Apify.getValue('INPUT');
// Here's the place for your magic...
console.log('Hello world');
// Store the output
const output = {
message: 'Hello my friend!'
await Apify.setValue('OUTPUT', output)
# Here you choose the base Docker image for the actor. Apify provides the following images:
# apify/actor-node-basic
# apify/actor-node-chrome
# apify/actor-node-puppeteer
# However, you can use any other image from Docker Hub.
# For more information, see
FROM apify/actor-node-basic
# Copy all files and directories from the directory to the Docker image
COPY . ./
# Install NPM packages, skip optional and development dependencies to keep the image small,
# avoid logging to much and show log the dependency tree
RUN npm install --quiet --only=prod --no-optional \
&& npm list
# Define that start command
ENTRYPOINT [ "node", "actor-in-gist-example.js" ]
"name": "actor-in-gist-example",
"version": "0.0.1",
"private": true,
"dependencies": {
"apify": "^0.11.8"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment