graph LR
User_Subscription_Data_Models["User & Subscription Data Models"]
Authentication_User_API["Authentication & User API"]
Subscription_Payment_API["Subscription & Payment API"]
API_Gateway_Router["API Gateway/Router"]
Stripe_Payment_Integration["Stripe Payment Integration"]
Google_OAuth_Provider["Google OAuth Provider"]
Database_Service["Database Service"]
Subscription_Seeding_Tool["Subscription Seeding Tool"]
Unclassified["Unclassified"]
API_Gateway_Router -- "forwards requests to" --> Authentication_User_API
API_Gateway_Router -- "forwards requests to" --> Subscription_Payment_API
Authentication_User_API -- "reads/writes user data to" --> User_Subscription_Data_Models
Authentication_User_API -- "authenticates users via" --> Google_OAuth_Provider
Subscription_Payment_API -- "reads/writes subscription data to" --> User_Subscription_Data_Models
Subscription_Payment_API -- "initiates payments and processes webhooks with" --> Stripe_Payment_Integration
User_Subscription_Data_Models -- "persists and retrieves data from" --> Database_Service
Stripe_Payment_Integration -- "updates subscription statuses in" --> User_Subscription_Data_Models
Subscription_Seeding_Tool -- "directly interacts with" --> User_Subscription_Data_Models
click API_Gateway_Router href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/cvimprover-api/API_Gateway_Router.md" "Details"
The system is structured around a core set of APIs for user authentication, profile management, and subscription handling. The API Gateway/Router directs incoming requests to either the Authentication & User API or the Subscription & Payment API. Both APIs interact with the User & Subscription Data Models for data persistence, which in turn relies on the Database Service. User authentication can be performed directly or through the Google OAuth Provider. The Subscription & Payment API integrates with Stripe Payment Integration for processing payments and managing subscriptions, with Stripe webhooks updating the User & Subscription Data Models. A Subscription Seeding Tool is available for initial population of subscription plans.
Defines the foundational data structures for users, user profiles, authentication tokens (JWT), various subscription plans, and payment-related information. It establishes relationships between users and their active subscriptions.
Related Classes/Methods:
Provides RESTful API endpoints for user registration, login (supporting JWT and Google OAuth), password management, and CRUD operations for user profiles. It leverages dj_rest_auth and allauth for robust authentication flows.
Related Classes/Methods:
core.views.CustomUserDetailsView:35-37core.views.GoogleLogin:39-40core.serializers.CustomUserDetailsSerializer:61-117dj_rest_auth.views.UserDetailsViewallauth.socialaccount.providers.google.views.GoogleOAuth2Adapter
Manages API endpoints for displaying available subscription plans, initiating new subscriptions, handling plan upgrades/downgrades, and processing subscription cancellations. It also includes webhook handlers for Stripe events.
Related Classes/Methods:
core.views.CreateCheckoutSessionView:42-108core.views.StripeWebhookView:115-206core.views.PlanListView:210-261core.views.CreateBillingPortalSessionView:263-278core.views.VerifyCheckoutSessionView:281-380core.serializers.PlanSerializer:12-56
API Gateway/Router [Expand]
Serves as the entry point for all incoming requests to the user and subscription management functionalities, mapping specific URL patterns to the appropriate view functions within the Authentication & User API and Subscription & Payment API.
Related Classes/Methods:
Handles direct communication with the Stripe API for processing payments, creating customer records, managing subscriptions, and securely receiving and processing payment-related webhooks.
Related Classes/Methods:
stripecore.views.CreateCheckoutSessionView:42-108core.views.StripeWebhookView:115-206core.serializers.PlanSerializer.get_price_detailscore.serializers.CustomUserDetailsSerializer._get_subscription_info
Manages the secure integration with Google's OAuth 2.0 service, enabling users to authenticate and register using their Google accounts.
Related Classes/Methods:
allauth.socialaccount.providers.google.views.GoogleOAuth2Adaptercore.views.GoogleLogin:39-40cvimprover.settings.SOCIALACCOUNT_PROVIDERS
Provides the underlying persistent storage and retrieval mechanisms for all user, profile, authentication, and subscription-related data defined by the User & Subscription Data Models.
Related Classes/Methods:
A Django management command designed for initial setup, populating the database with predefined subscription plans to ensure the system has a baseline of available offerings.
Related Classes/Methods:
Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)
Related Classes/Methods: None