DEV Community

Кирилл
Кирилл

Posted on

Building a Freelance Scanner Agent That Finds Work While You Sleep

Introduction to Automated Freelance Scanning

I've spent countless hours scouring job boards and social media for potential projects as a freelance developer. Honestly, it's exhausting and takes away from the time I can dedicate to actual coding. Last Tuesday, I was stuck browsing through Upwork for hours, and that's when it hit me - there had to be a better way. So, I built a freelance scanner agent using Node.js and AI-powered automation. My system scans job boards, social media, and professional networks for potential projects, sending me notifications when a match is found.

The thing is, this process is not only time-consuming but also prone to errors. I'd often miss out on great projects simply because I wasn't checking the job boards at the right time. But with my scanner agent, I can rest easy knowing that it's working for me 24/7. I've deployed it on our 3-server setup, and it's been a huge relief.

Designing the Scanner Agent

I used Node.js and the puppeteer library for web scraping, along with the brain.js library for AI-powered matching. The system runs on a scheduled basis, scanning for new projects every 2 hours. It's deployed on a cloud server, which costs me around $5 per month - a small price to pay for the time it saves me.

const puppeteer = require('puppeteer');
const brain = require('brain.js');

// Initialize the browser
async function initBrowser() {
  const browser = await puppeteer.launch({
    headless: true,
    args: ['--no-sandbox'],
  });
  return browser;
}

// Scan job boards for potential projects
async function scanJobBoards(browser) {
  const page = await browser.newPage();
  await page.goto('https://www.upwork.com');
  const projects = await page.$$eval('.project', (elements) => {
    return elements.map((element) => {
      return {
        title: element.querySelector('.title').textContent,
        description: element.querySelector('.description').textContent,
      };
    });
  });
  return projects;
}
Enter fullscreen mode Exit fullscreen mode

AI-Powered Matching

My scanner agent uses a neural network to match potential projects with my skills and interests. Turns out, training the network on a dataset of previous projects and client feedback was the hardest part - it took around 10 hours to complete. But the payoff is huge: the network can match projects with an accuracy of 85%, saving me around 20 hours per month in manual searching.

const net = new brain.recurrent.LSTM();

// Train the network on the dataset
net.train([
  {
    input: 'Node.js development',
    output: 'high',
  },
  {
    input: 'front-end development',
    output: 'medium',
  },
  {
    input: 'back-end development',
    output: 'high',
  },
], {
  iterations: 1000,
  errorThresh: 0.005,
});

// Use the network to match potential projects
async function matchProjects(projects) {
  const matchedProjects = [];
  for (const project of projects) {
    const output = net.run(project.title);
    if (output > 0.5) {
      matchedProjects.push(project);
    }
  }
  return matchedProjects;
}
Enter fullscreen mode Exit fullscreen mode

Deployment and Maintenance

I deployed the scanner agent using Docker, which took around 2 hours to set up. The agent is scheduled to run every 2 hours using a cron job, and I receive notifications via email when a match is found. I've also set up monitoring and logging to ensure the agent is running smoothly, saving me around 5 hours per month in maintenance.

By automating the process of finding freelance work, I've been able to save around 25 hours per month and increase my earnings by 15% - it's been a game-changer for me. If you're interested in building something similar, I highly recommend checking out the AI Agent Kit - it's a great resource for getting started with production-ready AI agents.

Top comments (0)