# DODD ERP - Project Overview

## What is DODD?

**DODD** (Domain-Oriented Design & Development) is an open-source, enterprise-grade ERP platform built specifically for Indian businesses while maintaining global standards. It provides a complete suite of business management modules covering manufacturing, distribution, finance, and services.

---

## Vision

> *"Enterprise-grade ERP accessible to every Indian business"*

We believe that world-class business software should not be locked behind million-dollar license fees. DODD aims to democratize enterprise software by providing SAP/Oracle-level capabilities at a fraction of the cost.

---

## Core Principles

### 1. India-First, Global-Ready
- Native GST, E-Invoice, E-Way Bill, TDS/TCS compliance
- Indian Financial Year (April-March) built-in
- Ind AS 115/116 accounting standards
- Designed for Indian business practices, extensible for global markets

### 2. Plugin Architecture
- Every feature is a plugin that can be enabled/disabled
- Easy customization without modifying core code
- Industry-specific profiles (Manufacturing, Retail, Services)
- Third-party plugin ecosystem

### 3. Modern Technology
- TypeScript for type safety and developer experience
- Prisma ORM for database abstraction
- PostgreSQL for reliability and performance
- Event-driven architecture for loose coupling
- REST APIs for integration

### 4. Open Source
- Full source code transparency
- No vendor lock-in
- Community-driven development
- Permissive licensing

---

## Architecture

```
┌─────────────────────────────────────────────────────────────────────────┐
│                           DODD ERP PLATFORM                             │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │                       APPLICATION LAYER                         │   │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐   │   │
│  │  │   MRP   │ │   WMS   │ │ Finance │ │  Sales  │ │   HRM   │   │   │
│  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘   │   │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐   │   │
│  │  │Purchase │ │  Stock  │ │Subscrip.│ │Helpdesk │ │Dashboard│   │   │
│  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘   │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                   │                                     │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │                        PLUGIN LAYER                              │   │
│  │  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐             │   │
│  │  │  Industry    │ │  Compliance  │ │  Integration │             │   │
│  │  │  Profiles    │ │  Plugins     │ │  Connectors  │             │   │
│  │  │ ─────────── │ │ ─────────── │ │ ─────────── │             │   │
│  │  │ Container   │ │ GST/E-Invoice│ │ Tally        │             │   │
│  │  │ Automotive  │ │ TDS/TCS      │ │ Banks        │             │   │
│  │  │ Pharma      │ │ E-Way Bill   │ │ Payment GW   │             │   │
│  │  │ Retail      │ │ TRACES       │ │ Shipping     │             │   │
│  │  └──────────────┘ └──────────────┘ └──────────────┘             │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                   │                                     │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │                         CORE LAYER                               │   │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐   │   │
│  │  │ Plugin  │ │  Event  │ │ Feature │ │  Auth   │ │  Audit  │   │   │
│  │  │Registry │ │   Bus   │ │  Flags  │ │  RBAC   │ │  Trail  │   │   │
│  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘   │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                   │                                     │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │                      INFRASTRUCTURE                              │   │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐               │   │
│  │  │ Prisma  │ │PostgreSQL│ │  Redis  │ │  Queue  │               │   │
│  │  │   ORM   │ │    DB   │ │  Cache  │ │ (Bull)  │               │   │
│  │  └─────────┘ └─────────┘ └─────────┘ └─────────┘               │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘
```

---

## Module Overview

### Production Ready Modules

| Module | Package | Description | Key Features |
|--------|---------|-------------|--------------|
| **Manufacturing** | `dodd-mrp` | Complete MRP system | BOM, Routing, Work Centers, MO/WO, Quality, Scheduling, Costing |
| **Warehouse** | `dodd-wms` | Enterprise WMS | Multi-warehouse, Picking, Putaway, RFID, Voice, Drones, IoT |
| **Inventory** | `dodd-stock` | Inventory management | Multi-location, Valuation, Lot/Serial, Reordering, Cycle Count |
| **Procurement** | `dodd-purchase` | Purchase management | RFQ, PO, Vendor Management, Import, Landed Cost, Customs |
| **Finance** | `dodd-account-enterprise` | Enterprise accounting | Multi-book, Consolidation, Treasury, Revenue Recognition |
| **Subscriptions** | `dodd-subscription` | Billing platform | Subscriptions, AMC, Usage Billing, Revenue Recognition |
| **Helpdesk** | `dodd-helpdesk` | Customer service | Tickets, SLA, Escalation, Knowledge Base |
| **Analytics** | `dodd-dashboard` | Business intelligence | Real-time dashboards, KPIs, Reports |
| **Core** | `dodd-core` | Foundation framework | Plugin system, Event bus, Auth, Multi-tenancy |

### Planned Modules

| Module | Package | Status | Target |
|--------|---------|--------|--------|
| **HRM** | `dodd-hrm` | Planned | Q2 2026 |
| **CRM** | `dodd-crm` | Planned | Q3 2026 |
| **Retail** | `dodd-retail` | Planned | Q3 2026 |
| **AI/ML** | `dodd-ai` | Planned | Q4 2026 |

---

## Indian Compliance (Native)

### GST Compliance
- **GSTR-1**: Outward supplies filing
- **GSTR-2A/2B**: Inward supplies auto-fetch
- **GSTR-3B**: Monthly summary returns
- **GSTR-9**: Annual returns
- **HSN/SAC**: Product classification codes

### E-Invoice
- **NIC/IRP Integration**: Direct government portal integration
- **IRN Generation**: Invoice Reference Number
- **QR Code**: Digitally signed QR codes
- **Bulk Processing**: Mass e-invoice generation
- **JSON Export**: Standard e-invoice format

### E-Way Bill
- **NIC Integration**: Government portal connection
- **Auto-Generation**: From invoices/challans
- **Multi-Vehicle**: Part-B updates
- **Consolidated**: Multiple invoices
- **Cancellation**: With reason codes

### TDS/TCS
- **40+ Sections**: All applicable sections
- **Auto-Deduction**: On payment processing
- **Form 26AS**: Download and reconciliation
- **TRACES Integration**: Certificate management
- **Quarterly Returns**: 24Q, 26Q, 27Q

### Accounting Standards
- **Ind AS 115**: Revenue from Contracts (ASC 606)
- **Ind AS 116**: Leases (IFRS 16)
- **Ind AS 108**: Segment Reporting

---

## Technical Specifications

### Technology Stack

| Layer | Technology | Version |
|-------|------------|---------|
| Language | TypeScript | 5.x |
| Runtime | Node.js | 20.x LTS |
| ORM | Prisma | 5.x |
| Database | PostgreSQL | 15+ |
| Cache | Redis | 7.x |
| Queue | BullMQ | 4.x |
| API | REST/JSON | - |
| Auth | JWT/OAuth2 | - |

### System Requirements

#### Minimum (Small Business, < 50 users)
- CPU: 2 cores
- RAM: 4 GB
- Storage: 50 GB SSD
- Database: PostgreSQL 15+

#### Recommended (Mid-Market, 50-500 users)
- CPU: 8 cores
- RAM: 32 GB
- Storage: 500 GB SSD
- Database: PostgreSQL 15+ (dedicated)
- Cache: Redis 6+

#### Enterprise (500+ users)
- CPU: 16+ cores (scalable)
- RAM: 64+ GB
- Storage: 1+ TB SSD
- Database: PostgreSQL cluster
- Cache: Redis cluster
- Load Balancer: Required

### API Design
- RESTful JSON APIs
- OpenAPI 3.0 specification
- JWT authentication
- Rate limiting
- Request/response logging
- Versioned endpoints (v1, v2)

### Security
- Role-Based Access Control (RBAC)
- Row-level security
- Audit trails
- Data encryption at rest
- TLS 1.3 for transit
- OWASP compliance

---

## Project Structure

```
packages/dodd/
├── packages/
│   ├── dodd-core/                 # Core framework
│   │   ├── src/
│   │   │   ├── plugin-registry/   # Plugin system
│   │   │   ├── event-bus/         # Event system
│   │   │   ├── auth/              # Authentication
│   │   │   └── tenant/            # Multi-tenancy
│   │   └── package.json
│   │
│   ├── dodd-mrp/                  # Manufacturing
│   │   ├── src/
│   │   │   ├── core/              # BOM, Routing, MO, WO
│   │   │   ├── plugins/           # Quality, Scheduling, etc.
│   │   │   ├── profiles/          # Industry profiles
│   │   │   └── services/          # Business logic
│   │   └── package.json
│   │
│   ├── dodd-wms/                  # Warehouse Management
│   ├── dodd-stock/                # Inventory
│   ├── dodd-purchase/             # Procurement
│   ├── dodd-account-enterprise/   # Finance
│   ├── dodd-subscription/         # Billing
│   ├── dodd-helpdesk/             # Customer Service
│   └── dodd-dashboard/            # Analytics
│
├── docs/                          # Documentation
│   ├── comparison_dodd.md         # Incumbent comparison
│   ├── todo_dodd.md               # Development roadmap
│   └── project_dodd.md            # This file
│
└── website/                       # Landing page
    └── index.html
```

---

## Getting Started

### Prerequisites
```bash
# Required
node --version  # v20.x or later
npm --version   # v10.x or later
psql --version  # PostgreSQL 15+

# Optional
redis-cli --version  # Redis 7.x (for caching)
```

### Installation

```bash
# Clone the repository
git clone https://github.com/ankr-labs/dodd-erp.git
cd dodd-erp

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your database credentials

# Run database migrations
npx prisma migrate dev

# Start development server
npm run dev
```

### Quick Start (Docker)

```bash
# Using Docker Compose
docker-compose up -d

# Access the application
open http://localhost:3000
```

---

## Configuration

### Environment Variables

```env
# Database
DATABASE_URL="postgresql://user:pass@localhost:5432/dodd"

# Redis (optional)
REDIS_URL="redis://localhost:6379"

# Authentication
JWT_SECRET="your-secret-key"
JWT_EXPIRES_IN="7d"

# Indian Compliance
GST_PORTAL_API_KEY="your-gst-api-key"
EINVOICE_API_KEY="your-einvoice-key"
EWAYBILL_API_KEY="your-eway-key"
TRACES_USER_ID="your-traces-id"
TRACES_PASSWORD="your-traces-password"

# File Storage
STORAGE_TYPE="local|s3|azure|gcs"
STORAGE_BUCKET="your-bucket"
```

### Feature Flags

```typescript
// config/features.ts
export const features = {
  // Core
  multiTenant: true,
  auditTrail: true,

  // Manufacturing
  bomManagement: true,
  routingManagement: true,
  qualityManagement: true,
  finiteCapacityScheduling: true,

  // Indian Compliance
  gstCompliance: true,
  einvoice: true,
  ewaybill: true,
  tdsCompliance: true,

  // Advanced
  aiRecommendations: false,
  iotIntegration: false,
};
```

---

## Industry Profiles

DODD supports pre-configured industry profiles that enable relevant features and customize terminology.

### Container Manufacturing
```typescript
import { ContainerManufacturingProfile } from 'dodd-mrp/profiles';

// Features enabled:
// - Container specifications (ISO 668, 1496)
// - BIC container serialization
// - Steel coil tracking with heat numbers
// - Weld inspection (VT, UT, MPI)
// - CSC compliance and plate generation
// - Nesting optimization for cutting
```

### Automotive
```typescript
import { AutomotiveProfile } from 'dodd-mrp/profiles';

// Features enabled:
// - VIN generation and tracking
// - Multi-level BOM with variants
// - JIT/Kanban support
// - Quality gates (PPAP, APQP)
// - Supplier quality management
```

### Pharmaceutical
```typescript
import { PharmaProfile } from 'dodd-mrp/profiles';

// Features enabled:
// - Batch/Lot tracking with expiry
// - GMP compliance
// - 21 CFR Part 11 (electronic records)
// - Drug license management
// - Schedule H/H1 tracking
```

---

## API Examples

### Create Manufacturing Order

```typescript
import { MRPService } from 'dodd-mrp';

const mrp = new MRPService(config);

// Create a manufacturing order
const mo = await mrp.createManufacturingOrder({
  productId: 'CONT-40HC',
  quantity: 10,
  plannedStart: new Date('2026-02-01'),
  priority: 'high',
  customerId: 'CUST-001',
});

// Confirm and start production
await mrp.confirmManufacturingOrder(mo.id);
await mrp.startProduction(mo.id);
```

### Generate E-Invoice

```typescript
import { EInvoiceService } from 'dodd-account-enterprise';

const einvoice = new EInvoiceService(config);

// Generate e-invoice
const result = await einvoice.generateEInvoice({
  invoiceId: 'INV-2026-001',
  sellerId: 'SELLER-001',
  buyerId: 'BUYER-001',
});

console.log(result.irn);     // Invoice Reference Number
console.log(result.qrCode);  // Signed QR code
```

### File GST Return

```typescript
import { GSTService } from 'dodd-account-enterprise';

const gst = new GSTService(config);

// Prepare GSTR-1
const gstr1 = await gst.prepareGSTR1({
  period: '012026',  // January 2026
  gstin: '29XXXXX0000X1Z5',
});

// Validate before filing
const validation = await gst.validateGSTR1(gstr1);

// File return
if (validation.isValid) {
  await gst.fileGSTR1(gstr1);
}
```

---

## Contributing

We welcome contributions from the community. Please read our contributing guidelines before submitting pull requests.

### Development Setup

```bash
# Fork and clone
git clone https://github.com/YOUR_USERNAME/dodd-erp.git

# Create feature branch
git checkout -b feature/your-feature

# Make changes and test
npm run test

# Submit pull request
```

### Code Standards
- TypeScript strict mode
- ESLint + Prettier
- 80% minimum test coverage
- Conventional commits
- Documentation for public APIs

---

## Support & Community

- **Documentation**: [docs.dodd-erp.org](https://docs.dodd-erp.org)
- **GitHub Issues**: Bug reports and feature requests
- **Discord**: Community discussions
- **Email**: support@dodd-erp.org

---

## License

DODD ERP is open-source software licensed under the [MIT License](LICENSE).

---

## Acknowledgments

DODD ERP is built on the shoulders of giants:
- [Prisma](https://prisma.io) - Next-generation ORM
- [PostgreSQL](https://postgresql.org) - The world's most advanced open source database
- [TypeScript](https://typescriptlang.org) - JavaScript with syntax for types
- [Node.js](https://nodejs.org) - JavaScript runtime

---

*Built with pride in India for the world.*

**DODD ERP Project Team**
*January 2026*
