پرش به محتویات

ساختار پروژه دارانو (Directory Tree)

این سند ساختار واقعی دایرکتوری پروژه دارانو را نشان می‌دهد. این ساختار بر اساس کدهای موجود در مسیر /home/nfel/Projects/Mellat استخراج شده است.


ساختار کلی پروژه

/Project
├── README.md
├── .gitignore
│
├── backend/                        # Backend Microservices (Go)
│   ├── api/                        # API Gateway (gRPC-REST Gateway)
│   ├── auth/                       # Authentication & Authorization (IAM)
│   └── wallet/                     # Wallet & Blockchain Operations
│
├── kahrobatoken-ui/                # User Interface (Next.js 14)
│
├── AdminPanel/                     # Admin Panel (Django + Poetry)
│
└── proto/                          # Shared Protocol Buffers

1. API Gateway Service

مسیر: backend/api/

api/
├── main.go                         # Entry Point
├── go.mod
├── go.sum
├── Makefile
├── Dockerfile
├── buf.gen.yaml
├── cfg.toml                        # Configuration File
│
├── cmd/
│   ├── root.go                     # CLI Root Command
│   ├── serve.go                    # HTTP Server Command
│   └── ws.go                       # WebSocket Command
│
├── config/
│   └── config.go                   # Configuration Management
│
├── domain/
│   ├── enums/
│   │   └── error.go                # Error Enumerations
│   ├── service_errors/
│   │   ├── catalog.go              # Error Catalog
│   │   └── translate.go            # Error Translation
│   ├── stub/
│   │   └── go/                     # Generated Proto Stubs
│   └── transport/
│       └── res.go                  # Response Types
│
├── handler/
│   ├── main.go                     # Handler Setup
│   ├── routing.go                  # Route Definitions
│   ├── response.go                 # Response Helpers
│   ├── utils.go                    # Handler Utilities
│   ├── internal/
│   │   └── binder.go               # Request Binding
│   ├── authorization.go            # Auth Handlers
│   ├── wallet.go                   # Wallet Handlers
│   ├── irt.go                      # IRT (Fiat) Handlers
│   ├── market.go                   # Market Handlers
│   ├── asset.go                    # Asset Handlers
│   ├── network.go                  # Network Handlers
│   ├── contract.go                 # Contract Handlers
│   ├── bnpl.go                     # BNPL Handlers
│   ├── redeem.go                   # Redeem Handlers
│   └── referral.go                 # Referral Handlers
│
├── service/
│   ├── main.go                     # Service Clients Setup
│   ├── internal/
│   │   └── helper.go               # Service Helpers
│   └── servicesenum_enumer.go      # Service Enums
│
├── middlewares/
│   ├── main.go                     # Middleware Setup
│   ├── cors.go                     # CORS Handler
│   ├── logger.go                   # Request Logging
│   ├── json.go                     # JSON Processing
│   ├── errors.go                   # Error Handler
│   ├── i18n.go                     # Internationalization
│   ├── i18n/
│   │   └── locale/                 # Translation Files
│   ├── profiling.go                # Profiling Middleware
│   └── prometheus.go               # Prometheus Metrics
│
├── logger/
│   └── logger.go                   # Logger Implementation
│
├── util/
│   ├── grpcErr.go                  # gRPC Error Utilities
│   └── http.go                     # HTTP Utilities
│
├── swagger/
│   ├── docs.go                     # Swagger Docs
│   ├── swagger.json                # Swagger JSON
│   └── swagger.yaml                # Swagger YAML
│
├── req/                            # Request Test Files (JS)
│   ├── index.js
│   ├── cfg.js
│   ├── login.js
│   ├── market.js
│   ├── wallet.js
│   ├── withdraw.js
│   ├── redeem.js
│   ├── tfa.js
│   └── utils.js
│
├── log/                            # Application Logs
│   ├── debug-*.log
│   ├── errors-*.log
│   └── info-*.log
│
├── tmp/
│   └── build-errors.log
│
├── static/                         # Static Files
├── build/                          # Build Artifacts
└── README.md

ویژگی‌های کلیدی: - Router: Gin Router - Protocols: HTTP/REST، WebSocket - Middleware: CORS، Logging، i18n، Metrics - Swagger: API Documentation


2. Auth Service (IAM)

مسیر: backend/auth/

auth/
├── main.go                         # Entry Point
├── go.mod
├── go.sum
├── Makefile
├── Dockerfile
├── buf.gen.yaml
├── cfg.toml                        # Configuration File
│
├── cmd/
│   ├── main.go                     # Main Command
│   └── serve.go                    # Server Command
│
├── config/
│   └── config.go                   # Configuration Management
│
├── domain/
│   ├── db/                         # Database Models
│   │   ├── user.go                 # User Model
│   │   ├── identity.go             # Identity Model
│   │   ├── session.go              # Session Model
│   │   ├── permission.go           # Permission Model
│   │   ├── company.go              # Company Model
│   │   ├── bank_info.go            # Bank Info Model
│   │   └── templates.go            # Template Models
│   │
│   ├── dto/                        # Data Transfer Objects
│   │   ├── user.go
│   │   ├── otp.go
│   │   └── person.go
│   │
│   ├── enum/                       # Enumerations
│   │   ├── permission.go
│   │   ├── session.go
│   │   └── redis-key.go
│   │
│   ├── inner/                      # Internal Domain Types
│   │   └── authorization.go
│   │
│   ├── transport/                  # External Service DTOs
│   │   ├── ehraz.go                # Ehraz KYC
│   │   ├── pecco.go                # Pecco
│   │   └── zohal.go                # Zohal KYC
│   │
│   └── stub/
│       └── go/                     # Generated Proto Stubs
│
├── repository/
│   ├── main.go                     # Repository Setup
│   ├── iDB.go                      # Database Interface
│   ├── iRedis.go                   # Redis Interface
│   ├── iService.go                 # Service Interface
│   ├── iInternal.go                # Internal Interface
│   ├── user.go                     # User Repository
│   ├── identity.go                 # Identity Repository
│   ├── permission.go               # Permission Repository
│   ├── session.go                  # Session Repository
│   ├── otp.go                      # OTP Repository
│   ├── inquiry.go                  # Inquiry Repository
│   │
│   ├── db/
│   │   ├── postgres/               # PostgreSQL Implementation
│   │   ├── redis/                  # Redis Implementation
│   │   └── mongo/                  # MongoDB (if used)
│   │
│   └── service/                    # External Services
│       ├── main.go
│       ├── servicesenum_enumer.go
│       ├── darano.go               # Internal Darano Service
│       ├── wallet.go               # Wallet Service Client
│       ├── kavenegar.go            # SMS Service
│       ├── ehraz.go                # Ehraz KYC
│       ├── pecco.go                # Pecco Service
│       └── zohal.go                # Zohal KYC
│
├── usecase/                        # Business Logic Layer
│   ├── main.go
│   ├── authorization.go            # Auth Use Cases
│   ├── identity.go                 # Identity Use Cases
│   ├── permission.go               # Permission Use Cases
│   ├── tfa.go                      # Two-Factor Auth
│   ├── bankinfo.go                 # Bank Info Management
│   ├── cache.go                    # Cache Management
│   ├── health.go                   # Health Checks
│   └── internal.go                 # Internal Use Cases
│
├── util/
│   ├── auth.go                     # Auth Utilities
│   ├── hash.go                     # Password Hashing (bcrypt)
│   ├── grpcErr.go                  # gRPC Error Handling
│   ├── http.go                     # HTTP Utilities
│   ├── goRetry.go                  # Retry Logic
│   ├── amount.go                   # Amount Handling
│   ├── validation.go               # Input Validation
│   ├── string.go                   # String Utilities
│   └── persian-english.go          # Persian/English Conversion
│
├── jwt/
│   ├── jwt.key                     # JWT Private Key
│   └── jwt.pub                     # JWT Public Key
│
├── scripts/
│   └── referral_code_migration.go  # Referral Code Migration
│
├── logger/
│   └── main.go                     # Logger Implementation
│
├── log/                            # Application Logs
│   ├── debug-*.log
│   ├── errors-*.log
│   └── info-*.log
│
├── build/                          # Build Artifacts
│   └── main
│
└── README.md

ویژگی‌های کلیدی: - Architecture: Clean Architecture (Domain → Repository → Use Case) - ORM: GORM - Database: PostgreSQL - Cache: Redis - Auth: JWT + OTP - KYC Integration: Ehraz، Zohal، Pecco - RBAC/ABAC: Permission Management


3. Wallet Service

مسیر: backend/wallet/

wallet/
├── main.go                         # Entry Point
├── go.mod
├── go.sum
├── Makefile
├── Dockerfile
├── buf.gen.yaml
├── wallet.cfg.toml                 # Wallet Config
├── wallet.internal.cfg.toml        # Internal Wallet Config
├── market.cfg.toml                 # Market Config
├── alert.cfg.toml                  # Alert Config
├── stream.cfg.toml                 # Streamer Config
├── TODO.md
│
├── cmd/
│   ├── main.go                     # Main CLI
│   ├── cron.go                     # Cron Jobs
│   ├── stream.go                   # Blockchain Streamer
│   ├── stellar.go                  # Stellar Commands
│   ├── mnemonic.go                 # Mnemonic Commands
│   │
│   ├── cmdServe/                   # Server Commands
│   │   ├── main.go
│   │   ├── wallet.go               # Wallet gRPC Server
│   │   ├── internal_wallet.go      # Internal Wallet Server
│   │   ├── market.go               # Market gRPC Server
│   │   └── alert.go                # Alert gRPC Server
│   │
│   └── helper/                     # Helper Commands
│       ├── init.go
│       └── repo.go
│
├── config/
│   └── config.go                   # Configuration Management
│
├── domain/
│   ├── db/                         # Database Models
│   │   ├── main.go
│   │   ├── wallet.go               # Wallet Model
│   │   ├── transaction.go          # Transaction Model
│   │   ├── accounting.go           # Accounting Model
│   │   ├── asset.go                # Asset Model
│   │   ├── asset_whitelist.go      # Asset Whitelist
│   │   ├── network.go              # Network Model
│   │   ├── payments.go             # Payment Model
│   │   ├── market.go               # Market Model
│   │   ├── contract.go             # Contract Model
│   │   ├── bnpl.go                 # Buy Now Pay Later
│   │   ├── redeem.go               # Redeem Model
│   │   ├── discount.go             # Discount Model
│   │   ├── commission.go           # Commission Model
│   │   └── federation.go           # Federation Model
│   │
│   ├── auth/
│   │   └── user.go                 # Auth User DTO
│   │
│   ├── enum/                       # Enumerations
│   │   ├── transaction.go
│   │   ├── asset.go
│   │   ├── federation.go
│   │   └── redis_key.go
│   │
│   ├── const/                      # Constants
│   │   ├── main.go
│   │   └── dict.go
│   │
│   └── stub/
│       └── go/                     # Generated Proto Stubs
│
├── core/                           # Core Business Logic
│   ├── walletImp/                  # Wallet Implementation
│   │   ├── main.go
│   │   ├── wallet.go               # Wallet Operations
│   │   ├── asset.go                # Asset Operations
│   │   ├── transaction.go          # Transaction Processing
│   │   ├── transfer.go             # Transfer Logic
│   │   ├── buy.go                  # Buy Logic
│   │   ├── irt.go                  # IRT (Fiat) Operations
│   │   ├── irt_devmode.go          # Dev Mode IRT
│   │   ├── ipg.go                  # Payment Gateway
│   │   ├── network.go              # Network Operations
│   │   ├── federation.go           # Federation
│   │   ├── contract.go             # Smart Contract
│   │   ├── bnpl.go                 # BNPL Logic
│   │   ├── redeem.go               # Redeem Logic
│   │   ├── discount.go             # Discount Logic
│   │   ├── commission.go           # Commission Calculation
│   │   ├── admin.go                # Admin Operations
│   │   ├── lock.go                 # Locking Mechanism
│   │   └── health.go               # Health Checks
│   │
│   ├── marketImp/                  # Market Implementation
│   │   ├── main.go
│   │   ├── market.go               # Market Operations
│   │   ├── irt.go                  # IRT Market
│   │   ├── contract.go             # Contract Trading
│   │   └── errors.go               # Market Errors
│   │
│   ├── alertImp/                   # Alert Implementation
│   │   ├── main.go
│   │   └── user_event.go           # User Event Alerts
│   │
│   └── cronJobs/                   # Scheduled Jobs
│       ├── main.go
│       └── vacuum.go               # Database Vacuum
│
├── port/                           # Blockchain Port (Adapter)
│   └── stellar/                    # Stellar/Kuknos Integration
│       ├── connection.go           # Blockchain Connection
│       ├── activation.go           # Account Activation
│       ├── balance.go              # Balance Queries
│       ├── transfer.go             # Transfer Operations
│       ├── trustLine.go            # TrustLine Management
│       ├── checkTrustLine.go       # TrustLine Validation
│       ├── issue-token.go          # Token Issuance
│       ├── stream.go               # Transaction Streaming
│       ├── gasStation.go           # Gas Station
│       ├── getPublicKey.go         # Public Key Retrieval
│       ├── recoverKey.go           # Key Recovery
│       ├── log.go                  # Blockchain Logging
│       └── util.go                 # Utilities
│
├── repository/
│   ├── main.go                     # Repository Setup
│   ├── iDB.go                      # Database Interface
│   ├── iRedis.go                   # Redis Interface
│   ├── iService.go                 # Service Interface
│   ├── iQueue.go                   # Queue Interface
│   ├── asset.go                    # Asset Repository
│   ├── bnpl.go                     # BNPL Repository
│   ├── lock.go                     # Lock Repository
│   ├── user.go                     # User Repository
│   ├── sms.go                      # SMS Repository
│   │
│   ├── db/
│   │   ├── postgres/               # PostgreSQL Implementation
│   │   └── redis/                  # Redis Implementation
│   │
│   ├── service/                    # External Services
│   │   ├── darano/                 # Darano Service
│   │   ├── kavenegar/              # SMS Service
│   │   ├── mellat/                 # Mellat Bank Gateway
│   │   └── vandar/                 # Vandar Gateway
│   │
│   ├── queue/                      # Message Queue
│   │   ├── main.go
│   │   └── transaction.go          # Transaction Queue
│   │
│   └── mailer/                     # Email Service
│       └── smtp.go                 # SMTP Client
│
├── util/
│   ├── crypto/                     # Cryptography
│   │   ├── main.go
│   │   ├── ed25519.go              # ED25519 Keys
│   │   └── rsa.go                  # RSA Keys
│   ├── grpcErr.go                  # gRPC Errors
│   ├── http.go                     # HTTP Utilities
│   ├── hash.go                     # Hashing
│   ├── goRetry.go                  # Retry Logic
│   ├── array.go                    # Array Utilities
│   ├── string.go                   # String Utilities
│   ├── number.go                   # Number Utilities
│   ├── time.go                     # Time Utilities
│   └── trackingCode.go             # Tracking Code Generation
│
├── gen/                            # Generated Code
│   └── go/
│       ├── wallet/
│       ├── market/
│       ├── alert/
│       └── auth/
│
├── logger/
│   └── main.go                     # Logger Implementation
│
├── log/                            # Application Logs
│   ├── debug-*.log
│   ├── errors-*.log
│   └── info-*.log
│
├── tmp/
│   ├── build-errors.log
│   ├── dump.sql
│   └── main
│
├── build/                          # Build Artifacts
└── README.md

ویژگی‌های کلیدی: - Architecture: Hexagonal (Port & Adapter) + Clean Architecture - Blockchain: Stellar/Kuknos SDK - Database: PostgreSQL - Cache: Redis - Message Queue: RabbitMQ (via queue repository) - Multiple Servers: Wallet، Market، Alert، Internal Wallet - Streamer: Blockchain Transaction Monitoring - HD Wallet: Hierarchical Deterministic Wallet Support


4. Frontend - User Interface

مسیر: kahrobatoken-ui/

kahrobatoken-ui/
├── package.json
├── pnpm-lock.yaml
├── next.config.mjs                 # Next.js Configuration
├── next-env.d.ts
├── tsconfig.json                   # TypeScript Config
├── tailwind.config.js              # Tailwind CSS Config
├── postcss.config.js               # PostCSS Config
├── Dockerfile
├── makefile
├── buf.gen.yaml
├── yarn.lock
│
├── src/
│   ├── app/                        # Next.js 14 App Router
│   │   ├── layout.tsx              # Root Layout
│   │   ├── page.tsx                # Home Page
│   │   ├── globals.css             # Global Styles
│   │   ├── page.module.css
│   │   ├── favicon.ico
│   │   ├── global-error.tsx
│   │   ├── not-found.tsx
│   │   │
│   │   ├── auth/                   # Authentication Pages
│   │   ├── dashboard/              # Dashboard Pages
│   │   ├── projects/               # Project Pages
│   │   ├── about-us/               # About Us Page
│   │   ├── blog/                   # Blog Pages
│   │   ├── contact/                # Contact Page
│   │   ├── faq/                    # FAQ Page
│   │   ├── content/                # Content Pages
│   │   ├── terms/                  # Terms & Conditions
│   │   ├── receipt/                # Receipt Page
│   │   │
│   │   └── api/                    # API Routes (NextAuth, etc.)
│   │
│   ├── components/                 # React Components
│   │   ├── AppVersion.tsx
│   │   ├── TestEnvironmentAlert.tsx
│   │   │
│   │   ├── Auth/                   # Auth Components
│   │   ├── Dashboard/              # Dashboard Components
│   │   ├── Home/                   # Home Components
│   │   ├── Header/                 # Header Component
│   │   ├── Footer/                 # Footer Component
│   │   ├── Blog/                   # Blog Components
│   │   ├── Breadcrumb/             # Breadcrumb
│   │   ├── DashboardBreadcrumb/
│   │   │
│   │   ├── Buy/                    # Purchase Components
│   │   ├── MarketPlace/            # Market Components
│   │   ├── TokenWallet/            # Wallet Components
│   │   ├── TokenTransactions/      # Transaction Components
│   │   ├── BankInformation/        # Bank Info
│   │   ├── FinancialTransactionsTable/
│   │   │
│   │   ├── ProjectGallery/         # Project Gallery
│   │   ├── MediaSlider/            # Media Slider
│   │   ├── EmblaCarousel/          # Carousel
│   │   ├── HorizontalScroll/       # Horizontal Scroll
│   │   │
│   │   ├── CurrencyInputPanel/     # Currency Input
│   │   ├── CurrencySelect/         # Currency Select
│   │   ├── ProjectStatusChip/      # Status Chip
│   │   ├── PageTitleWrapper/       # Page Title
│   │   ├── SocialMediaLinks/       # Social Links
│   │   ├── SCircularProgress/      # Progress Indicator
│   │   ├── ShineBorder/            # UI Effect
│   │   │
│   │   ├── KycRequireModal/        # KYC Modal
│   │   ├── TFAModal/               # 2FA Modal
│   │   ├── SubmitPersonalInfoModal/# Personal Info Modal
│   │   │
│   │   ├── HCaptcha/               # Captcha Component
│   │   ├── RayChat/                # Chat Widget
│   │   ├── ClarityAnalytics/       # Analytics
│   │   │
│   │   ├── Table/                  # Table Components
│   │   ├── TabNavigation/          # Tab Navigation
│   │   ├── Terms/                  # Terms Components
│   │   ├── ThemeRegistry/          # Theme Provider
│   │   │
│   │   ├── mdx/                    # MDX Components
│   │   └── ui/                     # Base UI Components
│   │
│   ├── services/                   # API Services
│   │   ├── Api.tsx                 # Base API Client
│   │   ├── AuthService.ts          # Auth API
│   │   ├── WalletService.ts        # Wallet API
│   │   ├── MarketService.ts        # Market API
│   │   │
│   │   └── actions/                # Server Actions
│   │
│   ├── hooks/                      # Custom Hooks
│   │   ├── useApi.ts
│   │   ├── useDebounce.ts
│   │   ├── useScrollToElement.ts
│   │   ├── useServerAction.ts
│   │   ├── useUiLoadTimeout.ts
│   │   └── useVideoThumbs.ts
│   │
│   ├── utils/                      # Utility Functions
│   │   ├── AppError.ts
│   │   ├── MyError.ts
│   │   ├── HandleError.ts
│   │   ├── authOptions.ts
│   │   ├── constants.ts
│   │   ├── formatNumberWithCommas.ts
│   │   ├── FormatString.ts
│   │   ├── NormalizeDecimal.ts
│   │   ├── sanitizeAmountString.ts
│   │   ├── CalculateTotalAssetValue.ts
│   │   ├── createQueryString.ts
│   │   ├── generateDepositId.ts
│   │   ├── getPersianDate.ts
│   │   ├── jalaliUtils.ts
│   │   ├── isValidIranianNationalCode.ts
│   │   ├── MaskPhoneNumber.ts
│   │   └── StringToColor.ts
│   │
│   ├── types/                      # TypeScript Types
│   │   ├── next-auth.d.ts
│   │   ├── svg.d.ts
│   │   └── stub/                   # Generated Proto Types
│   │
│   ├── interfaces/                 # Interfaces
│   │   ├── Service.ts
│   │   └── ui.ts
│   │
│   ├── assets/
│   │   └── icons/                  # SVG Icons
│   │
│   └── middleware.ts               # Next.js Middleware
│
├── public/                         # Static Assets
│   ├── icons/                      # Icon Files
│   │   ├── dashboard/
│   │   ├── txIcons/
│   │   ├── banks/
│   │   └── *.svg
│   │
│   ├── images/                     # Images
│   │   ├── blog/
│   │   ├── partners/
│   │   ├── receipt/
│   │   ├── v2/
│   │   └── *.svg, *.png
│   │
│   └── logos/                      # Logo Files
│       ├── darano-logo.svg
│       ├── darano-logo-horizontal.svg
│       ├── darano-logo-horizontal-dark.svg
│       └── darano-logo-vertical.svg
│
└── README.md

ویژگی‌های کلیدی: - Framework: Next.js 14 با App Router - Styling: Tailwind CSS - State Management: React Hooks + Context - Authentication: NextAuth.js - UI Components: Material-UI (implied from component names) - i18n: Persian (RTL) Support - Analytics: Clarity Analytics - Chat: RayChat Integration


5. Frontend - Admin Panel

مسیر: AdminPanel/

AdminPanel/
├── pyproject.toml                  # Poetry Dependencies
├── poetry.lock                     # Poetry Lock File
├── Makefile
├── Dockerfile
├── docker-entrypoint.sh
├── buf.gen.yaml
├── db.sqlite                       # SQLite (Dev)
│
├── src/                            # Django Project Source
│   ├── manage.py                   # Django Management
│   │
│   ├── adminpanel/                 # Main Django App
│   │   ├── __init__.py
│   │   ├── settings.py             # Settings
│   │   ├── urls.py                 # URL Configuration
│   │   ├── wsgi.py                 # WSGI
│   │   ├── asgi.py                 # ASGI
│   │   ├── gunicorn.conf.py        # Gunicorn Config
│   │   ├── sites.py                # Admin Sites
│   │   ├── unfoldconf.py           # Unfold Admin Config
│   │   │
│   │   ├── db/                     # Database Utilities
│   │   │
│   │   └── management/             # Management Commands
│   │
│   ├── accounts/                   # User Accounts App
│   │   ├── __init__.py
│   │   ├── apps.py
│   │   ├── admin.py                # Admin Interface
│   │   ├── models.py               # User Models
│   │   ├── views.py
│   │   └── tests.py
│   │
│   ├── coreLogic/                  # Core Business Logic App
│   │   ├── __init__.py
│   │   ├── apps.py
│   │   ├── models.py               # Core Models
│   │   ├── admin.py
│   │   ├── views.py
│   │   ├── urls.py
│   │   ├── signals.py              # Django Signals
│   │   ├── enums.py                # Enumerations
│   │   ├── acl.py                  # Access Control
│   │   ├── groups.py               # User Groups
│   │   │
│   │   ├── admin/                  # Admin Customizations
│   │   ├── management/             # Custom Commands
│   │   ├── templates/              # Templates
│   │   └── tests.py
│   │
│   ├── alerts/                     # Alerts App
│   │   ├── __init__.py
│   │   ├── apps.py
│   │   ├── admin.py
│   │   ├── models.py               # Alert Models
│   │   ├── views.py
│   │   ├── signals.py
│   │   ├── enums.py
│   │   └── tests.py
│   │
│   ├── usermapper/                 # User Mapping App
│   │   ├── __init__.py
│   │   ├── apps.py
│   │   ├── admin.py
│   │   ├── models.py
│   │   ├── views.py
│   │   ├── user_perm.py            # User Permissions
│   │   │
│   │   ├── management/             # Commands
│   │   └── tests.py
│   │
│   ├── utils/                      # Utility Functions
│   │   ├── __init__.py
│   │   ├── base_admin.py           # Base Admin Classes
│   │   ├── cache.py                # Cache Utilities
│   │   ├── custom_fields.py        # Custom Form Fields
│   │   ├── enum_to_choices.py      # Enum Converters
│   │   ├── jalali_template_engine.py # Jalali Date Support
│   │   ├── sms.py                  # SMS Utilities
│   │   └── zfixtures.py            # Fixtures
│   │
│   ├── src/
│   │   └── stub/                   # Proto Stubs (Python)
│   │
│   ├── locale/                     # Translations
│   │   ├── fa/                     # Persian Translation
│   │   ├── index.lokalize
│   │   └── main.lqa
│   │
│   ├── templates/                  # Django Templates
│   │   ├── admin/                  # Admin Templates
│   │   ├── corelogic/
│   │   └── unfold-tmp/
│   │
│   ├── static/                     # Static Files (Development)
│   │   ├── admin/
│   │   ├── css/
│   │   ├── img/
│   │   ├── logo/
│   │   ├── guardian/
│   │   ├── import_export/
│   │   ├── debug_toolbar/
│   │   ├── unfold/
│   │   ├── override.css
│   │   ├── favicon.ico
│   │   └── staticfiles.json
│   │
│   ├── staticfiles/                # Collected Static Files (Production)
│   │   ├── admin/
│   │   ├── admin_persian/
│   │   ├── django_jsonform/
│   │   ├── django_svelte_jsoneditor/
│   │   ├── django_tinymce/
│   │   ├── dist/
│   │   ├── fonts/
│   │   ├── tinymce/
│   │   └── unfold/
│   │
│   └── db.sqlite                   # SQLite Database (Dev)
│
├── tests/
│   └── __init__.py
│
├── venv/                           # Virtual Environment
│   ├── bin/
│   ├── lib/
│   └── pyvenv.cfg
│
└── README.md

ویژگی‌های کلیدی: - Framework: Django 4+ - Package Manager: Poetry - Admin UI: Django Unfold (Modern Admin Interface) - Database: PostgreSQL (Production)، SQLite (Development) - i18n: Persian Support با Jalali Calendar - Apps: Accounts، CoreLogic، Alerts، UserMapper - Features: ACL، Groups، Signals، Custom Fields - WYSIWYG: TinyMCE - JSON Editor: Svelte JSON Editor - Import/Export: django-import-export - Guardian: Object-level Permissions


6. Shared (Protobuf)

مسیر: proto/

proto/
├── buf.yaml                        # Buf Configuration
├── buf.gen.yaml                    # Code Generation Config
├── template.buf.gen.yaml           # Template Config
├── package.json
├── package-lock.json
├── yarn.lock
├── README.md
│
├── auth/
│   └── v1/                         # Auth Service Protos
│
├── wallet/
│   └── v1/                         # Wallet Service Protos
│
├── market/
│   └── v1/                         # Market Service Protos
│
├── alert/
│   └── v1/                         # Alert Service Protos
│
├── base/
│   └── v1/                         # Base/Common Protos
│
├── errors/
│   └── v1/                         # Error Definitions
│
├── stub/
│   └── py/                         # Generated Python Stubs
│
├── node_modules/                   # Node Dependencies
│   ├── @bufbuild/
│   ├── @typescript/
│   ├── typescript/
│   ├── debug/
│   └── ms/
│
└── v/                              # Python Virtual Env
    ├── bin/
    ├── lib/
    └── pyvenv.cfg

ویژگی‌های کلیدی: - Tool: Buf (Protocol Buffers Management) - Versioning: v1 for all services - Generated Code: Go، Python، TypeScript - Services: Auth، Wallet، Market، Alert - Common: Base types، Error definitions


فایل‌های مهم در Root

/home/nfel/Projects/Mellat/
├── README.md                       # Project Overview
├── .gitignore                      # Git Ignore Rules
│
├── backend/                        # Backend Services
├── kahrobatoken-ui/                # User Interface
├── AdminPanel/                     # Admin Panel
└── proto/                          # Protocol Buffers

نکات مهم

1. تکنولوژی‌ها

سرویس زبان/Framework دیتابیس Cache Message Queue Blockchain
API Gateway Go + Gin Router - Redis - -
Auth Service Go + GORM PostgreSQL Redis - -
Wallet Service Go + Stellar SDK PostgreSQL Redis RabbitMQ Stellar/Kuknos
User UI Next.js 14 + TypeScript - - - -
Admin Panel Django 4 + Poetry PostgreSQL - - -

2. Communication

  • Frontend ↔ API Gateway: REST/JSON (HTTPS)
  • API Gateway ↔ Backend Services: gRPC (Internal)
  • Services ↔ Database: PostgreSQL Driver (GORM for Go، Django ORM for Python)
  • Services ↔ Cache: Redis Protocol
  • Wallet ↔ Blockchain: Stellar Horizon API (HTTPS)
  • Services ↔ Queue: RabbitMQ Protocol

3. Architecture Patterns

  • API Gateway: Proxy Pattern، Middleware Chain
  • Auth Service: Clean Architecture (Domain → Repository → Use Case)
  • Wallet Service: Hexagonal Architecture (Port & Adapter) + Clean Architecture
  • Admin Panel: Django MVT Pattern

4. مسیرهای پیکربندی

سرویس فایل پیکربندی مسیر
API Gateway cfg.toml backend/api/cfg.toml
Auth Service cfg.toml backend/auth/cfg.toml
Wallet Service *.cfg.toml backend/wallet/*.cfg.toml (4 files)
UI .env.* kahrobatoken-ui/.env.*
Admin Panel settings.py AdminPanel/src/adminpanel/settings.py

5. Proto Generation

  • Command: buf generate
  • Output:
  • Go: domain/stub/go/ or gen/go/
  • Python: stub/py/
  • TypeScript: types/stub/

6. Multiple Wallet Servers

Wallet Service دارای چندین سرور مجزا است:

  • Wallet gRPC Server: عملیات اصلی کیف پول
  • Internal Wallet Server: عملیات داخلی
  • Market gRPC Server: عملیات بازار
  • Alert gRPC Server: سیستم اعلان‌ها
  • Blockchain Streamer: نظارت بر تراکنش‌های بلاکچین

7. Deployment Environments

  • srv-main: Production اصلی
  • srv-dev: محیط توسعه
  • srv-demo: محیط دمو