Skip to content

Commit 5f40fcc

Browse files
authored
Merge pull request #1 from apify/standby-template
standby actor from template
2 parents 4927257 + 6e2b48b commit 5f40fcc

13 files changed

+6279
-1
lines changed

.actor/actor.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"actorSpecification": 1,
3+
"name": "actor-openrouter-proxy",
4+
"title": "Standby Actor in TypeScript",
5+
"description": "Standby Actor in TypeScript.",
6+
"version": "0.0",
7+
"buildTag": "latest",
8+
"usesStandbyMode": true,
9+
"meta": {
10+
"templateId": "ts-standby"
11+
},
12+
"dockerfile": "../Dockerfile"
13+
}

.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# configurations
2+
.idea
3+
.vscode
4+
5+
# crawlee and apify storage folders
6+
apify_storage
7+
crawlee_storage
8+
storage
9+
10+
# installed files
11+
node_modules
12+
13+
# git folder
14+
.git
15+
16+
# dist folder
17+
dist

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
end_of_line = lf

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file tells Git which files shouldn't be added to source control
2+
3+
.idea
4+
.vscode
5+
.zed
6+
storage
7+
apify_storage
8+
crawlee_storage
9+
node_modules
10+
dist
11+
tsconfig.tsbuildinfo
12+
13+
# Added by Apify CLI
14+
.venv

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.prettierignore

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"tabWidth": 4
5+
}

Dockerfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Specify the base Docker image. You can read more about
2+
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
3+
# You can also use any other image from Docker Hub.
4+
FROM apify/actor-node:22 AS builder
5+
6+
# Check preinstalled packages
7+
RUN npm ls crawlee apify puppeteer playwright
8+
9+
# Copy just package.json and package-lock.json
10+
# to speed up the build using Docker layer cache.
11+
COPY package*.json ./
12+
13+
# Install all dependencies. Don't audit to speed up the installation.
14+
RUN npm install --include=dev --audit=false
15+
16+
# Next, copy the source files using the user set
17+
# in the base image.
18+
COPY . ./
19+
20+
# Install all dependencies and build the project.
21+
# Don't audit to speed up the installation.
22+
RUN npm run build
23+
24+
# Create final image
25+
FROM apify/actor-node:22
26+
27+
# Check preinstalled packages
28+
RUN npm ls crawlee apify puppeteer playwright
29+
30+
# Copy just package.json and package-lock.json
31+
# to speed up the build using Docker layer cache.
32+
COPY package*.json ./
33+
34+
# Install NPM packages, skip optional and development dependencies to
35+
# keep the image small. Avoid logging too much and print the dependency
36+
# tree for debugging
37+
RUN npm --quiet set progress=false \
38+
&& npm install --omit=dev --omit=optional \
39+
&& echo "Installed NPM packages:" \
40+
&& (npm list --omit=dev --all || true) \
41+
&& echo "Node.js version:" \
42+
&& node --version \
43+
&& echo "NPM version:" \
44+
&& npm --version \
45+
&& rm -r ~/.npm
46+
47+
# Copy built JS files from builder image
48+
COPY --from=builder /usr/src/app/dist ./dist
49+
50+
# Next, copy the remaining files and directories with the source code.
51+
# Since we do this after NPM install, quick build will be really fast
52+
# for most source file changes.
53+
COPY . ./
54+
55+
# Create and run as a non-root user.
56+
RUN adduser -h /home/apify -D apify && \
57+
chown -R apify:apify ./
58+
USER apify
59+
60+
# Run the image.
61+
CMD npm run start:prod --silent

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,54 @@
1-
# actor-openrouter-proxy
1+
## Standby TypeScript template
2+
3+
Start a new [web scraping](https://apify.com/web-scraping) project quickly and easily in TypeScript (Node.js) with our Standby project template. It provides a basic structure for building an Actor with [Apify SDK](https://docs.apify.com/sdk/js/) and allows you to easily add your own functionality.
4+
5+
## Included features
6+
7+
- **[Apify SDK](https://docs.apify.com/sdk/js/)** - a toolkit for building [Actors](https://apify.com/actors)
8+
9+
## Resources
10+
11+
- [Actor Standby documentation](https://docs.apify.com/platform/actors/development/programming-interface/standby)
12+
13+
14+
## Getting started
15+
16+
For complete information [see this article](https://docs.apify.com/platform/actors/development#build-actor-locally). To run the Actor use the following command:
17+
18+
```bash
19+
apify run
20+
```
21+
22+
## Deploy to Apify
23+
24+
### Connect Git repository to Apify
25+
26+
If you've created a Git repository for the project, you can easily connect to Apify:
27+
28+
1. Go to [Actor creation page](https://console.apify.com/actors/new)
29+
2. Click on **Link Git Repository** button
30+
31+
### Push project on your local machine to Apify
32+
33+
You can also deploy the project on your local machine to Apify without the need for the Git repository.
34+
35+
1. Log in to Apify. You will need to provide your [Apify API Token](https://console.apify.com/account/integrations) to complete this action.
36+
37+
```bash
38+
apify login
39+
```
40+
41+
2. Deploy your Actor. This command will deploy and build the Actor on the Apify Platform. You can find your newly created Actor under [Actors -> My Actors](https://console.apify.com/actors?tab=my).
42+
43+
```bash
44+
apify push
45+
```
46+
47+
## Documentation reference
48+
49+
To learn more about Apify and Actors, take a look at the following resources:
50+
51+
- [Apify SDK for JavaScript documentation](https://docs.apify.com/sdk/js)
52+
- [Apify SDK for Python documentation](https://docs.apify.com/sdk/python)
53+
- [Apify Platform documentation](https://docs.apify.com/platform)
54+
- [Join our developer community on Discord](https://discord.com/invite/jyEM2PRvMU)

eslint.config.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import prettier from 'eslint-config-prettier';
2+
3+
import apify from '@apify/eslint-config/ts.js';
4+
import globals from 'globals';
5+
import tsEslint from 'typescript-eslint';
6+
7+
// eslint-disable-next-line import/no-default-export
8+
export default [
9+
{ ignores: ['**/dist', 'eslint.config.mjs'] },
10+
...apify,
11+
prettier,
12+
{
13+
languageOptions: {
14+
parser: tsEslint.parser,
15+
parserOptions: {
16+
project: 'tsconfig.json',
17+
},
18+
globals: {
19+
...globals.node,
20+
...globals.jest,
21+
},
22+
},
23+
plugins: {
24+
'@typescript-eslint': tsEslint.plugin,
25+
},
26+
rules: {
27+
'no-console': 0,
28+
},
29+
},
30+
];

0 commit comments

Comments
 (0)