Menu

1 / 2

Build a CRM with Python: Track Leads and Deals Without Paying for Salesforce

DEV Community·Brad·6 months ago
#rL1PI4uY
#python#automation#business#productivity#conn
Reading 0:00
15s threshold

Managing leads and clients in spreadsheets is a recipe for lost deals. Here's how to build a lightweight CRM in Python that tracks everything — for free.

Why Not Just Use Salesforce?

Salesforce costs $25-300/user/month. For freelancers and small businesses managing under 500 contacts, you're paying for complexity you don't need. A Python-based CRM gives you exactly what you need.

The Core Data Structure

import sqlite3 import datetime

def init_db (): conn = sqlite3 . connect ( ' crm.db ' ) c = conn . cursor ()

c . execute ( ''' CREATE TABLE IF NOT EXISTS contacts ( id INTEGER PRIMARY KEY, name TEXT, email TEXT UNIQUE, phone TEXT, company TEXT, status TEXT DEFAULT ' lead ' , created_at TEXT, last_contact TEXT, notes TEXT ) ''' )

c . execute ( ''' CREATE TABLE IF NOT EXISTS deals ( id INTEGER PRIMARY KEY, contact_id INTEGER, title TEXT, value REAL, stage TEXT DEFAULT ' prospect ' , expected_close TEXT, notes TEXT, FOREIGN KEY (contact_id) REFERENCES contacts (id) ) ''' )

c .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.