|
| 1 | +--- |
| 2 | +title: Adding your RapidAPI project to Apify |
| 3 | +description: If you've already published an API project on RapidAPI and want to reach a broader audience, Apify Store and its active user community can help you expand your reach. You can maintain your RapidAPI presence while tapping into the Apify ecosystem. |
| 4 | +sidebar_position: 13 |
| 5 | +category: apify platform |
| 6 | +slug: /adding-rapidapi-project |
| 7 | +--- |
| 8 | + |
| 9 | +If you've already published an API project on RapidAPI and want to reach a broader audience, Apify Store and its active user community can help you expand your reach. You can maintain your RapidAPI presence while tapping into the Apify ecosystem. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Why add your project to Apify? |
| 14 | + |
| 15 | +By publishing your API 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 | +This example uses Express.js, but these steps work for any Node.js or Python API framework - just adapt the code to your stack. |
| 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 Apify CLI: |
| 26 | + |
| 27 | +```bash |
| 28 | +curl -fsSL https://apify.com/install-cli.sh | bash |
| 29 | +``` |
| 30 | + |
| 31 | +:::info CLI installation |
| 32 | + |
| 33 | +For more information, check the [CLI installation page](https://docs.apify.com/cli/docs/installation). |
| 34 | + |
| 35 | +::: |
| 36 | + |
| 37 | +### Step 1: Initialize the Actor structure |
| 38 | + |
| 39 | +Once you have Apify CLI, you can 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 first important thing is the initialization of the Actor. The second is the correct mapping of the PORT. Check the following example for inspiration: |
| 50 | + |
| 51 | +```jsx |
| 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:** 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. |
| 64 | + |
| 65 | +```jsx |
| 66 | +app.get('*', (req, res) => { |
| 67 | + if (req.headers['x-apify-container-server-readiness-probe']) { |
| 68 | + console.log('Readiness probe'); |
| 69 | + res.send('Hello, readiness probe!\n'); |
| 70 | + } |
| 71 | +}); |
| 72 | +``` |
| 73 | + |
| 74 | +### Step 3: Test your Actor locally |
| 75 | + |
| 76 | +Once you’ve added the Actor logic, you can test your Actor locally with the following command: |
| 77 | + |
| 78 | +```jsx |
| 79 | +apify run |
| 80 | +``` |
| 81 | + |
| 82 | +Now, you can check that your server is running. For example, check your `/health` endpoint, or any other alternative. |
| 83 | + |
| 84 | +### Step 4: Deploy your Actor to Apify |
| 85 | + |
| 86 | +You can now push your Actor to [Apify Console](https://console.apify.com/) with the following command: |
| 87 | + |
| 88 | +```jsx |
| 89 | +apify push |
| 90 | +``` |
| 91 | + |
| 92 | +If you’re doing `apify push` for the first time, first run `apify login`. It authenticates your Apify account and saves your credentials locally. |
| 93 | + |
| 94 | +### Step 5: Run your Actor |
| 95 | + |
| 96 | +After the deployment of your Actor, you’ll see a similar output in the terminal: |
| 97 | + |
| 98 | +```bash |
| 99 | +2025-10-03T07:57:13.671Z ACTOR: Build finished. |
| 100 | +Actor build detail https://console.apify.com/actors/a0c... |
| 101 | +Actor detail https://console.apify.com/actors/aOcUYdkQ28ResWFF9 |
| 102 | +Success: Actor was deployed to Apify cloud and built there. |
| 103 | +``` |
| 104 | + |
| 105 | +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**: |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +:::info Actors can run in two modes |
| 110 | + |
| 111 | +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. |
| 112 | + |
| 113 | +::: |
| 114 | + |
| 115 | +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! |
| 116 | + |
| 117 | +## Next steps |
| 118 | + |
| 119 | +Ready to **monetize your Actor and start earning**? Check out these guides: |
| 120 | + |
| 121 | +- [Set up monetization for your Actor](https://docs.apify.com/platform/actors/publishing/monetize) |
| 122 | +- [Publish your Actor on Apify Store](https://docs.apify.com/platform/actors/publishing/publish) |
| 123 | + |
| 124 | +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