Skip to content

8-Sync-Dev/8crm

Repository files navigation

8CRM - Agentic AI CRM Platform

8CRM Logo

Nền tảng CRM thế hệ mới với Agentic AI tích hợp sâu

FeaturesArchitectureGetting StartedDevelopmentDeployment


Features

🤖 Agentic AI Native

  • AI Lead Qualification: Tự động đánh giá và phân loại leads
  • Smart Email Drafting: AI viết email cá nhân hóa dựa trên context
  • Predictive Analytics: Dự đoán win rate, churn risk, revenue forecast
  • Knowledge Retrieval: RAG-based Q&A từ company knowledge base

📊 Core CRM

  • Contact Management: Quản lý contacts, leads, accounts với AI enrichment
  • Sales Pipeline: Visual deal board với drag-and-drop
  • Activity Timeline: Timeline view với AI summarization
  • Multi-Channel Inbox: Email, Zalo, SMS trong một giao diện

🚀 Platform

  • Multi-Tenant: Isolated data per organization
  • Event-Driven: AI agents react to business events in real-time
  • Type-Safe: End-to-end TypeScript với Encore RPC
  • Vietnam-Ready: Zalo integration, PayOS billing, Vietnamese AI

Architecture

┌─────────────────────────────────────────────────────────────┐
│                        Frontend Layer                        │
│                    (Next.js 16 + React 19)                  │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐  │
│  │  Dashboard│  │ Contacts │  │  Deals   │  │  Inbox   │  │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘  │
└─────────────────────────────────────────────────────────────┘
                              ↓ Encore RPC (Type-Safe)
┌─────────────────────────────────────────────────────────────┐
│                     Backend Services (Encore)                │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │ contacts-svc │  │  deals-svc   │  │activities-svc│     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │ campaigns-svc│  │  auth-svc    │  │ billing-svc  │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
└─────────────────────────────────────────────────────────────┘
                              ↓ Pub/Sub Events
┌─────────────────────────────────────────────────────────────┐
│                    AI Orchestration Layer                    │
│  ┌──────────────────┐  ┌──────────────────┐                │
│  │ ai-orchestration │  │   rag-service    │                │
│  │  (LangGraph)     │  │   (pgvector)     │                │
│  └──────────────────┘  └──────────────────┘                │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│                      Data Layer                              │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │ PostgreSQL   │  │  Redis Cache │  │ Object Store │     │
│  │ (Drizzle)    │  │  (Encore)    │  │  (R2/S3)     │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
└─────────────────────────────────────────────────────────────┘

Tech Stack

Backend

Frontend

Infrastructure

  • Runtime: Node.js 20+ / Bun
  • Package Manager: pnpm + Turborepo
  • CI/CD: GitHub Actions
  • Deployment: Encore Cloud / Self-hosted Kubernetes

Getting Started

Prerequisites

  • Node.js 20+ or Bun
  • pnpm 9+
  • Docker (for local PostgreSQL)
  • Encore CLI (install guide)

Installation

# Clone repository
git clone https://github.com/your-org/8crm.git
cd 8crm

# Install dependencies
pnpm install

# Setup environment variables
cp .env.example .env

# Start PostgreSQL (Docker)
docker-compose up -d postgres

# Run database migrations
pnpm --filter backend db:migrate

# Start development servers
pnpm dev

Environment Variables

Create .env file in root:

# AI Providers
MISTRAL_API_KEY=your_mistral_key
OPENAI_API_KEY=your_openai_key  # Optional fallback

# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/8crm

# Auth
JWT_SECRET=your_jwt_secret
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

# Payments (Vietnam)
PAYOS_CLIENT_ID=your_payos_client_id
PAYOS_API_KEY=your_payos_api_key

# Encore
ENCORE_APP_ID=your_encore_app_id

Development

Project Structure

8crm/
├── apps/
│   ├── web/                 # Next.js frontend
│   │   ├── src/
│   │   │   ├── app/        # App Router pages
│   │   │   ├── components/ # React components
│   │   │   ├── hooks/      # Custom hooks
│   │   │   └── lib/        # Utilities
│   │   └── package.json
│   └── backend/             # Encore backend
│       ├── src/
│       │   ├── apps/       # Microservices
│       │   │   ├── contacts/
│       │   │   ├── deals/
│       │   │   └── ai-orchestration/
│       │   └── common/     # Shared utilities
│       └── encore.app
├── packages/
│   ├── ui/                  # Shared UI components
│   ├── utils/               # Shared utilities
│   ├── types/               # Shared TypeScript types
│   └── eslint-config/       # ESLint configuration
├── docs/                    # Documentation
└── .gsd/                    # GSD project artifacts

Available Scripts

# Development
pnpm dev              # Start all apps in dev mode
pnpm --filter web dev # Start only frontend
pnpm --filter backend dev # Start only backend

# Building
pnpm build            # Build all apps
pnpm --filter web build

# Testing
pnpm test             # Run all tests
pnpm --filter backend test

# Linting
pnpm lint             # Lint all code
pnpm format           # Format with Prettier

# Database
pnpm --filter backend db:generate # Generate Drizzle migrations
pnpm --filter backend db:migrate  # Run migrations
pnpm --filter backend db:studio   # Open Drizzle Studio

Creating a New Service

# Using Encore CLI
cd apps/backend
encore run service:create

# Or manually
mkdir -p src/apps/my-service/{db,agent,ai}
touch src/apps/my-service/{encore.service.ts,my-service.controller.ts}

AI Agent Development

// src/apps/my-service/agent/graph.ts
import { StateGraph, Annotation } from "@langchain/langgraph";

const GraphState = Annotation.Root({
  input: Annotation<string>,
  output: Annotation<string>,
});

const workflow = new StateGraph(GraphState)
  .addNode("process", async (state) => {
    // Your AI logic here
    return { output: "AI response" };
  })
  .addEdge(START, "process")
  .addEdge("process", END);

export const myAgent = workflow.compile();

Deployment

Encore Cloud (Recommended)

# Link to Encore app
encore app link

# Deploy to production
encore deploy --env production

# View logs
encore logs --env production

Self-Hosted (Kubernetes)

# Build Docker images
docker-compose build

# Deploy to Kubernetes
kubectl apply -f k8s/

Documentation

Roadmap

Phase 1: Foundation (Q2 2026)

  • Project setup & architecture
  • Core CRM services (contacts, deals, activities)
  • Basic AI integration
  • Authentication & multi-tenancy

Phase 2: Intelligence (Q3 2026)

  • Advanced AI agents
  • RAG knowledge base
  • Predictive analytics
  • Campaign automation

Phase 3: Integration (Q4 2026)

  • Email providers (Gmail, Outlook)
  • Zalo integration
  • Calendar sync
  • Third-party marketplace

Phase 4: Scale (Q1 2027)

  • Billing & subscription
  • Analytics dashboards
  • Performance optimization
  • Mobile app (PWA)

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the Mozilla Public License 2.0 - see LICENSE for details.

Acknowledgments


Built with ❤️ in Vietnam 🇻🇳

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors