|
| 1 | +--- |
| 2 | +title: Adding your RapidAPI project to Apify |
| 3 | +description: If you've published an API project on RapidAPI, you can expand your project's visibility by listing it on Apify Store. This gives you access to Apify's developer community and ecosystem. |
| 4 | +sidebar_position: 1 |
| 5 | +category: apify platform |
| 6 | +slug: /apify-actors/adding-rapidapi-project |
| 7 | +--- |
| 8 | + |
| 9 | +If you've published an API project on [RapidAPI](https://rapidapi.com/), you can expand your project's visibility by listing it on Apify Store. This gives you access to Apify's developer community and ecosystem. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Why add your API project to Apify |
| 14 | + |
| 15 | +By publishing your API project on Apify, you'll reach thousands of active users in Apify Store. You'll also get access to the Apify platform's infrastructure: managed hosting, data storage, scheduling, advanced web scraping and crawling capabilities, and integrated proxy management. These tools help you reach more users and enhance your API's functionality. |
| 16 | + |
| 17 | +## Step-by-step guide |
| 18 | + |
| 19 | +The approach is demonstrated on an app built on top of [Express.js](https://expressjs.com/), but with a few adaptations to the code, any API framework will work. |
| 20 | + |
| 21 | +You'll deploy your API as an [Apify Actor](https://apify.com/actors) - a serverless cloud program that runs on the Apify platform. Actors can handle everything from simple automation to running web servers. |
| 22 | + |
| 23 | +### Prerequisites |
| 24 | + |
| 25 | +You’ll need an [Apify account](https://console.apify.com/sign-in) - _it’s free and no credit card is required_. For simple migration and deployment, we recommend installing the Apify CLI: |
| 26 | + |
| 27 | +```bash |
| 28 | +curl -fsSL https://apify.com/install-cli.sh | bash |
| 29 | +``` |
| 30 | + |
| 31 | +:::info Other ways to install the CLI |
| 32 | + |
| 33 | +Check the [CLI installation page](https://docs.apify.com/cli/docs/installation) for more details and all the options. |
| 34 | + |
| 35 | +::: |
| 36 | + |
| 37 | +### Step 1: Initialize the Actor structure |
| 38 | + |
| 39 | +Once you have the Apify CLI, run the following command: |
| 40 | + |
| 41 | +```bash |
| 42 | +apify init |
| 43 | +``` |
| 44 | + |
| 45 | +The command sets up an Actor project in your current directory by creating `actor.json` (Actor configuration) and storage files (Dataset and Key-value store). |
| 46 | + |
| 47 | +### Step 2: Add Actor logic |
| 48 | + |
| 49 | +The initialization of the Actor is the first important thing. The second is the correct mapping of the PORT. Check the following example for inspiration: |
| 50 | + |
| 51 | +```js |
| 52 | +await Actor.init(); // Initializes the Actor |
| 53 | + |
| 54 | +const app = express(); |
| 55 | +const PORT = Actor.config.get('containerPort'); // Specifies the PORT |
| 56 | +const DATA_FILE = path.join(__dirname, 'data', 'items.json'); |
| 57 | + |
| 58 | +app.use(express.json()); |
| 59 | + |
| 60 | +// Rest of the logic |
| 61 | +``` |
| 62 | + |
| 63 | +:::tip Readiness checks |
| 64 | + |
| 65 | +The Apify platform performs readiness checks by sending GET requests to `/` with the `x-apify-container-server-readiness-probe` header. For better resource efficiency, consider checking for this header and returning a simple response early, rather than processing it as a full request. This optimization is particularly useful for resource-intensive Actors. |
| 66 | + |
| 67 | +```js |
| 68 | +app.get('*', (req, res) => { |
| 69 | + if (req.headers['x-apify-container-server-readiness-probe']) { |
| 70 | + console.log('Readiness probe'); |
| 71 | + res.send('Hello, readiness probe!\n'); |
| 72 | + } |
| 73 | +}); |
| 74 | +``` |
| 75 | + |
| 76 | +::: |
| 77 | + |
| 78 | +### Step 3: Test your Actor locally |
| 79 | + |
| 80 | +Once you’ve added the Actor logic, test your Actor locally with the following command: |
| 81 | + |
| 82 | +```bash |
| 83 | +apify run |
| 84 | +``` |
| 85 | + |
| 86 | +Now, check that your server is running. Check one of your endpoints, for example `/health`. |
| 87 | + |
| 88 | +### Step 4: Deploy your Actor to Apify |
| 89 | + |
| 90 | +Now push your Actor to [Apify Console](https://console.apify.com/). You’ll be able to do this only if you’re logged in to your Apify account with the CLI. Run `apify info` to check, and if you’re not logged in yet, run `apify login`. This only needs to be done once. To push your project, run the following command: |
| 91 | + |
| 92 | +```bash |
| 93 | +apify push |
| 94 | +``` |
| 95 | + |
| 96 | +### Step 5: Run your Actor |
| 97 | + |
| 98 | +After pushing your Actor to the platform, in the terminal you’ll see an output similar to this: |
| 99 | + |
| 100 | +```text |
| 101 | +2025-10-03T07:57:13.671Z ACTOR: Build finished. |
| 102 | +Actor build detail https://console.apify.com/actors/a0c... |
| 103 | +Actor detail https://console.apify.com/actors/aOc... |
| 104 | +Success: Actor was deployed to Apify cloud and built there. |
| 105 | +``` |
| 106 | + |
| 107 | +You can click the **Actor detail** link, or go to **Apify Console > My Actors**, and click on your Actor. Now, click on the Settings tab, and enable **Actor Standby**: |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | +:::info Two modes of Actors |
| 112 | + |
| 113 | +Actors can run in two modes: as batch processing jobs that execute a single task and stop, or in **Standby mode** as a web server. For use cases like deploying an API that needs to respond to incoming requests in real-time, Standby mode is the best choice. It keeps your Actor running continuously and ready to handle HTTP requests like a standard web server. |
| 114 | + |
| 115 | +::: |
| 116 | + |
| 117 | +Once you’ve saved the settings, go to the **Standby** tab, and click the **Test endpoint** button. It will start the Actor, and you can test it. Once the Actor is running, you're done with the migration! |
| 118 | + |
| 119 | +## Next steps |
| 120 | + |
| 121 | +Ready to monetize your Actor and start earning? Check out these guides: |
| 122 | + |
| 123 | +- [Set up monetization for your Actor](https://docs.apify.com/platform/actors/publishing/monetize) |
| 124 | +- [Publish your Actor on Apify Store](https://docs.apify.com/platform/actors/publishing/publish) |
| 125 | + |
| 126 | +You can also extend your Actor with custom logic and leverage additional Apify platform features, such as storage or web scraping capabilities. |
0 commit comments