DEV Community

Kumar Nihal
Kumar Nihal

Posted on

From Architecture to Reality: Building My First SaaS (LeadIt) with AI Outreach and Company Analysis

Two days ago I shared the architecture flow diagram of my SaaS project LeadIt.

Today I want to share what actually happened after that.

Over the last two days, I started turning that architecture into real working modules. Instead of just diagrams and ideas, LeadIt now has actual APIs, a company analysis engine, and an AI-powered outreach generator.

This post is basically a build log of what I implemented and what I learned while building my first SaaS product.

What is LeadIt?

LeadIt is a project I’m building to help with B2B lead discovery and AI-powered outreach.

The idea is simple:

  1. Find companies
  2. Analyze their websites
  3. Detect opportunity signals
  4. Generate personalized outreach emails

Instead of manually researching companies and writing cold emails, the system tries to automate most of that process.

1. Setting Up the Company Search API

The first thing I worked on was the database layer.

I connected my backend with Supabase and verified that I could fetch company records successfully.

Once the connection was stable, I built a Company Search API.

This API supports:

  • searching companies by company_name
  • filtering by country
  • filtering by category
  • pagination using page, limit, and offset

Pagination was important because once the database grows, returning thousands of records in a single request would slow everything down.

I also made the response lightweight by returning only the required fields instead of full database objects.

After testing the endpoint, it successfully fetched companies like:

  • Zapier
  • Freshworks
  • Postman

Seeing clean API responses was a small but satisfying milestone.

2. Building the Company Analyze Engine

Once companies could be fetched from the database, the next step was analyzing them.

For this, I built what I call the Company Analyze Engine.
The idea is to automatically scan a company website and detect useful signals.
To achieve this, I used Playwright for automated browsing.

The engine visits key pages of a company website:

  1. homepage
  2. careers page
  3. API documentation
  4. integrations page
  5. product pages

To keep the scraper lightweight and fast, I blocked heavy resources like:

  • images
  • fonts
  • CSS

This significantly improves scraping speed.

During analysis, the engine looks for business signals, such as:

  • hiring activity
  • availability of APIs
  • integrations with other tools
  • automation-related keywords

These signals help determine whether the company might be a good B2B opportunity.

3. Building the Lead Scoring Engine

After detecting signals, I implemented a rule-based lead scoring system.
The goal here is to turn raw signals into a clear opportunity score.

For example:

  • Companies hiring engineers may be scaling fast
  • Companies offering APIs may be developer-focused
  • Companies mentioning automation might be good targets for outreach tools

The system calculates a lead opportunity score and also explains the reason behind the score.

The company endpoint now returns:

  • detected signals
  • opportunity score
  • reasoning behind the score

This module basically acts as the intelligence layer of LeadIt.

4. Building the AI Outreach Generator

Once the system identifies potential opportunities, the next step is outreach.

So I built the AI Outreach Generator.

This module generates personalized cold emails using:

  • company signals
  • company context
  • user skills

For the AI model, I integrated Groq LLM using the llama-3.1-8b-instant model.

To make the emails more effective, I designed three outreach styles:

  1. Observation Style: Point out something interesting about the company.

  2. Opportunity Style: Suggest a possible improvement or opportunity.

  3. Curiosity Style: Spark curiosity to encourage a reply.

The AI response is then parsed into structured output:

  • email subject
  • email body

The endpoint now takes company signals and generates context-aware outreach emails automatically.

5. Production Considerations

Even though this is an early version, I tried to keep production stability in mind.

Some safeguards I added include:

  • input sanitization
  • prompt injection protection
  • token limits
  • timeout protection
  • rate limiting
  • concurrency limits

These help prevent abuse and keep the system stable.

6. Debugging Moment: Tailwind CSS Version Conflict

Not everything went smoothly.

While setting up Next.js 14, I kept getting repeated build errors related to Tailwind CSS.
After debugging configs and dependencies, I realized the issue:

I had installed Tailwind CSS v4, which is designed for Next.js 15.
But my project runs on Next.js 14, which caused PostCSS and CSS compilation errors.

The fix was simply downgrading to: Tailwind CSS v3

Once I did that, the build errors disappeared.
A small mistake, but a good reminder about framework compatibility.

Where LeadIt Stands Now

After the last two days of development, LeadIt can now:

  • search companies from a database
  • analyze company websites automatically
  • detect business signals
  • calculate lead opportunity scores
  • generate AI-powered outreach emails

This is starting to look like the foundation of an automated B2B lead generation platform.

Still early days, but it’s exciting to see the architecture slowly turn into a real product.

Final Thoughts

Building your first SaaS product is chaotic.

You spend hours debugging small things.
You question your architecture decisions.
You rewrite code multiple times.

But the moment your system actually starts working — APIs responding, AI generating emails, data flowing — it feels incredible.

LeadIt is still early, but the core engine is finally starting to work.

And that feels like real progress.

If you're also building a SaaS or experimenting with AI tools,
I'd love to hear what you're working on.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.