Skip to content

sanctumos/sanctum-crm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

86 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Sanctum CRM

A modern, API-first Customer Relationship Management system built with PHP, Bootstrap UI, and SQLite, designed for seamless integration with Letta AI agents and the broader Sanctum AI ecosystem. Features intelligent first-boot configuration and MCP (Model Context Protocol) compatibility for AI agent integration.

๐Ÿ“„ License

This project is distributed under a dual license structure:

See LICENSE for complete details.

๐Ÿš€ Features

  • ๐Ÿค– AI Agent Ready: MCP-compatible API designed for Letta AI and other agentic AI systems
  • โšก First Boot Configuration: Intelligent setup wizard for instant deployment
  • ๐Ÿ‘ฅ Contact Management: Unified leads and customers with comprehensive data fields
  • ๐Ÿ’ผ Deal Pipeline: Track sales opportunities and conversions with Kanban view
  • ๐Ÿ‘ค User Management: Admin interface for user management and API key generation
  • ๐Ÿ“Š Reports & Analytics: Comprehensive sales analytics with charts and exports
  • ๐Ÿ”— Webhook System: Real-time notifications and integrations
  • โš™๏ธ Dynamic Configuration: Database-driven settings with encryption support
  • ๐ŸŒ API-First Design: RESTful API with OpenAPI documentation
  • ๐Ÿ“ฑ Modern UI: Responsive Bootstrap 5 interface with interactive components
  • ๐Ÿ”’ Enterprise Security: SQLite with fixed paths, input validation, and session security

๐Ÿ›  Technology Stack

  • Backend: PHP 8.0+
  • Frontend: Bootstrap 5.x
  • Database: SQLite 3
  • API: RESTful with JSON responses
  • Authentication: Session-based (web) + API keys (programmatic)

๐Ÿ“‹ Requirements

  • PHP 8.0 or higher
  • SQLite3 extension enabled
  • Web server (Apache/Nginx) or PHP built-in server
  • Modern web browser

๐Ÿš€ Quick Start

1. Clone the Repository

git clone https://github.com/sanctumos/sanctum-crm.git
cd sanctum-crm

2. First Boot Setup

# Start PHP built-in server from the public directory
cd public
php -S localhost:8000

3. Complete Installation Wizard

  • Open your browser to http://localhost:8000
  • Follow the 5-step installation wizard:
    1. Environment Check: Verify PHP and SQLite requirements
    2. Database Setup: Initialize SQLite database with proper schema
    3. Company Info: Configure your company name and basic settings
    4. Admin User: Create your administrator account
    5. Finalization: Complete setup and access your CRM

4. AI Agent Integration

# Get your API key from the admin panel
# Use with Letta AI or any MCP-compatible agent
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://your-domain.com/api/v1/contacts

5. Run Tests

# Run comprehensive test suite (100% coverage)
php tests/run_tests.php

# Run specific test suites
php tests/unit/ConfigManagerCustomTest.php
php tests/integration/FirstBootIntegrationTest.php
php tests/e2e/InstallationWizardE2ETest.php

๐Ÿ“ Project Structure

sanctum-crm/
โ”œโ”€โ”€ public/                  # Web root (all public files)
โ”‚   โ”œโ”€โ”€ index.php           # Main entry point with first-boot detection
โ”‚   โ”œโ”€โ”€ install.php         # Installation wizard interface
โ”‚   โ”œโ”€โ”€ login.php           # Authentication
โ”‚   โ”œโ”€โ”€ logout.php          # Session cleanup
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ””โ”€โ”€ v1/
โ”‚   โ”‚       โ””โ”€โ”€ index.php   # MCP-compatible API endpoints
โ”‚   โ”œโ”€โ”€ pages/              # Web interface pages
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard.php
โ”‚   โ”‚   โ”œโ”€โ”€ contacts.php
โ”‚   โ”‚   โ”œโ”€โ”€ deals.php
โ”‚   โ”‚   โ”œโ”€โ”€ settings.php    # Dynamic configuration management
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ””โ”€โ”€ includes/           # Shared components
โ”‚       โ”œโ”€โ”€ config.php
โ”‚       โ”œโ”€โ”€ database.php
โ”‚       โ”œโ”€โ”€ ConfigManager.php      # Dynamic configuration system
โ”‚       โ”œโ”€โ”€ InstallationManager.php # First-boot setup
โ”‚       โ”œโ”€โ”€ EnvironmentDetector.php # Server environment analysis
โ”‚       โ””โ”€โ”€ layout.php
โ”œโ”€โ”€ db/                      # SQLite database (private)
โ”‚   โ””โ”€โ”€ crm.db
โ”œโ”€โ”€ tests/                   # Comprehensive test suite (100% coverage)
โ”‚   โ”œโ”€โ”€ unit/               # Unit tests
โ”‚   โ”œโ”€โ”€ integration/        # Integration tests
โ”‚   โ”œโ”€โ”€ e2e/               # End-to-end tests
โ”‚   โ””โ”€โ”€ api/               # API tests
โ”œโ”€โ”€ docs/                   # Documentation
โ””โ”€โ”€ README.md

๐Ÿ”’ Deployment Best Practices

  • Set your web server root to /public (not the project root)
  • Never expose /includes, /db, /tests, or /docs to the web
  • All sensitive files are outside the web root for security

๐Ÿค– AI Agent Integration

MCP (Model Context Protocol) Compatibility

Sanctum CRM is designed for seamless integration with Letta AI and other agentic AI systems through MCP-compatible APIs.

Authentication

# Using Bearer token (preferred for AI agents)
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://your-domain.com/api/v1/contacts

# Using query parameter (fallback)
curl https://your-domain.com/api/v1/contacts?api_key=YOUR_API_KEY

Example AI Agent Usage

# Get all contacts (AI agent can analyze customer data)
GET /api/v1/contacts

# Create new contact (AI agent can add leads from conversations)
POST /api/v1/contacts
{
  "first_name": "John",
  "last_name": "Doe",
  "email": "john@example.com",
  "company": "Acme Corp",
  "phone": "+1234567890",
  "source": "ai_agent_conversation"
}

# Update contact status (AI agent can track interactions)
PUT /api/v1/contacts/123
{
  "contact_status": "qualified",
  "notes": "AI agent identified high-value prospect"
}

# Get configuration (AI agent can understand system settings)
GET /api/v1/settings

Letta AI Integration Example

// Example MCP tool for Letta AI
const crmTool = {
  name: "sanctum_crm",
  description: "Customer Relationship Management system",
  parameters: {
    action: {
      type: "string",
      enum: ["create_contact", "update_contact", "get_contacts", "create_deal"],
      description: "Action to perform"
    },
    contact_data: {
      type: "object",
      description: "Contact information"
    }
  }
};

โš™๏ธ Configuration

First Boot Configuration

The system automatically detects first-time installation and guides you through:

  1. Environment Validation: Checks PHP version, SQLite support, and server configuration
  2. Database Initialization: Creates SQLite database with proper schema
  3. Company Setup: Configure your company name and basic information
  4. Admin Account: Create your administrator user account
  5. Finalization: Complete setup and access your CRM

Dynamic Configuration Management

After installation, use the admin settings panel to manage:

  • Company Information: Update company name and details
  • System Settings: Configure application behavior
  • User Management: Add/remove users and manage API keys
  • Environment Detection: View server environment analysis

API Configuration

  • API Keys: Generate and manage API keys for AI agent integration
  • Rate Limiting: Configure request limits and throttling
  • Webhook Settings: Set up real-time notifications
  • Security Settings: Configure authentication and access controls

๐Ÿ“š Documentation

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the CC-BY-SA License - see the LICENSE file for details.

๐Ÿ†˜ Support

For support and questions:

  • Create an issue on GitHub
  • Check the documentation in the docs/ folder
  • Contact the development team

๐Ÿ”ฎ Roadmap

โœ… Completed (v2.0.0)

  • First boot configuration system
  • Dynamic configuration management
  • MCP-compatible API design
  • Comprehensive test suite (100% coverage)
  • Environment detection and validation
  • Database-driven settings with encryption
  • Webhook system implementation
  • Advanced reporting and analytics
  • User management interface

๐Ÿš€ Near Term (v2.1.0 - v2.3.0)

  • Activity Feed System - Comprehensive activity tracking for contact interactions with chronological feed, memo support, and filtering capabilities (see Feature Planning for details)
  • Sanctum Agent Direct Integration - Built-in chatbot interface for direct AI agent interaction within the CRM
  • MCP Direct Compatibility - Enhanced Model Context Protocol integration for seamless Letta AI and other agentic system connectivity

๐Ÿ”ฎ Future (v2.4.0+)

  • Advanced MCP features for Letta AI
  • Batch operations and bulk imports
  • Advanced filtering & search
  • Real-time collaboration features
  • Mobile app with offline support

Version: 2.0.0
Last Updated: January 2025
License: Dual (AGPLv3 + CC-BY-SA)
Compatibility: Letta AI, MCP Protocol, PHP 8.0+

About

An AI, MCP first CRM reference architecture. Built for SanctumOS.

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
AGPL-3.0
LICENSE-AGPLv3
Unknown
LICENSE-CC-BY-SA

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors