⚡
Challenges
- Need for an automatic investment system without trading knowledge
- Accurate calculation of 3% weekly profit for active investments
- Managing referral system with 1% profit calculation
- Automatic Word contract generation for insurance sales
- Need for admin panel with complete statistics and charts
- Comprehensive SEO system with 4 content types support
- USDT-TRC20 and Stripe payment integration
- Jalali date management throughout the system
- Online consultation system with three communication methods
💡
Solutions
- Implementing Capitals model for investment management
- Automatic weekly profit calculation with timedelta and datetime
- Implementing referral system with self-referencing ForeignKey (introducer)
- Using python-docx for contract generation with B Nazanin font
- Designing admin panel with ApexCharts for statistics display
- Implementing Seo model for 4 content types (articles, questions, experiences, video)
- Payment integration with TRC20 address and Stripe gateway
- Using JalaliDate and persiantools for Jalali date
- Implementing Counseling model for consultation with three methods (online, phone, visit)
- Using xlwt for Excel export
📚
Outcomes
- Complete decentralized investment platform
- Automatic 3% weekly profit system
- Referral system with 1% income
- Automatic Word contract generation
- Admin panel with complete statistics
- Comprehensive SEO system with 4 content types
- USDT-TRC20 and Stripe payment
- Full Jalali date support
- Consultation system with three methods
🔧
Technical Highlights
- Django 4.2.6 and Python 3
- MySQL database with pymysql
- django-jalali and persiantools for Jalali date
- python-docx and Spire.Doc for Word file generation
- xlwt for Excel export
- sorl-thumbnail for image optimization
- lxml and python-telegram-bot
- Flask for auxiliary services
- ApexCharts for admin panel charts
- Automatic 3% weekly profit calculation
- Referral system with self-referencing ForeignKey
- Contract generation with B Nazanin and B Titr fonts
- USDT-TRC20 and Stripe payment
- Jalali date throughout the system
🏗️
Architecture
Crainex is built on Django's MVT (Model-View-Template) architecture and consists of four main applications:
1. account: Responsible for user management, authentication, and registration
- Custom User model with complete banking and KYC fields
- Wallet fields (profit_wallet, capital_wallet, introducer_profit_wallet)
- Email and SMS login system
- Referral system with self-referencing ForeignKey
2. site_profile: Responsible for main panel and user management
- State_city model for geographic information
- Support_table and Conversation models for support
- Counseling model for online consultation
- dashboard and admin_dashboard views
- add_user, users, edit_user, user_settings views
- new_capital_confirm and all_capital views
- Word contract generation with python-docx
3. capital_management: Responsible for capital management
- Capitals model for investment
- Payment_table model for payment requests
- add_capital, check_capital, my_wallet views
- manage_payment, deposit_page views
- withdrawal_principal_capital view
- manager_confirm_w_p_c view
4. seo: Responsible for content management
- Seo model for 4 content types (articles, questions, experiences, video)
- All_category, Keyword, Comment, ImageFile models
- Search_result and Question models
- article_index, article_details views
- question_index, questions_details views
- experiences_index, experiences_details views
- video_index, video_details views
- search_result and responsive views
The project runs in DEBUG mode and uses SQLite for development and MySQL for production.
📐
Project Scale
- 4 main applications (account, site_profile, capital_management, seo)
- 10+ main data models
- 4 SEO content types (article, question, experience, video)
- 3 consultation methods (online, phone, in-person)
- 3% weekly profit system
- Referral system with 1% income
- Automatic Word contract generation
- USDT-TRC20 and Stripe payment
- Admin panel with charts
- Excel export