# Celebrity Fan Social Discovery Platform — System Design

## Overview
This project now includes a foundation for a professional, scalable social discovery platform with:
- user profiles and verified identity handling
- geolocation-enabled discovery
- paid subscriptions and premium access controls
- direct messaging and connection requests
- monetized content publishing and purchase flows
- moderation and compliance support

## Core functional domains

### Authentication & identity
- `users.CustomUser`: custom auth model with support for verified status, celebrity flag, and account lockouts
- `allauth` + `allauth.mfa`: secure authentication, email verification, and multi-factor login support
- `users.IdentityVerification`: approval workflow for identity verification and trusted celebrity accounts

### Profiles & discovery
- `users.Profile`: discovers by city/country, geolocation coordinates, visibility settings, and interests
- profile visibility controls: public, discoverable, private
- age gating via `Profile.age` and `Profile.is_adult`
- profile auto-creation via `users.signals`

### Subscriptions & monetization
- `core.SubscriptionPlan`: defines tiered plans, pricing, and messaging quotas
- `core.UserSubscription`: active subscriptions, auto-renew toggles, and provider metadata
- `core.PaidContent` and `core.ContentPurchase`: support for creator content behind paywalls

### Messaging & social connections
- `core.ConnectionRequest`: connection/like-style request flow between users
- `core.MessageThread` and `core.Message`: threaded direct messaging with read-status and attachments

### Compliance, moderation, and trust
- `core.UserReport`: user-generated reports for policy violations
- verification workflow tracks pending/approved/rejected states
- `CustomUser.is_account_locked` supports abusive account suspension and temporary lockouts
- user data fields are designed for privacy and consent management

## Scalability considerations
- use a relational database for core transactional state, with indexes on discovery-relevant fields
- segregate user profile data from auth data so profile search and verification can scale independently
- use async workers or tasks for message delivery, notification sending, and document review pipelines
- implement caching for discovery feeds and subscription entitlement checks
- isolate file uploads into `MEDIA_ROOT` and consider cloud storage for production

## Compliance & safety
- mandatory email verification and optional MFA for stronger account security
- verification workflow separates sensitive documents from standard profile fields
- age validation and region-aware visibility settings support jurisdictional compliance
- user reports and admin review provide a moderation path for harassment, scams, or policy abuse
- rate limiting on auth and account actions is already configured in `celebrity/settings.py`

## Files added and updated
- `users/models.py`: profile, verification, and extended account fields
- `core/models.py`: subscriptions, content, messaging, and moderation models
- `users/admin.py`: admin registration for user verification and profile management
- `core/admin.py`: admin registration for subscription and messaging models
- `users/forms.py`: profile and identity verification forms
- `users/signals.py`: auto-create profiles on user creation
- `users/apps.py`: signal registration
- `core/migrations/0001_initial.py`
- `users/migrations/0002_customuser_account_locked_until_and_more.py`

## Next recommended steps
1. wire UI templates for profile editing, discovery, messaging, and paid content
2. add API endpoints or HTMX views for matchmaking and payments
3. connect to a payment provider and implement subscription lifecycle events
4. add search indexing for interests and location-aware discovery
5. add consent/privacy screens and data export/delete workflows
