Back to template gallery

Empty TypeScript project

Empty template with basic structure for the Actor with Apify SDK that allows you to easily add your own functionality.

Language

typescript

Tools

nodejs

Use cases

Web scraping

// Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/)
import { Actor } from "apify";
// Crawlee - web scraping and browser automation library (Read more at https://crawlee.dev)
// import { CheerioCrawler } from 'crawlee';

// this is ESM project, and as such, it requires you to specify extensions in your relative imports
// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions
// note that we need to use `.js` even when inside TS files
// import { router } from './routes.js';

// The init() call configures the Actor for its environment. It's recommended to start every Actor with an init()
await Actor.init();

console.log('Hello from the Actor!');
/**
 * Actor code
 */

// Gracefully exit the Actor process. It's recommended to quit all Actors with an exit()
await Actor.exit();

Empty TypeScript template

Start a new web scraping project quickly and easily in TypeScript (Node.js) with our empty project template. It provides a basic structure for the Actor with Apify SDK and allows you to easily add your own functionality.

Included features

How it works

Insert your own code between await Actor.init() and await Actor.exit(). If you would like to use the Crawlee library simply uncomment its import import { CheerioCrawler } from 'crawlee';.

Resources

A short guide on how to build web scrapers using code templates: web scraper template

Already have a solution in mind?

Sign up for a free Apify account and deploy your code to the platform in just a few minutes! If you want a head start without coding it yourself, browse our Store of existing solutions.