From Architecture to Reality: Building My First SaaS (LeadIt) with AI Outreach and Company Analysis
Source: Dev.to
What is LeadIt?
LeadIt is a project I’m building to help with B2B lead discovery and AI‑powered outreach. The idea is simple:
- Find companies
- Analyze their websites
- Detect opportunity signals
- Generate personalized outreach emails
Instead of manually researching companies and writing cold emails, the system tries to automate most of that process.
Setting Up the Company Search API
Database Layer
- Connected the backend to Supabase and verified successful fetching of company records.
- Built a Company Search API supporting:
- Searching by
company_name - Filtering by
countryandcategory - Pagination with
page,limit, andoffset
- Searching by
Pagination prevents performance issues as the dataset grows, and the response is lightweight, returning only the required fields.
Example Results
The endpoint successfully fetched companies such as:
- Zapier
- Freshworks
- Postman
Seeing clean API responses was a small but satisfying milestone.
Building the Company Analyze Engine
The engine visits key pages of a company website:
- Homepage
- Careers page
- API documentation
- Integrations page
- Product pages
To keep the scraper lightweight and fast, heavy resources (images, fonts, CSS) are blocked, significantly improving scraping speed.
Detected Business Signals
During analysis, the engine looks for 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.
Building the Lead Scoring Engine
A rule‑based scoring system evaluates the detected signals. Examples:
- 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 an opportunity score and provides reasoning. The company endpoint now returns:
- Detected signals
- Opportunity score
- Reasoning behind the score
This module acts as the intelligence layer of LeadIt.
Building the AI Outreach Generator
The AI Outreach Generator creates personalized cold emails using:
- Company signals
- Company context
- User skills
AI Model
Integrated Groq LLM with the llama-3.1-8b-instant model.
Outreach Styles
- Observation Style – Point out something interesting about the company.
- Opportunity Style – Suggest a possible improvement or opportunity.
- Curiosity Style – Spark curiosity to encourage a reply.
The AI response is parsed into a structured output:
- Email subject
- Email body
The endpoint now takes company signals and generates context‑aware outreach emails automatically.
Production Considerations
Even in this early version, several safeguards were added:
- Input sanitization
- Prompt injection protection
- Token limits
- Timeout protection
- Rate limiting
- Concurrency limits
These measures help prevent abuse and keep the system stable.
Debugging Moment: Tailwind CSS Version Conflict
While setting up Next.js 14, repeated build errors appeared due to a Tailwind CSS version mismatch. The project had Tailwind CSS v4, which targets Next.js 15.
Fix: Downgrade to Tailwind CSS v3. The build errors disappeared.
Where LeadIt Stands Now
After two days of development, LeadIt can:
- Search companies from a database
- Analyze company websites automatically
- Detect business signals
- Calculate lead opportunity scores
- Generate AI‑powered outreach emails
The foundation of an automated B2B lead generation platform is taking shape.
Final Thoughts
Building your first SaaS product is chaotic. You spend hours debugging small things, but when the system finally works—APIs responding, AI generating emails, data flowing—it feels incredible. LeadIt is still early, but the core engine is finally operational, marking real progress.
If you’re also building a SaaS or experimenting with AI tools, keep iterating; the architecture will gradually turn into a real product.