The Depannini project uses Django with JWT authentication for the backend and Flutter for the frontend. This README provides instructions for setting up and integrating both components.
✅ Django backend with JWT authentication
✅ User registration and authentication flows
✅ Email and phone verification systems
✅ User profile management
✅ Access control for different user types (users, assistants, admins)
- Python 3.9+
- pip
- virtualenv
- PostgreSQL (recommended) or SQLite
- Clone the repository:
git clone <repository-url>
cd depannini- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
Create a
.envfile in the root directory with:
SECRET_KEY=your_secret_key
DEBUG=True
DATABASE_URL=postgres://user:password@localhost/depannini
EMAIL_HOST=smtp.example.com
EMAIL_PORT=587
EMAIL_HOST_USER=your_email@example.com
EMAIL_HOST_PASSWORD=your_password
EMAIL_USE_TLS=True
- Run migrations:
python manage.py migrate- Create superuser:
python manage.py createsuperuser- Start the development server:
python manage.py runserverPOST /api/auth/register/- User registrationPOST /api/auth/verify-email/- Email verificationPOST /api/auth/verify-phone/- Phone verificationPOST /api/auth/login/email/- Email loginPOST /api/auth/login/phone/- Phone loginPOST /api/auth/token/refresh/- Refresh JWT tokenPOST /api/auth/password-reset/- Request password resetPOST /api/auth/password-reset/confirm/- Confirm password reset
GET /api/profile/user/- Get user profilePUT /api/profile/user/- Update user profileGET /api/profile/assistant/- Get assistant profilePUT /api/profile/assistant/- Update assistant profile
- Configure SMS service for phone verification
- Set up email service for production
- Implement location-based assistant matching
- Add rating system for assistants
- Create payment integration
- Configure production deployment settings
- Implement API rate limiting
-
Install Flutter SDK: Flutter Installation Guide
-
Create a new Flutter project:
flutter create depannini_app
cd depannini_app- Add required dependencies to
pubspec.yaml:
dependencies:
flutter:
sdk: flutter
http: ^0.13.5
shared_preferences: ^2.0.15
provider: ^6.0.3
flutter_secure_storage: ^6.0.0
jwt_decoder: ^2.0.1
google_maps_flutter: ^2.2.0
image_picker: ^0.8.6
intl: ^0.17.0- Run
flutter pub getto install dependencies
- Create an API client class:
// lib/services/api_client.dart
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class ApiClient {
final String baseUrl = 'http://10.0.2.2:8000/api'; // Use your own IP for physical devices
final storage = FlutterSecureStorage();
Future<Map<String, String>> _getHeaders({bool requiresAuth = true}) async {
Map<String, String> headers = {
'Content-Type': 'application/json',
};
if (requiresAuth) {
final token = await storage.read(key: 'access_token');
if (token != null) {
headers['Authorization'] = 'Bearer $token';
}
}
return headers;
}
Future<dynamic> get(String endpoint, {bool requiresAuth = true}) async {
final response = await http.get(
Uri.parse('$baseUrl$endpoint'),
headers: await _getHeaders(requiresAuth: requiresAuth),
);
return _processResponse(response);
}
Future<dynamic> post(String endpoint, dynamic data, {bool requiresAuth = true}) async {
final response = await http.post(
Uri.parse('$baseUrl$endpoint'),
headers: await _getHeaders(requiresAuth: requiresAuth),
body: jsonEncode(data),
);
return _processResponse(response);
}
Future<dynamic> put(String endpoint, dynamic data, {bool requiresAuth = true}) async {
final response = await http.put(
Uri.parse('$baseUrl$endpoint'),
headers: await _getHeaders(requiresAuth: requiresAuth),
body: jsonEncode(data),
);
return _processResponse(response);
}
dynamic _processResponse(http.Response response) {
if (response.statusCode >= 200 && response.statusCode < 300) {
return jsonDecode(response.body);
} else {
throw Exception('Failed to process request: ${response.body}');
}
}
}- Create authentication service:
// lib/services/auth_service.dart
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'api_client.dart';
class AuthService {
final ApiClient _apiClient = ApiClient();
final FlutterSecureStorage _storage = FlutterSecureStorage();
Future<Map<String, dynamic>> register(Map<String, dynamic> userData) async {
final response = await _apiClient.post('/auth/register/', userData, requiresAuth: false);
await _storeTokens(response);
return response;
}
Future<Map<String, dynamic>> loginWithEmail(String email, String password) async {
final response = await _apiClient.post(
'/auth/login/email/',
{'email': email, 'password': password},
requiresAuth: false,
);
await _storeTokens(response);
return response;
}
Future<void> _storeTokens(Map<String, dynamic> response) async {
await _storage.write(key: 'access_token', value: response['access']);
await _storage.write(key: 'refresh_token', value: response['refresh']);
}
Future<void> logout() async {
await _storage.delete(key: 'access_token');
await _storage.delete(key: 'refresh_token');
}
Future<bool> isLoggedIn() async {
final token = await _storage.read(key: 'access_token');
return token != null;
}
Future<Map<String, dynamic>> refreshToken() async {
final refreshToken = await _storage.read(key: 'refresh_token');
if (refreshToken == null) {
throw Exception('No refresh token available');
}
final response = await _apiClient.post(
'/auth/token/refresh/',
{'refresh': refreshToken},
requiresAuth: false,
);
await _storage.write(key: 'access_token', value: response['access']);
return response;
}
}-
Authentication Screens:
- Login Screen
- Registration Screen
- Verification Screens (Email & Phone)
- Password Reset Screen
-
User Profile Screens:
- User Profile
- Assistant Profile
- Edit Profile
-
Core Functionality:
- Home Screen with Map View
- Assistant Search/Filter
- Service Request Form
- Request Status Tracking
- Rating System
- Design wireframes and UI components
- Implement authentication flow
- Build user profile management
- Develop location services integration
- Create service request workflow
- Implement real-time notifications
- Add payment integration
- Develop ratings and reviews system
- Implement chat functionality
-
Complete Backend Configuration:
- Finalize SMS service integration
- Configure email service for production
- Set up environment variables and secrets management
-
Test API Endpoints:
- Use Postman to verify all endpoints are working correctly hadi say verifit
- Document any API changes or additions
-
Implement Frontend Components:
- Start with authentication screens
- Build profile management screens
- Create core service request functionality
-
Connect Frontend with Backend:
- Ensure proper token handling
- Implement error handling and network state management
- Test the complete flow from registration to service requests
-
Prepare for Deployment:
- Configure production settings for Django
- Set up CI/CD pipeline
- Prepare app for store submission
For any questions or assistance with the integration, please contact the project team.
© 2025 Depannini Project