ntc-dev-kit 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. ntc/__init__.py +5 -0
  2. ntc/app_creator.py +296 -0
  3. ntc/cli.py +4 -0
  4. ntc/cli_enhanced.py +820 -0
  5. ntc/composer/__init__.py +0 -0
  6. ntc/composer/main.py +443 -0
  7. ntc/deployment/__init__.py +0 -0
  8. ntc/templates/__init__.py +2 -0
  9. ntc/templates/auth_app/__init__.py +0 -0
  10. ntc/templates/auth_app/admin.py +24 -0
  11. ntc/templates/auth_app/apps.py +6 -0
  12. ntc/templates/auth_app/models.py +30 -0
  13. ntc/templates/auth_app/serializers.py +101 -0
  14. ntc/templates/auth_app/urls.py +19 -0
  15. ntc/templates/auth_app/views.py +175 -0
  16. ntc/templates/drf_structure/__init__.py +1 -0
  17. ntc/templates/drf_structure/drf_structure.md +83 -0
  18. ntc/templates/drf_structure/main.py +389 -0
  19. ntc/templates/drf_structure/structure.json +126 -0
  20. ntc/templates/drf_structure/templates/.entry/start_core_backend.sh +37 -0
  21. ntc/templates/drf_structure/templates/.entry/start_tasks_backend.sh +30 -0
  22. ntc/templates/drf_structure/templates/CLAUDE.md +194 -0
  23. ntc/templates/drf_structure/templates/README.md +117 -0
  24. ntc/templates/drf_structure/templates/apps/app_admin.py +3 -0
  25. ntc/templates/drf_structure/templates/apps/app_apps.py +6 -0
  26. ntc/templates/drf_structure/templates/apps/app_models.py +4 -0
  27. ntc/templates/drf_structure/templates/apps/app_urls.py +8 -0
  28. ntc/templates/drf_structure/templates/apps/app_views.py +6 -0
  29. ntc/templates/drf_structure/templates/apps/common_apps.py +6 -0
  30. ntc/templates/drf_structure/templates/apps/common_models.py +8 -0
  31. ntc/templates/drf_structure/templates/config/gunicorn_config.py +9 -0
  32. ntc/templates/drf_structure/templates/config/http.conf +33 -0
  33. ntc/templates/drf_structure/templates/core/base_model.py +9 -0
  34. ntc/templates/drf_structure/templates/core/formatter.py +5 -0
  35. ntc/templates/drf_structure/templates/core/logger.py +8 -0
  36. ntc/templates/drf_structure/templates/core/pagination.py +6 -0
  37. ntc/templates/drf_structure/templates/core/response_wrapper.py +7 -0
  38. ntc/templates/drf_structure/templates/core/services/azure/email/backend.py +108 -0
  39. ntc/templates/drf_structure/templates/core/services/azure/email/client.py +296 -0
  40. ntc/templates/drf_structure/templates/core/services/azure/email/notifier.py +102 -0
  41. ntc/templates/drf_structure/templates/core/services/object_storage.py +285 -0
  42. ntc/templates/drf_structure/templates/django_project/asgi.py +5 -0
  43. ntc/templates/drf_structure/templates/django_project/celery.py +8 -0
  44. ntc/templates/drf_structure/templates/django_project/dev_settings.py +2 -0
  45. ntc/templates/drf_structure/templates/django_project/django_settings.txt +322 -0
  46. ntc/templates/drf_structure/templates/django_project/management_command.py +114 -0
  47. ntc/templates/drf_structure/templates/django_project/prod_settings.py +3 -0
  48. ntc/templates/drf_structure/templates/django_project/schema.py +7 -0
  49. ntc/templates/drf_structure/templates/django_project/urls.py +6 -0
  50. ntc/templates/drf_structure/templates/django_project/wsgi.py +5 -0
  51. ntc/templates/drf_structure/templates/docker/docker-compose.yml +11 -0
  52. ntc/templates/drf_structure/templates/knowledge/knowledge_description.md +201 -0
  53. ntc/templates/drf_structure/templates/knowledge/knowledge_design_pattern.md +722 -0
  54. ntc/templates/drf_structure/templates/knowledge/knowledge_structure.md +151 -0
  55. ntc/templates/drf_structure/templates/root/README.md +307 -0
  56. ntc/templates/drf_structure/templates/root/django_env.txt +98 -0
  57. ntc/templates/drf_structure/templates/root/django_requirements.txt +24 -0
  58. ntc/templates/drf_structure/templates/root/gitignore.txt +6 -0
  59. ntc/templates/drf_structure/templates/root/manage.py +11 -0
  60. ntc/templates/flutter/.gitignore +44 -0
  61. ntc/templates/flutter/.knowledge/knowledge_description.md +215 -0
  62. ntc/templates/flutter/.knowledge/knowledge_design_pattern.md +310 -0
  63. ntc/templates/flutter/.knowledge/knowledge_structure.md +83 -0
  64. ntc/templates/flutter/CLAUDE.md +190 -0
  65. ntc/templates/flutter/__init__.py +0 -0
  66. ntc/templates/flutter/analysis_options.yaml +9 -0
  67. ntc/templates/flutter/main.py +187 -0
  68. ntc/templates/flutter/pubspec.yaml +65 -0
  69. ntc/templates/flutter/structure.json +51 -0
  70. ntc/templates/nextjs/.env.example +10 -0
  71. ntc/templates/nextjs/.gitignore +36 -0
  72. ntc/templates/nextjs/CLAUDE.md +181 -0
  73. ntc/templates/nextjs/README.md +94 -0
  74. ntc/templates/nextjs/__init__.py +0 -0
  75. ntc/templates/nextjs/knowledge/knowledge_description.md +208 -0
  76. ntc/templates/nextjs/knowledge/knowledge_design_pattern.md +460 -0
  77. ntc/templates/nextjs/knowledge/knowledge_structure.md +75 -0
  78. ntc/templates/nextjs/main.py +224 -0
  79. ntc/templates/nextjs/package.json +25 -0
  80. ntc/templates/nextjs/src/app/globals.css +26 -0
  81. ntc/templates/nextjs/src/app/layout.tsx +59 -0
  82. ntc/templates/nextjs/src/app/page.tsx +21 -0
  83. ntc/templates/nextjs/src/components/Header.tsx +16 -0
  84. ntc/templates/nextjs/src/services/api.ts +81 -0
  85. ntc/templates/nextjs/src/utils/constants.ts +1 -0
  86. ntc/templates/nextjs/structure.json +32 -0
  87. ntc/templates/nextjs/tsconfig.json +27 -0
  88. ntc/templates/react_admin/.env.example +1 -0
  89. ntc/templates/react_admin/.gitignore +10 -0
  90. ntc/templates/react_admin/CLAUDE.md +210 -0
  91. ntc/templates/react_admin/README.md +72 -0
  92. ntc/templates/react_admin/__init__.py +0 -0
  93. ntc/templates/react_admin/index.html +13 -0
  94. ntc/templates/react_admin/knowledge/knowledge_description.md +202 -0
  95. ntc/templates/react_admin/knowledge/knowledge_design_pattern.md +448 -0
  96. ntc/templates/react_admin/knowledge/knowledge_structure.md +97 -0
  97. ntc/templates/react_admin/main.py +208 -0
  98. ntc/templates/react_admin/package.json +35 -0
  99. ntc/templates/react_admin/src/App.tsx +60 -0
  100. ntc/templates/react_admin/src/components/ProtectedRoute.tsx +16 -0
  101. ntc/templates/react_admin/src/components/Sidebar.tsx +90 -0
  102. ntc/templates/react_admin/src/components/TopNav.tsx +44 -0
  103. ntc/templates/react_admin/src/context/AuthContext.tsx +107 -0
  104. ntc/templates/react_admin/src/context/ThemeContext.tsx +34 -0
  105. ntc/templates/react_admin/src/context/WorkspaceContext.tsx +28 -0
  106. ntc/templates/react_admin/src/hooks/useApi.ts +39 -0
  107. ntc/templates/react_admin/src/index.css +34 -0
  108. ntc/templates/react_admin/src/layouts/AuthLayout.tsx +23 -0
  109. ntc/templates/react_admin/src/layouts/DashboardLayout.tsx +24 -0
  110. ntc/templates/react_admin/src/main.tsx +5 -0
  111. ntc/templates/react_admin/src/pages/DashboardPage.tsx +10 -0
  112. ntc/templates/react_admin/src/pages/auth/LoginPage.tsx +79 -0
  113. ntc/templates/react_admin/src/pages/auth/RegisterPage.tsx +93 -0
  114. ntc/templates/react_admin/src/services/api.service.ts +44 -0
  115. ntc/templates/react_admin/src/services/base.service.ts +193 -0
  116. ntc/templates/react_admin/structure.json +52 -0
  117. ntc/templates/react_admin/tsconfig.app.json +25 -0
  118. ntc/templates/react_admin/tsconfig.json +7 -0
  119. ntc/templates/react_admin/tsconfig.node.json +19 -0
  120. ntc/templates/react_admin/vite.config.ts +13 -0
  121. ntc/templates/react_structure/CLAUDE.md +176 -0
  122. ntc/templates/react_structure/__init__.py +1 -0
  123. ntc/templates/react_structure/index.css +21 -0
  124. ntc/templates/react_structure/index.html +13 -0
  125. ntc/templates/react_structure/knowledge/knowledge_description.md +170 -0
  126. ntc/templates/react_structure/knowledge/knowledge_design_pattern.md +411 -0
  127. ntc/templates/react_structure/knowledge/knowledge_structure.md +74 -0
  128. ntc/templates/react_structure/main.py +217 -0
  129. ntc/templates/react_structure/package.json +32 -0
  130. ntc/templates/react_structure/src/App.tsx +63 -0
  131. ntc/templates/react_structure/src/components/Header.tsx +51 -0
  132. ntc/templates/react_structure/src/main.tsx +5 -0
  133. ntc/templates/react_structure/src/services/api.ts +90 -0
  134. ntc/templates/react_structure/src/utils/constants.ts +1 -0
  135. ntc/templates/react_structure/structure.json +65 -0
  136. ntc/templates/react_structure/tsconfig.app.json +25 -0
  137. ntc/templates/react_structure/tsconfig.json +7 -0
  138. ntc/templates/react_structure/tsconfig.node.json +19 -0
  139. ntc/templates/react_structure/vite.config.ts +12 -0
  140. ntc/utils/__init__.py +1 -0
  141. ntc/utils/environment.py +67 -0
  142. ntc/utils/output.py +41 -0
  143. ntc_dev_kit-1.0.0.dist-info/METADATA +188 -0
  144. ntc_dev_kit-1.0.0.dist-info/RECORD +148 -0
  145. ntc_dev_kit-1.0.0.dist-info/WHEEL +5 -0
  146. ntc_dev_kit-1.0.0.dist-info/entry_points.txt +2 -0
  147. ntc_dev_kit-1.0.0.dist-info/licenses/LICENSE +21 -0
  148. ntc_dev_kit-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,151 @@
1
+ # Project Structure - {project_name}
2
+
3
+ This document describes the complete project structure and organization for AI assistants to understand how to work with this codebase.
4
+
5
+ ## 📁 Root Directory Structure
6
+
7
+ ```
8
+ {project_name}/
9
+ ├── .env # Environment variables
10
+ ├── .gitignore # Git ignore patterns
11
+ ├── .knowledge/ # AI documentation (this directory)
12
+ ├── .entry/ # Docker entry scripts
13
+ │ ├── start_core_backend.sh # Core backend startup
14
+ │ └── start_tasks_backend.sh # Celery worker startup
15
+ ├── config/ # Server configuration files
16
+ │ ├── gunicorn_config.py # Gunicorn configuration
17
+ │ └── http.conf # Nginx configuration
18
+ ├── manage.py # Django management script
19
+ ├── requirements.txt # Python dependencies
20
+ ├── docker-compose.yml # Docker composition
21
+ ├── Dockerfile # Docker build instructions
22
+ ├── captain-definition # CapRover deployment config
23
+ ├── README.md # Project documentation
24
+ ├── {project_name}/ # Django project configuration
25
+ ├── apps/ # Django applications
26
+ └── core/ # Core utilities and frameworks
27
+ ```
28
+
29
+ ## 🏗️ Django Project Configuration (`{project_name}/`)
30
+
31
+ ```
32
+ {project_name}/
33
+ ├── __init__.py
34
+ ├── asgi.py # ASGI application entry point (uses prod settings)
35
+ ├── wsgi.py # WSGI application entry point (uses prod settings)
36
+ ├── schema.py # API schema configuration (OpenAPI/Swagger)
37
+ ├── urls.py # Main URL routing
38
+ ├── celery.py # Celery task configuration
39
+ ├── settings/ # Split settings configuration
40
+ │ ├── __init__.py
41
+ │ ├── base.py # Base settings (shared, includes Azure, Sentry, R2)
42
+ │ ├── dev.py # Development settings
43
+ │ └── prod.py # Production settings
44
+ └── management/ # Custom Django management commands
45
+ └── commands/
46
+ ├── __init__.py
47
+ └── create_app.py # NTC app creation command
48
+ ```
49
+
50
+ ## 📱 Applications Directory (`apps/`)
51
+
52
+ ```
53
+ apps/
54
+ ├── __init__.py
55
+ ├── common/ # Shared utilities and base models
56
+ │ ├── __init__.py
57
+ │ ├── apps.py # App configuration
58
+ │ ├── models.py # Abstract base models (TimeStampedModel)
59
+ │ ├── serializers/ # Shared serializers
60
+ │ ├── services/ # Shared business logic
61
+ │ └── tests/ # Common tests
62
+ └── [app_name]/ # Individual Django apps (created via `ntc create app`)
63
+ ├── __init__.py
64
+ ├── admin.py # Django admin configuration
65
+ ├── apps.py # App configuration
66
+ ├── models.py # Data models
67
+ ├── urls.py # App-specific URL patterns
68
+ ├── views.py # API views and endpoints
69
+ ├── permissions/ # Custom permissions
70
+ ├── serializers/ # DRF serializers
71
+ ├── selectors/ # Data selection logic
72
+ ├── services/ # Business logic
73
+ ├── socket/ # WebSocket handlers
74
+ ├── tasks/ # Celery tasks
75
+ └── tests/ # App-specific tests
76
+ ```
77
+
78
+ ## 🔧 Core Framework (`core/`)
79
+
80
+ ```
81
+ core/
82
+ ├── __init__.py
83
+ ├── pagination.py # DRF pagination classes
84
+ ├── base_model.py # Abstract base model with common fields
85
+ ├── response_wrapper.py # Standardized API response utilities
86
+ ├── permissions/ # Custom permission classes
87
+ ├── exceptions/ # Custom exception handlers
88
+ ├── signals/ # Django signals
89
+ ├── utils/ # General utilities
90
+ ├── middlewares/ # Custom middleware
91
+ ├── services/ # External service integrations
92
+ │ ├── object_storage.py # Cloudflare R2 (S3-compatible) storage
93
+ │ ├── azure/ # Azure cloud services
94
+ │ │ └── email/ # Azure Communication Services Email
95
+ │ │ ├── backend.py # Django email backend
96
+ │ │ ├── client.py # Azure SDK wrapper
97
+ │ │ └── notifier.py # High-level email sender
98
+ │ │ ├── sms/ # Azure SMS (placeholder)
99
+ │ │ └── storage/ # Azure Storage (placeholder)
100
+ │ └── aws/ # AWS cloud services
101
+ │ ├── email/ # AWS SES (placeholder)
102
+ │ ├── sms/ # AWS SNS (placeholder)
103
+ │ └── storage/ # AWS S3 (placeholder)
104
+ └── logging/ # Logging configuration
105
+ ├── formatter.py # Custom log formatters
106
+ └── logger.py # Logger setup
107
+ ```
108
+
109
+ ## 🎯 Key Conventions
110
+
111
+ ### File Naming
112
+ - **Models**: `PascalCase` classes in `models.py`
113
+ - **Views**: `snake_case` functions/classes in `views.py`
114
+ - **URLs**: `kebab-case` patterns in `urls.py`
115
+ - **Apps**: `snake_case` directory names
116
+
117
+ ### Import Patterns
118
+ - **Models**: `from apps.common.models import TimeStampedModel`
119
+ - **Response**: `from core.response_wrapper import success_response, error_response`
120
+ - **Pagination**: `from core.pagination import StandardResultsSetPagination`
121
+
122
+ ### URL Structure
123
+ - **App URLs**: `/{app_name}/endpoint/`
124
+ - **API Versioning**: Not implemented (single version)
125
+ - **Admin**: `/admin/`
126
+ - **API Docs**: `/docs/` (Swagger UI)
127
+
128
+ ## 🔄 Development Workflow
129
+
130
+ 1. **Create new app**: `ntc create app app_name`
131
+ 2. **Add models**: Edit `apps/app_name/models.py`
132
+ 3. **Create migrations**: `python manage.py makemigrations app_name`
133
+ 4. **Apply migrations**: `python manage.py migrate`
134
+ 5. **Add views**: Edit `apps/app_name/views.py`
135
+ 6. **Configure URLs**: Edit `apps/app_name/urls.py`
136
+ 7. **Test endpoint**: `GET /app_name/hello/` (auto-created test endpoint)
137
+
138
+ ## 📋 Important Notes for AI
139
+
140
+ - **Always use the NTC structure** when creating new apps
141
+ - **Follow the Service/Selector pattern** for business logic
142
+ - **Use `success_response()` and `error_response()`** for consistent API responses
143
+ - **Inherit from `TimeStampedModel`** for automatic timestamp fields
144
+ - **Place business logic in `services/`**, not in views
145
+ - **Use `selectors/` for complex data queries**
146
+ - **All new apps are automatically added to `INSTALLED_APPS` and main `urls.py`**
147
+ - **Azure Email**: Use `core.services.azure.email.send_template_email()` for email sending
148
+ - **Object Storage**: Use `core.services.object_storage.ObjectStorageService` for file operations
149
+ - **Docker Setup**: Production-ready with nginx, uvicorn, and entry scripts
150
+ - **Sentry**: Automatically configured via `SENTRY_DSN` environment variable
151
+ - **ASGI/WSGI**: Use production settings (`settings.prod`) by default
@@ -0,0 +1,307 @@
1
+ # {project_name}
2
+
3
+ A Django REST Framework project built with **NTC (Nexent Toolkit Console)** structure for scalable, maintainable API development.
4
+
5
+ ---
6
+
7
+ ## 📋 Project Description
8
+
9
+ <!-- Add your project-specific description here -->
10
+ *This section is for you to describe what your project does, its main features, and business purpose.*
11
+
12
+ ---
13
+
14
+ ## 🏗️ Architecture Overview
15
+
16
+ This project follows the **NTC structure** with enterprise-grade patterns:
17
+
18
+ - **API-First Design**: RESTful APIs with standardized JSON responses
19
+ - **Modular Apps**: Feature-based Django applications in `apps/` directory
20
+ - **Service/Selector Pattern**: Clean separation of business logic and data access
21
+ - **JWT Authentication**: Secure token-based authentication with refresh tokens
22
+ - **Background Tasks**: Celery integration for async processing
23
+ - **Cloud Ready**: Docker containerization and deployment configurations
24
+
25
+ ## 📁 Project Structure
26
+
27
+ ```
28
+ {project_name}/
29
+ ├── .env # Environment variables
30
+ ├── .knowledge/ # AI documentation for project understanding
31
+ ├── manage.py # Django management script
32
+ ├── requirements.txt # Python dependencies
33
+ ├── docker-compose.yml # Local development environment
34
+ ├── {project_name}/ # Django project configuration
35
+ │ ├── settings/ # Split settings (dev/prod)
36
+ │ ├── urls.py # Main URL routing
37
+ │ └── management/ # Custom management commands
38
+ ├── apps/ # Django applications
39
+ │ ├── common/ # Shared utilities and base models
40
+ │ └── [your_apps]/ # Feature-specific apps
41
+ └── core/ # Framework utilities and extensions
42
+ ├── response_wrapper.py # Standardized API responses
43
+ ├── pagination.py # DRF pagination classes
44
+ └── services/ # External service integrations
45
+ ```
46
+
47
+ ## 🚀 Quick Start
48
+
49
+ ### 1. Environment Setup
50
+ ```bash
51
+ # Clone and navigate to project
52
+ cd {project_name}
53
+
54
+ # Create virtual environment
55
+ python -m venv env
56
+ source env/bin/activate # On Windows: env\Scripts\activate
57
+
58
+ # Install dependencies
59
+ pip install -r requirements.txt
60
+ ```
61
+
62
+ ### 2. Database Setup
63
+ ```bash
64
+ # Run migrations
65
+ python manage.py migrate
66
+
67
+ # Create superuser (optional)
68
+ python manage.py createsuperuser
69
+ ```
70
+
71
+ ### 3. Run Development Server
72
+ ```bash
73
+ python manage.py runserver
74
+ ```
75
+
76
+ The API will be available at:
77
+ - **API Base**: http://127.0.0.1:8000/
78
+ - **Admin Panel**: http://127.0.0.1:8000/admin/
79
+ - **API Documentation**: http://127.0.0.1:8000/docs/
80
+
81
+ ## 🛠️ Development Commands
82
+
83
+ ### App Management
84
+ ```bash
85
+ # Create new app with NTC structure
86
+ python manage.py create_app app_name
87
+
88
+ # Alternative: Use NTC CLI (if installed globally)
89
+ ntc create app app_name
90
+ ```
91
+
92
+ ### Database Operations
93
+ ```bash
94
+ # Create migrations
95
+ python manage.py makemigrations [app_name]
96
+
97
+ # Apply migrations
98
+ python manage.py migrate
99
+
100
+ # Reset database (development only)
101
+ python manage.py flush
102
+ ```
103
+
104
+ ### Development Tools
105
+ ```bash
106
+ # Run tests
107
+ python manage.py test
108
+
109
+ # Collect static files (production)
110
+ python manage.py collectstatic
111
+
112
+ # Django shell
113
+ python manage.py shell
114
+ ```
115
+
116
+ ## 🏛️ Development Patterns
117
+
118
+ ### API Response Format
119
+ All endpoints return standardized responses:
120
+
121
+ ```json
122
+ {
123
+ "status": "success|error",
124
+ "message": "Human-readable message",
125
+ "data": { /* Response data */ }
126
+ }
127
+ ```
128
+
129
+ ### Service/Selector Pattern
130
+ ```python
131
+ # Business logic in services/
132
+ from apps.myapp.services.user_service import create_user
133
+
134
+ # Data queries in selectors/
135
+ from apps.myapp.selectors.user_selector import get_active_users
136
+
137
+ # Views handle HTTP only
138
+ @api_view(['POST'])
139
+ def create_user_view(request):
140
+ user = create_user(request.data)
141
+ return success_response(data=user, message="User created")
142
+ ```
143
+
144
+ ### Model Inheritance
145
+ ```python
146
+ # Use TimeStampedModel for automatic timestamps
147
+ from apps.common.models import TimeStampedModel
148
+
149
+ class MyModel(TimeStampedModel):
150
+ name = models.CharField(max_length=100)
151
+ # created_at and updated_at added automatically
152
+ ```
153
+
154
+ ## 🔧 Configuration
155
+
156
+ ### Environment Variables
157
+ Copy `.env.example` to `.env` and configure:
158
+
159
+ ```env
160
+ DEBUG=True
161
+ SECRET_KEY=your-secret-key
162
+ DATABASE_URL=sqlite:///db.sqlite3
163
+ REDIS_URL=redis://localhost:6379
164
+ ```
165
+
166
+ ### Settings Structure
167
+ - `settings/base.py` - Shared settings
168
+ - `settings/dev.py` - Development settings
169
+ - `settings/prod.py` - Production settings
170
+
171
+ ## 🐳 Docker Development
172
+
173
+ ### Local Development
174
+ ```bash
175
+ # Start all services
176
+ docker-compose up
177
+
178
+ # Run in background
179
+ docker-compose up -d
180
+
181
+ # View logs
182
+ docker-compose logs -f
183
+
184
+ # Stop services
185
+ docker-compose down
186
+ ```
187
+
188
+ ### Production Build
189
+ ```bash
190
+ # Build production image
191
+ docker build -t {project_name} .
192
+
193
+ # Run production container
194
+ docker run -p 8000:8000 {project_name}
195
+ ```
196
+
197
+ ## 📚 API Documentation
198
+
199
+ ### Interactive Documentation
200
+ - **Swagger UI**: http://127.0.0.1:8000/docs/
201
+ - **OpenAPI Schema**: http://127.0.0.1:8000/schema/
202
+
203
+ ### Authentication
204
+ ```bash
205
+ # Get JWT tokens
206
+ POST /auth/login/
207
+ {
208
+ "email": "user@example.com",
209
+ "password": "password"
210
+ }
211
+
212
+ # Use access token in headers
213
+ Authorization: Bearer <access_token>
214
+
215
+ # Refresh token
216
+ POST /auth/refresh/
217
+ {
218
+ "refresh": "<refresh_token>"
219
+ }
220
+ ```
221
+
222
+ ## 🧪 Testing
223
+
224
+ ### Run Tests
225
+ ```bash
226
+ # All tests
227
+ python manage.py test
228
+
229
+ # Specific app
230
+ python manage.py test apps.myapp
231
+
232
+ # With coverage
233
+ coverage run --source='.' manage.py test
234
+ coverage report
235
+ ```
236
+
237
+ ### Test Structure
238
+ ```
239
+ apps/myapp/tests/
240
+ ├── __init__.py
241
+ ├── test_models.py
242
+ ├── test_services.py
243
+ ├── test_selectors.py
244
+ └── test_views.py
245
+ ```
246
+
247
+ ## 📦 Deployment
248
+
249
+ ### Environment Setup
250
+ 1. Set `DEBUG=False` in production
251
+ 2. Configure production database
252
+ 3. Set up Redis for caching
253
+ 4. Configure email settings
254
+ 5. Set up Celery workers
255
+
256
+ ### CapRover Deployment
257
+ ```bash
258
+ # Deploy to CapRover
259
+ caprover deploy
260
+
261
+ # Or use captain-definition for auto-deployment
262
+ git push caprover main
263
+ ```
264
+
265
+ ## 🔍 Troubleshooting
266
+
267
+ ### Common Issues
268
+
269
+ **Migration Errors**:
270
+ ```bash
271
+ # Reset migrations (development only)
272
+ python manage.py migrate --fake-initial
273
+ ```
274
+
275
+ **Import Errors**:
276
+ - Ensure virtual environment is activated
277
+ - Check `PYTHONPATH` includes project root
278
+ - Verify app is in `INSTALLED_APPS`
279
+
280
+ **Permission Errors**:
281
+ - Check JWT token is valid
282
+ - Verify user has required permissions
283
+ - Ensure proper authentication headers
284
+
285
+ ## 📖 Additional Resources
286
+
287
+ - **NTC Documentation**: [Link to NTC docs]
288
+ - **Django REST Framework**: https://www.django-rest-framework.org/
289
+ - **Django Documentation**: https://docs.djangoproject.com/
290
+ - **Project Knowledge Base**: See `.knowledge/` directory for AI-friendly documentation
291
+
292
+ ## 🤝 Contributing
293
+
294
+ <!-- Add your contribution guidelines here -->
295
+ *This section is for your team's contribution guidelines, coding standards, and development workflow.*
296
+
297
+ ---
298
+
299
+ ## 📄 License
300
+
301
+ <!-- Add your license information here -->
302
+ *Add your project's license information.*
303
+
304
+ ---
305
+
306
+ **Generated by NTC (Nexent Toolkit Console)** - A tool for creating production-ready Django REST Framework projects with best practices built-in.
307
+
@@ -0,0 +1,98 @@
1
+ # =====================================================
2
+ # 🔧 Django Environment Configuration
3
+ # =====================================================
4
+
5
+ # Debug mode (True for development, False for production)
6
+ DEBUG=False
7
+
8
+ # Secret key used for cryptographic signing
9
+ SECRET_KEY={secret_key}
10
+
11
+ BASE_URL=http://127.0.0.1:8000
12
+ BACKEND_URL=http://127.0.0.1:8000
13
+ FRONTEND_URL=http://127.0.0.1:3000
14
+
15
+ # =====================================================
16
+ # 🗄️ Database Configuration
17
+ # =====================================================
18
+ # By default, SQLite is used. Uncomment and configure
19
+ # the variables below to use PostgreSQL or another DB.
20
+ # =====================================================
21
+
22
+ # Example:
23
+ DATABASE_ENGINE=django.db.backends.postgresql
24
+ DATABASE_NAME=mydb
25
+ DATABASE_USER=myuser
26
+ DATABASE_PASSWORD=mypass
27
+ DATABASE_HOST=localhost
28
+ DATABASE_PORT=5432
29
+ #
30
+ # For SQLite (default):
31
+ DATABASE_ENGINE=django.db.backends.sqlite3
32
+ DATABASE_NAME=db.sqlite3
33
+
34
+ # =====================================================
35
+ # 📧 Email Configuration
36
+ # =====================================================
37
+ EMAIL_HOST=
38
+ EMAIL_HOST_USER=
39
+ EMAIL_HOST_PASSWORD=
40
+ EMAIL_PORT=
41
+ DEFAULT_FROM_EMAIL=
42
+
43
+ # =====================================================
44
+ # ☁️ Azure Communication Services (Email)
45
+ # =====================================================
46
+ # Production sends go through ACS when endpoint + access_key are configured.
47
+ # In dev/tests, leave them blank to fall back to console.EmailBackend.
48
+ AZURE_COMMUNICATION_ENDPOINT=
49
+ AZURE_COMMUNICATION_ACCESS_KEY=
50
+ AZURE_COMMUNICATION_EMAIL_SENDER_NO_REPLY=
51
+ AZURE_COMMUNICATION_EMAIL_SENDER_NOTIFICATION=
52
+ AZURE_COMMUNICATION_EMAIL_SENDER_SUPPORT=
53
+ AZURE_COMMUNICATION_EMAIL_SENDER_MARKETING=
54
+ AZURE_COMMUNICATION_EMAIL_SENDER=
55
+ AZURE_COMMUNICATION_EMAIL_DEFAULT_SENDER_KEY=notification
56
+ AZURE_COMMUNICATION_EMAIL_POLLING_INTERVAL_SECONDS=2
57
+ AZURE_COMMUNICATION_EMAIL_TIMEOUT_SECONDS=60
58
+
59
+ # =====================================================
60
+ # 🔐 JWT Authentication Settings
61
+ # =====================================================
62
+ # Token lifetime in minutes
63
+ JWT_ACCESS_TTL_MINUTES=15
64
+
65
+ # =====================================================
66
+ # 🔁 Redis Configuration
67
+ # =====================================================
68
+ REDIS_HOST=
69
+ REDIS_USER=
70
+ REDIS_PASSWORD=
71
+ REDIS_PORT=
72
+
73
+ # =====================================================
74
+ # 🛡️ Sentry Configuration
75
+ # =====================================================
76
+ # Sentry DSN for error tracking and performance monitoring
77
+ SENTRY_DSN=
78
+
79
+ # =====================================================
80
+ # ☁️ Cloudflare R2 (S3-compatible Storage)
81
+ # =====================================================
82
+ R2_ACCOUNT_ID=
83
+ R2_ACCESS_KEY_ID=
84
+ R2_SECRET_ACCESS_KEY=
85
+ R2_BUCKET=
86
+ R2_REGION=auto
87
+ R2_ENDPOINT=
88
+ R2_PUBLIC_BASE_URL=
89
+ R2_MEDIA_PATH=
90
+
91
+ # =====================================================
92
+ # ☁️ External Service Credentials
93
+ # =====================================================
94
+ # Azure Email Services
95
+ BEEM_API_KEY=
96
+ SELCOM_MERCHANT_ID=
97
+ CLICKPESA_CLIENT_ID=
98
+ POLAR_API_KEY=
@@ -0,0 +1,24 @@
1
+ Django
2
+ django-cors-headers
3
+ djangorestframework
4
+ djangorestframework-jwt
5
+ djangorestframework-simplejwt
6
+ gunicorn
7
+ PyJWT
8
+ pytz
9
+ channels
10
+ django-environ
11
+ django-background-tasks
12
+ celery
13
+ django-celery-results
14
+ django-celery-beat
15
+ azure-common
16
+ azure-communication-email
17
+ azure-core
18
+ azure-identity
19
+ azure-mgmt-communication
20
+ pillow
21
+ colorama
22
+ sentry-sdk
23
+ boto3
24
+ botocore
@@ -0,0 +1,6 @@
1
+ venv/
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.db
6
+ .env
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python
2
+ import os
3
+ import sys
4
+
5
+ if __name__ == '__main__':
6
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{project_name}.settings.dev')
7
+ try:
8
+ from django.core.management import execute_from_command_line
9
+ except ImportError as exc:
10
+ raise ImportError('Django not found, install it first!') from exc
11
+ execute_from_command_line(sys.argv)
@@ -0,0 +1,44 @@
1
+ # Miscellaneous
2
+ *.class
3
+ *.log
4
+ *.pyc
5
+ *.swp
6
+ .DS_Store
7
+ .atom/
8
+ .buildlog/
9
+ .history
10
+ .svn/
11
+ migrate_working_dir/
12
+
13
+ # IntelliJ related
14
+ *.iml
15
+ *.ipr
16
+ *.iws
17
+ .idea/
18
+
19
+ # The .vscode folder contains launch configuration and tasks you configure in
20
+ # VS Code which you may wish to be included in version control, so this line
21
+ # is commented out by default.
22
+ #.vscode/
23
+
24
+ # Flutter/Dart/Pub related
25
+ **/doc/api/
26
+ **/ios/Flutter/.last_build_id
27
+ .dart_tool/
28
+ .flutter-plugins
29
+ .flutter-plugins-dependencies
30
+ .packages
31
+ .pub-cache/
32
+ .pub/
33
+ /build/
34
+
35
+ # Symbolication related
36
+ app.*.symbols
37
+
38
+ # Obfuscation related
39
+ app.*.map.json
40
+
41
+ # Android Studio will place build artifacts here
42
+ /android/app/debug
43
+ /android/app/profile
44
+ /android/app/release