This document provides comprehensive API reference for Boost.dev's internal endpoints and external service integrations.
- URL:
/login/ - Method:
GET,POST - Description: User authentication
- Parameters:
username: User's username or emailpassword: User's password
- Response: Redirect to dashboard on success
- URL:
/register/ - Method:
GET,POST - Description: New user registration
- Parameters:
username: Unique usernameemail: User emailpassword1: Passwordpassword2: Password confirmation
- Response: Redirect to dashboard with new user profile
- URLs:
/accounts/github/login/,/accounts/google-oauth2/login/, etc. - Method:
GET - Description: OAuth2 social authentication
- Response: Redirect to dashboard after successful authentication
- URL:
/challenges/ - Method:
GET - Description: List all approved challenges with filtering and pagination
- Query Parameters:
difficulty: Filter by difficulty (beginner,intermediate,hard)q: Search query for title/descriptionpage: Page number for pagination (default: 1)
- Response: Paginated challenge list
- URL:
/challenges/<int:pk>/ - Method:
GET - Description: Display single challenge with user solution status
- Response: Challenge details, hints, user's previous solution
- URL:
/challenges/<int:pk>/submit/ - Method:
POST - Description: Submit solution to challenge
- Parameters:
solution_text: User's code solution
- Response: AI feedback and solution storage
- Points Awarded:
- Beginner: +30 points
- Intermediate: +45 points
- Hard: +60 points
- URL:
/challenges/new/ - Method:
GET,POST - Description: Create new challenge
- Parameters:
title: Challenge titledescription: Challenge descriptiondifficulty: Difficulty levelhints: JSON array of hints
- Points Awarded: +40 points
- URL:
/challenges/generate/ - Method:
POST - Description: Generate new challenge using AI
- Parameters:
difficulty: Target difficulty leveltopic: Challenge topic/theme
- Response: AI-generated challenge with structured format
- URL:
/users/profile/ - Method:
GET,POST - Description: View and update user profile
- Parameters (POST):
bio: User biographygithub_username: GitHub usernameexperience_level: Experience level
- Points Awarded: +15 points (on update)
- URL:
/users/progress/(context processor) - Method: Context data
- Description: User's current progress, level, and achievements
- Response: Progress percentage, level info, recent achievements
- URL:
/wins/submit/ - Method:
GET,POST - Description: Submit daily win
- Parameters:
content: Win descriptionis_public: Whether win is publicly visible
- Points Awarded: +20 points
- URL:
/wins/my-wins/ - Method:
GET - Description: List user's personal wins
- Response: Paginated wins list with edit options
- URL:
/wins/community/ - Method:
GET - Description: List public community wins
- Response: Public wins with celebration counts
- URL:
/wins/celebrate/<int:win_id>/ - Method:
POST - Description: Celebrate/uncelebrate a win
- Response: Updated celebration status
- URL:
/dashboard/ - Method:
GET - Description: User dashboard with recent activity
- Response: Recent challenges, wins, progress summary
- URL:
/dashboard/community/ - Method:
GET - Description: Community interaction hub
- Response: Community posts, discussions
- URL:
/dashboard/tech_news/ - Method:
GET - Description: Curated technology news
- Response: Categorized news articles with caching
def get_challenge_feedback(solution_text, challenge, username):
"""
Get AI feedback on challenge solution
Args:
solution_text (str): User's solution code
challenge (obj): Challenge object with context
username (str): User's name for personalization
Returns:
str: Personalized AI feedback (3-4 sentences)
"""Model Fallback Order:
gemini-1.5-progemini-1.5-flashgemini-2.0-flash-litegemini-1.5-flash-8b
Response Format: Encouraging feedback focusing on:
- Specific strengths acknowledgment
- Gentle improvement guidance
- Growth mindset reinforcement
- Hints or next challenges
def generate_new_challenge(difficulty, topic, username):
"""
Generate new challenge using AI
Args:
difficulty (str): Target difficulty level
topic (str): Challenge topic/domain
username (str): User for personalization
Returns:
str: Structured challenge text with:
- TITLE: Challenge title
- DESCRIPTION: Detailed description
- HINT 1: First hint
- HINT 2: Second hint
- HINT 3: Third hint
"""def get_tech_news(category, query_params):
"""
Fetch categorized technology news
Categories:
- Latest Tech News
- Developer News
- Software Updates
- Cybersecurity & Hacking
- Imposter Syndrome Tips
Features:
- 30-minute server-side caching
- Rate limiting protection
- Error handling with graceful degradation
"""class UserProgress:
def calculate_percentage():
"""Calculate progress to next level"""
def update_level():
"""Update level based on points, return if leveled up"""
def add_points(points):
"""Add points and auto-level if threshold reached"""
def get_level_color():
"""Get UI color class for current level"""class Challenge:
def get_difficulty_color():
"""Get Tailwind color class for difficulty"""
# Returns: green-600, yellow-600, red-600class DailyWin:
def is_today():
"""Check if win was created today"""
def celebration_count():
"""Get total celebration count"""
def is_celebrated_by(user):
"""Check if user has celebrated this win"""
def toggle_celebration(user):
"""Toggle user's celebration status"""POST /login/with credentials- Django session creation
- Redirect to
/dashboard/ - Access protected endpoints with session
GET /accounts/{provider}/login/- OAuth2 redirect to provider
- Provider authorization
- Callback with authorization code
- Token exchange and user creation/login
- Redirect to
/dashboard/
- 401 Unauthorized: Invalid credentials
- 403 Forbidden: Insufficient permissions
- Redirect: Login required for protected endpoints
- 400 Bad Request: Form validation failures
- 404 Not Found: Resource does not exist
- 422 Unprocessable Entity: Business logic violations
- 503 Service Unavailable: External API failures
- Graceful Degradation: Fallback responses for AI services
{
"error": "Error message",
"field_errors": {
"field_name": ["Field-specific error messages"]
},
"status": "error"
}- Gemini API: Managed via multiple model fallback
- News API: 30-minute caching to reduce calls
- Social Auth: Provider-specific limits
- Session-based rate limiting via Django
- Database connection pooling
- Query optimization for performance
# Redirect responses (most endpoints)
HttpResponseRedirect('/target/url/')
# Template responses
render(request, 'template.html', context)
# JSON responses (future API endpoints)
JsonResponse({'status': 'success', 'data': data}){
'user_progress': UserProgress object,
'recent_achievements': QuerySet,
'level_progress': Integer (0-100),
'user_solutions': Dict mapping challenge_id to solution,
'notifications': QuerySet,
}- All POST endpoints require CSRF tokens
- Django middleware handles validation
- Social auth endpoints protected
- User solutions stored securely
- AI feedback anonymized in requests
- Social auth tokens handled by django-social-auth
- Environment variable storage
- No hardcoded credentials
- Separate development/production keys
- Pagination for large lists (6 items per page)
- Query prefetching for related objects
- Indexed fields for search operations
- News API responses cached 30 minutes
- Static files cached with WhiteNoise
- Template fragment caching (future)
- AI model fallback for reliability
- Async processing for non-critical operations
- Error handling with user-friendly fallbacks