DEV Community

Cover image for πŸš€ Building a CRM in PHP & MySQL: My Final Year Project Journey πŸŽ“
Ashish prajapati
Ashish prajapati

Posted on

πŸš€ Building a CRM in PHP & MySQL: My Final Year Project Journey πŸŽ“

DAY - 1

Hello, everyone! πŸ‘‹ I'm Ashish Prajapati, a TYBCA student at R.K. Desai College of Computer and Applied Science. For my final year project, I’ve been working on a Customer Relationship Management (CRM) System 🌟. This post takes you through my journey, the modules I’m working on, how I’m learning along the way, and the tools I’m using to bring this project to life.


πŸ’‘ Inspiration and Guidance

As someone with no prior experience in developing a CRM, I turned to ChatGPT for guidance. It suggested the following essential modules for a CRM system:

  • πŸ“Š Dashboard: A centralized view of key metrics and insights.
  • πŸ‘₯ Customer Management: To manage customer details and interactions.
  • πŸš€ Lead & Opportunities: Tracking potential sales and conversions.
  • πŸ“‹ Task Management: Assigning and tracking tasks and follow-ups.
  • πŸ’° Sales Tracking: Monitoring revenue, sales activities, and performance.
  • πŸ“ˆ Analytics: Visual insights into leads, sales, and customer behavior.
  • πŸ“§ Email Integration: Sending notifications and follow-up reminders.
  • πŸ” User Permissions: Managing access control for team members.
  • πŸ“ Notes & Activity Logs: Keeping records of important customer interactions.

With ChatGPT’s guidance, I’m working on implementing these modules step by step. While this may not be a production-ready CRM, I’m putting my all into this project to learn and grow as a developer. πŸ’ͺ


πŸ—‚ Directory Structure: Organizing the Code

To keep my project structured and maintainable, here’s how I’ve organized my files:

πŸ“‚ client/
β”œβ”€β”€ πŸ“‚ assets/
β”‚   β”œβ”€β”€ πŸ“‚ css/
β”‚   β”‚   β”œβ”€β”€ lead.css      # Styles for lead management
β”‚   β”‚   └── style.css     # Global styles
β”‚   β”œβ”€β”€ πŸ“‚ js/
β”‚   β”‚   └── script.js     # Custom JavaScript
β”œβ”€β”€ πŸ“‚ includes/
β”‚   β”œβ”€β”€ _Footer.php       # Footer component
β”‚   β”œβ”€β”€ _Nav.php          # Navigation menu
β”‚   └── db.php            # Database connection
β”œβ”€β”€ add_lead.php          # Script to add leads
β”œβ”€β”€ index.php             # Main homepage
β”œβ”€β”€ login.php             # Login functionality
β”œβ”€β”€ signup.php            # Signup form
β”œβ”€β”€ signup_process.php    # Signup backend logic
└── tailwind.config.js    # Tailwind CSS configuration
Enter fullscreen mode Exit fullscreen mode

πŸ“Œ Highlights:

  • Reusable Components: _Footer.php and _Nav.php ensure consistent UI across pages.
  • Database Connection: db.php is the heart of the backend, handling MySQL connectivity.
  • Tailwind CSS: A modern utility-first framework to streamline the design process.

πŸ—ƒ Database Design: The Backbone of the CRM

The CRM revolves around two primary tables: leads and customers. These tables ensure efficient management of client and lead data.

πŸ“ Leads Table

CREATE TABLE `leads` (
  `lead_id` int(11) NOT NULL,
  `first_name` varchar(50) NOT NULL,
  `last_name` varchar(50) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `company_name` varchar(100) DEFAULT NULL,
  `position` varchar(50) DEFAULT NULL,
  `lead_source` varchar(50) DEFAULT NULL,
  `lead_status` enum('new','contacted','qualified','converted','lost') DEFAULT 'new',
  `opportunity_value` decimal(10,2) DEFAULT NULL,
  `close_date` date DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
Enter fullscreen mode Exit fullscreen mode

πŸ‘₯ Customers Table

CREATE TABLE `customers` (
  `customer_id` int(11) NOT NULL,
  `first_name` varchar(50) NOT NULL,
  `last_name` varchar(50) NOT NULL,
  `email` varchar(100) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `state` varchar(50) DEFAULT NULL,
  `postal_code` varchar(20) DEFAULT NULL,
  `country` varchar(50) DEFAULT NULL,
  `tags` varchar(255) DEFAULT NULL,
  `company_name` varchar(100) DEFAULT NULL,
  `position` varchar(50) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('active','inactive','prospect') DEFAULT 'prospect',
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
Enter fullscreen mode Exit fullscreen mode

πŸ”§ Tools and Technologies Used

Here’s the stack I’m using for this project:

  • PHP 🐘: To build the backend logic and server-side functionalities.
  • MySQL πŸ—„: For structured data storage and retrieval.
  • Tailwind CSS 🎨: To design a modern and responsive user interface.
  • JavaScript πŸ’»: For client-side interactivity.

πŸ“Έ Visuals in Development

Here’s what I plan to showcase in my vlog and future posts:

  • Lead Management Form: For adding and updating leads.

Image description

  • Lead Database: A table with detailed leadrecords.

Image description

  • Dashboard Prototype: Early concepts of the main dashboard.

Image description


πŸ’ͺ Challenges and Learning Experience

Working on this CRM project has been both exciting and challenging! As a beginner in CRM development:

  • I had to research best practices for database design and user management.
  • ChatGPT has been my guide, providing valuable advice for structuring my project and implementing new features.
  • I’m learning the importance of modularity in code and the impact of design consistency.

While this may not be a ready-to-use product, I’m proud of the progress I’ve made so far. Every line of code is helping me grow as a developer. πŸš€


πŸ› οΈ What’s Next?

Here’s what I plan to work on in the coming weeks:

  • Analytics Dashboard πŸ“Š: To visualize leads and sales metrics.
  • Email Notifications βœ‰οΈ: For task reminders and follow-ups.
  • User Permissions πŸ”: Role-based access for better security.
  • Task Management βœ…: Assigning and tracking team tasks.

🌟 Final Thoughts

This project has been a wonderful opportunity to apply everything I’ve learned in TYBCA and explore new technologies. I’m excited to continue refining this CRM and adding more features.

Thank you for reading! If you enjoyed this post or have any tips for me, please leave a reaction ❀️ and comment below.


Top comments (0)