A comprehensive Django-based AI services platform with user authentication, API key management, and 8 powerful AI-powered text processing APIs.
- User Registration & Login: Secure signup and login system
- API Key Management: Automatic API key generation for each user
- Dashboard: User dashboard with API key management and usage statistics
- Middleware Authentication: Secure API endpoints with API key validation
- ๐ Text Summarization - Extract key points from long texts
- ๐ Sentiment Analysis - Analyze emotional tone of text
- ๐ Keyword Extraction - Extract important keywords and phrases
- ๐ท๏ธ Text Classification - Categorize text into different topics
- ๐ Language Detection - Identify the language of input text
- ๐ Text Translation - Translate text between multiple languages
- โ Question Answering - Get answers to questions with optional context
- โจ Content Generation - Generate various types of content
- Python 3.8+
- Django 5.2+
- Google Gemini API key
-
Clone the repository
git clone <repository-url> cd service_hub
-
Install dependencies
pip install django djangorestframework python-dotenv langchain-google-genai
-
Set up environment variables Create a
.envfile in the project root:GOOGLE_API_KEY=your_gemini_api_key_here
-
Run migrations
python manage.py migrate
-
Create superuser (optional)
python manage.py createsuperuser
-
Start the server
python manage.py runserver
-
Access the application Open http://127.0.0.1:8000 in your browser
- Visit
/signup/to create a new account - Fill in username, email, and password
- Upon successful registration, an API key is automatically generated
- User is redirected to the home page
- Visit
/login/to sign in - Enter username and password
- Access dashboard at
/dashboard/to view API key and statistics
- Header Method: Include
X-API-Key: your_api_keyin request headers - Body Method: Include
"api_key": "your_api_key"in request body
GET /- Home page with API testing interfaceGET /login/- Login pagePOST /login/- Process loginGET /signup/- Registration pagePOST /signup/- Process registrationGET /dashboard/- User dashboardPOST /logout/- Logout userPOST /regenerate-api-key/- Generate new API key
All endpoints require API key authentication:
| Endpoint | Method | Description |
|---|---|---|
/summarize/ |
POST | Text summarization |
/sentiment/ |
POST | Sentiment analysis |
/keywords/ |
POST | Keyword extraction |
/classify/ |
POST | Text classification |
/detect-language/ |
POST | Language detection |
/translate/ |
POST | Text translation |
/answer/ |
POST | Question answering |
/generate/ |
POST | Content generation |
fetch("/summarize/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your_api_key_here",
},
body: JSON.stringify({
text: "Your long text here...",
method: "stuff", // 'stuff', 'map_reduce', or 'refine'
}),
});fetch("/sentiment/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your_api_key_here",
},
body: JSON.stringify({
text: "I love this product!",
}),
});fetch("/translate/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your_api_key_here",
},
body: JSON.stringify({
text: "Hello, how are you?",
target_language: "Spanish",
}),
});fetch("/generate/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your_api_key_here",
},
body: JSON.stringify({
prompt_text: "Write a professional email",
content_type: "email",
max_length: 500,
}),
});service_hub/
โโโ ai_services/ # Main Django app
โ โโโ logic/ # AI service logic
โ โ โโโ summarizer.py # Text summarization
โ โ โโโ sentiment_analyzer.py # Sentiment analysis
โ โ โโโ keyword_extractor.py # Keyword extraction
โ โ โโโ text_classifier.py # Text classification
โ โ โโโ language_detector.py # Language detection
โ โ โโโ text_translator.py # Text translation
โ โ โโโ question_answerer.py # Question answering
โ โ โโโ content_generator.py # Content generation
โ โ โโโ gemini_setup.py # Gemini API setup
โ โโโ templates/ # HTML templates
โ โ โโโ ai_services/
โ โ โโโ home.html # Main interface
โ โ โโโ login.html # Login page
โ โ โโโ signup.html # Registration page
โ โ โโโ dashboard.html # User dashboard
โ โโโ models.py # Database models
โ โโโ views.py # API views
โ โโโ auth_views.py # Authentication views
โ โโโ serializers.py # API serializers
โ โโโ middleware.py # API key middleware
โ โโโ urls.py # URL patterns
โโโ service_hub/ # Django project settings
โ โโโ settings.py # Project settings
โ โโโ urls.py # Main URL configuration
โโโ manage.py # Django management script
- Modern gradient-based UI design
- Mobile-responsive layout
- Interactive service cards
- Real-time API testing interface
- Sample data pre-loaded for testing
- Loading spinners and progress indicators
- Success/error message handling
- Copy-to-clipboard functionality for API keys
- CSRF Protection: All forms protected against CSRF attacks
- API Key Authentication: Secure API access with unique keys
- Password Validation: Strong password requirements
- Session Management: Secure user session handling
- Middleware Protection: All API endpoints protected by authentication middleware
Access Django admin at /admin/ to:
- View and manage user accounts
- Monitor API key usage
- View API usage statistics
- Manage user permissions
Run the included test script:
python test_auth.pyThis tests:
- User registration
- User login
- API key authentication
- API endpoint functionality
This project is configured for easy deployment on Vercel:
-
Install Vercel CLI
npm install -g vercel
-
Set Environment Variables Configure these in your Vercel dashboard:
SECRET_KEY=your-secret-django-key DEBUG=False SUPABASE_DB_NAME=your_db_name SUPABASE_DB_USER=your_db_user SUPABASE_DB_PASSWORD=your_db_password SUPABASE_DB_HOST=your_db_host SUPABASE_DB_PORT=5432 GOOGLE_API_KEY=your-google-api-key -
Deploy
vercel --prod
-
Test Production Settings Locally
python test_production.py
For detailed deployment instructions, see DEPLOYMENT.md.
- Set
DEBUG = False - Configure secure database (PostgreSQL recommended)
- Set up proper static file serving
- Configure HTTPS
- Set secure session cookies
- Use environment variables for all secrets
SECRET_KEY=your_django_secret_key
DEBUG=False
ALLOWED_HOSTS=your-domain.com
DATABASE_URL=your_database_url
GOOGLE_API_KEY=your_gemini_api_key- Fork the repository
- Create a feature branch
- Add your changes
- Write tests for new functionality
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the documentation
- Run the test script to verify setup
- Check Django logs for errors
- Ensure all environment variables are set
- Rate limiting for API calls
- Usage analytics and billing
- Additional AI models integration
- Bulk processing capabilities
- API versioning
- Webhook support
- Team collaboration features