Nền tảng CRM thế hệ mới với Agentic AI tích hợp sâu
Features • Architecture • Getting Started • Development • Deployment
- 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
- 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
- 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
┌─────────────────────────────────────────────────────────────┐
│ 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) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
- Framework: Encore.ts - Declarative backend framework
- AI: LangGraph + Vercel AI SDK
- Database: PostgreSQL + Drizzle ORM
- Vector Store: pgvector extension
- AI Models: Mistral AI (primary), OpenAI (fallback)
- Framework: Next.js 16 (App Router)
- UI: Radix UI + TailwindCSS 4
- State: React Server Components + Zustand
- Forms: React Hook Form + Zod
- Runtime: Node.js 20+ / Bun
- Package Manager: pnpm + Turborepo
- CI/CD: GitHub Actions
- Deployment: Encore Cloud / Self-hosted Kubernetes
- Node.js 20+ or Bun
- pnpm 9+
- Docker (for local PostgreSQL)
- Encore CLI (install guide)
# 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 devCreate .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_id8crm/
├── 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
# 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# 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}// 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();# Link to Encore app
encore app link
# Deploy to production
encore deploy --env production
# View logs
encore logs --env production# Build Docker images
docker-compose build
# Deploy to Kubernetes
kubectl apply -f k8s/- Project setup & architecture
- Core CRM services (contacts, deals, activities)
- Basic AI integration
- Authentication & multi-tenancy
- Advanced AI agents
- RAG knowledge base
- Predictive analytics
- Campaign automation
- Email providers (Gmail, Outlook)
- Zalo integration
- Calendar sync
- Third-party marketplace
- Billing & subscription
- Analytics dashboards
- Performance optimization
- Mobile app (PWA)
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the Mozilla Public License 2.0 - see LICENSE for details.
- Encore.dev for the amazing backend framework
- LangChain for AI orchestration tools
- Radix UI for accessible UI primitives
- TailwindCSS for utility-first CSS
Built with ❤️ in Vietnam 🇻🇳