├── app
├── db.py
├── main.py
├── __init__.py
├── alembic
│ ├── env.py
│ ├── versions
│ │ ├── .keep
│ │ └── 482b5ede4c04_initial_schema.py
│ ├── README
│ └── script.py.mako
├── models
│ ├── base.py
│ ├── item.py
│ ├── user.py
│ ├── __init__.py
│ ├── enums.py
│ ├── tenant.py
│ ├── payment_method.py
│ ├── subscription.py
│ ├── user_tenant.py
│ ├── tenant_invitation.py
│ └── verification_token.py
├── settings.py
├── utils
│ ├── auth.py
│ ├── current_admin.py
│ ├── current_tenant.py
│ ├── current_user.py
│ ├── token_utils.py
│ └── current_super_admin.py
├── api
│ ├── __init__.py
│ ├── auth
│ │ ├── refresh.py
│ │ ├── router.py
│ │ ├── google
│ │ │ ├── login.py
│ │ │ └── __init__.py
│ │ ├── shared_dtos.py
│ │ └── email_password
│ │ │ ├── login.py
│ │ │ ├── utils.py
│ │ │ ├── __init__.py
│ │ │ ├── register.py
│ │ │ ├── verify_email.py
│ │ │ └── reset_password.py
│ ├── items
│ │ ├── create.py
│ │ ├── delete.py
│ │ ├── get.py
│ │ ├── item.py
│ │ ├── list.py
│ │ ├── router.py
│ │ ├── update.py
│ │ └── __init__.py
│ ├── payments
│ │ ├── __init__.py
│ │ ├── router.py
│ │ ├── invoices
│ │ │ ├── __init__.py
│ │ │ ├── get_invoices.py
│ │ │ ├── shared_dtos.py
│ │ │ └── download_invoice.py
│ │ ├── plans
│ │ │ ├── __init__.py
│ │ │ └── get_available_plans.py
│ │ ├── webhooks
│ │ │ ├── __init__.py
│ │ │ ├── router.py
│ │ │ ├── event_dispatcher.py
│ │ │ ├── invoice_handlers.py
│ │ │ └── subscription_handlers.py
│ │ ├── subscriptions
│ │ │ ├── __init__.py
│ │ │ ├── helpers.py
│ │ │ ├── shared_dtos.py
│ │ │ ├── cancel_subscription.py
│ │ │ ├── create_subscription.py
│ │ │ ├── get_subscription.py
│ │ │ ├── update_subscription.py
│ │ │ └── uncancel_subscription.py
│ │ └── payment_methods
│ │ │ ├── __init__.py
│ │ │ ├── shared_dtos.py
│ │ │ ├── create_payment_method.py
│ │ │ ├── create_setup_intent.py
│ │ │ ├── delete_payment_method.py
│ │ │ ├── get_payment_methods.py
│ │ │ └── set_default_payment_method.py
│ ├── tenants
│ │ ├── core
│ │ │ ├── get.py
│ │ │ ├── list.py
│ │ │ ├── __init__.py
│ │ │ ├── create.py
│ │ │ ├── delete.py
│ │ │ └── update.py
│ │ ├── helpers.py
│ │ ├── router.py
│ │ ├── members
│ │ │ ├── list.py
│ │ │ ├── remove.py
│ │ │ ├── __init__.py
│ │ │ └── change_role.py
│ │ └── invitations
│ │ │ ├── accept.py
│ │ │ ├── invite.py
│ │ │ ├── __init__.py
│ │ │ └── set_password.py
│ └── super_admin
│ │ ├── __init__.py
│ │ ├── router.py
│ │ ├── get_all_tenants.py
│ │ └── get_tenant_details.py
├── dependencies.py
├── initial_data.py
├── tests
│ ├── conftest.py
│ ├── test_health.py
│ ├── unit
│ │ ├── conftest.py
│ │ ├── items
│ │ │ ├── __init__.py
│ │ │ └── test_items_endpoints.py
│ │ ├── payments
│ │ │ ├── __init__.py
│ │ │ ├── test_payment_method_crud.py
│ │ │ ├── test_subscription_crud.py
│ │ │ └── test_subscription_plans.py
│ │ ├── tenants
│ │ │ ├── test_members.py
│ │ │ ├── test_creation.py
│ │ │ ├── test_invitations.py
│ │ │ └── test_management.py
│ │ ├── test_initial_data.py
│ │ └── auth
│ │ │ ├── test_google_login.py
│ │ │ ├── test_iam_endpoints.py
│ │ │ ├── test_refresh_token.py
│ │ │ ├── test_reset_password.py
│ │ │ ├── test_email_verification.py
│ │ │ └── test_verification_service.py
│ └── integration
│ │ ├── conftest.py
│ │ ├── test_invitation_flow.py
│ │ └── test_resend_email_service.py
└── adapters
│ ├── email
│ ├── fake.py
│ ├── resend.py
│ └── protocol.py
│ └── payment
│ ├── fake.py
│ ├── protocol.py
│ └── stripe_adapter.py
├── scripts
└── .gitkeep
├── .github
└── workflows
│ └── .gitkeep
├── frontend
├── src
│ ├── types
│ │ └── .gitkeep
│ ├── utils
│ │ └── .gitkeep
│ ├── shared
│ │ ├── contexts
│ │ │ └── .gitkeep
│ │ ├── services
│ │ │ └── .gitkeep
│ │ ├── types
│ │ │ └── .gitkeep
│ │ └── components
│ │ │ └── .gitkeep
│ ├── features
│ │ ├── admin
│ │ │ ├── pages
│ │ │ │ └── .gitkeep
│ │ │ ├── types
│ │ │ │ └── .gitkeep
│ │ │ ├── components
│ │ │ │ └── .gitkeep
│ │ │ └── services
│ │ │ │ └── .gitkeep
│ │ ├── home
│ │ │ ├── pages
│ │ │ │ └── .gitkeep
│ │ │ ├── types
│ │ │ │ └── .gitkeep
│ │ │ ├── components
│ │ │ │ └── .gitkeep
│ │ │ └── services
│ │ │ │ └── .gitkeep
│ │ ├── items
│ │ │ ├── hooks
│ │ │ │ └── .gitkeep
│ │ │ ├── pages
│ │ │ │ └── .gitkeep
│ │ │ ├── types
│ │ │ │ └── .gitkeep
│ │ │ ├── components
│ │ │ │ └── .gitkeep
│ │ │ └── services
│ │ │ │ └── .gitkeep
│ │ ├── members
│ │ │ ├── pages
│ │ │ │ └── .gitkeep
│ │ │ ├── services
│ │ │ │ └── .gitkeep
│ │ │ ├── types
│ │ │ │ └── .gitkeep
│ │ │ └── components
│ │ │ │ └── .gitkeep
│ │ ├── settings
│ │ │ ├── pages
│ │ │ │ └── .gitkeep
│ │ │ ├── services
│ │ │ │ └── .gitkeep
│ │ │ ├── types
│ │ │ │ └── .gitkeep
│ │ │ └── components
│ │ │ │ └── .gitkeep
│ │ ├── authentication
│ │ │ ├── pages
│ │ │ │ └── .gitkeep
│ │ │ ├── types
│ │ │ │ └── .gitkeep
│ │ │ ├── components
│ │ │ │ └── .gitkeep
│ │ │ ├── contexts
│ │ │ │ └── .gitkeep
│ │ │ └── services
│ │ │ │ └── .gitkeep
│ │ └── subscription
│ │ │ ├── hooks
│ │ │ └── .gitkeep
│ │ │ ├── pages
│ │ │ └── .gitkeep
│ │ │ ├── services
│ │ │ └── .gitkeep
│ │ │ ├── types
│ │ │ └── .gitkeep
│ │ │ ├── utils
│ │ │ └── .gitkeep
│ │ │ ├── components
│ │ │ └── .gitkeep
│ │ │ └── README.md
│ └── assets
│ │ └── react.svg
├── public
│ └── python.svg
└── README.md
├── README.md
└── Makefile
/app/db.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/main.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/alembic/env.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/base.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/item.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/user.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/settings.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/utils/auth.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/scripts/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/refresh.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/router.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/create.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/delete.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/get.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/item.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/list.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/router.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/update.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/dependencies.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/initial_data.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/enums.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/tenant.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/conftest.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.github/workflows/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/adapters/email/fake.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/adapters/email/resend.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/adapters/payment/fake.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/alembic/versions/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/google/login.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/shared_dtos.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/items/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/router.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/core/get.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/core/list.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/helpers.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/router.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/payment_method.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/subscription.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/user_tenant.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/test_health.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/conftest.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/utils/current_admin.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/utils/current_tenant.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/utils/current_user.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/utils/token_utils.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/utils/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/adapters/email/protocol.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/adapters/payment/protocol.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/google/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/super_admin/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/super_admin/router.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/core/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/core/create.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/core/delete.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/core/update.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/members/list.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/members/remove.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/tenant_invitation.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/verification_token.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/integration/conftest.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/items/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/utils/current_super_admin.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/adapters/payment/stripe_adapter.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/email_password/login.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/email_password/utils.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/invoices/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/plans/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/webhooks/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/webhooks/router.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/super_admin/get_all_tenants.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/invitations/accept.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/invitations/invite.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/members/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/members/change_role.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/payments/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/tenants/test_members.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/test_initial_data.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/shared/contexts/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/shared/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/shared/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/email_password/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/email_password/register.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/email_password/verify_email.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/invoices/get_invoices.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/invoices/shared_dtos.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/helpers.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/super_admin/get_tenant_details.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/invitations/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/tenants/invitations/set_password.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/auth/test_google_login.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/auth/test_iam_endpoints.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/auth/test_refresh_token.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/auth/test_reset_password.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/tenants/test_creation.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/tenants/test_invitations.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/tenants/test_management.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/admin/pages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/admin/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/home/pages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/home/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/items/hooks/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/items/pages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/items/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/shared/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/auth/email_password/reset_password.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/invoices/download_invoice.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/payment_methods/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/payment_methods/shared_dtos.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/plans/get_available_plans.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/shared_dtos.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/webhooks/event_dispatcher.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/webhooks/invoice_handlers.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/integration/test_invitation_flow.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/auth/test_email_verification.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/auth/test_verification_service.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/items/test_items_endpoints.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/admin/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/admin/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/home/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/home/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/items/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/items/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/members/pages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/members/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/members/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/settings/pages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/settings/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/settings/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/alembic/versions/482b5ede4c04_initial_schema.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/cancel_subscription.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/create_subscription.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/get_subscription.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/update_subscription.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/webhooks/subscription_handlers.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/integration/test_resend_email_service.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/payments/test_payment_method_crud.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/payments/test_subscription_crud.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/tests/unit/payments/test_subscription_plans.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/authentication/pages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/authentication/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/members/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/settings/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/subscription/hooks/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/subscription/pages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/subscription/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/subscription/types/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/subscription/utils/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/payment_methods/create_payment_method.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/payment_methods/create_setup_intent.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/payment_methods/delete_payment_method.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/payment_methods/get_payment_methods.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/api/payments/subscriptions/uncancel_subscription.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/authentication/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/authentication/contexts/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/authentication/services/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/features/subscription/components/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/alembic/README:
--------------------------------------------------------------------------------
1 | Generic single-database configuration.
2 |
--------------------------------------------------------------------------------
/app/api/payments/payment_methods/set_default_payment_method.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/alembic/script.py.mako:
--------------------------------------------------------------------------------
1 | """${message}
2 |
3 | Revision ID: ${up_revision}
4 | Revises: ${down_revision | comma,n}
5 | Create Date: ${create_date}
6 |
7 | """
8 | from alembic import op
9 | import sqlalchemy as sa
10 | import sqlmodel.sql.sqltypes
11 | ${imports if imports else ""}
12 |
13 | # revision identifiers, used by Alembic.
14 | revision = ${repr(up_revision)}
15 | down_revision = ${repr(down_revision)}
16 | branch_labels = ${repr(branch_labels)}
17 | depends_on = ${repr(depends_on)}
18 |
19 |
20 | def upgrade():
21 | ${upgrades if upgrades else "pass"}
22 |
23 |
24 | def downgrade():
25 | ${downgrades if downgrades else "pass"}
26 |
--------------------------------------------------------------------------------
/frontend/public/python.svg:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/frontend/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/frontend/src/features/subscription/README.md:
--------------------------------------------------------------------------------
1 | # Subscription Feature
2 |
3 | This feature handles subscription management, payment methods, and billing for the FastSaaS application.
4 |
5 | ## Structure
6 |
7 | ```
8 | subscription/
9 | ├── types/
10 | │ └── subscriptionTypes.ts # TypeScript interfaces for subscription data
11 | ├── services/
12 | │ └── subscriptionService.ts # API service layer for subscription operations
13 | ├── hooks/
14 | │ └── useSubscription.ts # React hook for subscription state management
15 | ├── components/
16 | │ ├── SubscriptionOverview.tsx # Current subscription and plan management
17 | │ ├── PaymentMethodsSection.tsx # Payment method management with Stripe
18 | │ ├── AddPaymentMethodModal.tsx # Modal for adding new payment methods
19 | │ └── InvoicesSection.tsx # Billing history and invoice downloads
20 | └── README.md # This file
21 | ```
22 |
23 | ## Features
24 |
25 | ### Subscription Management
26 | - View current subscription details
27 | - Change subscription plans
28 | - Cancel subscriptions
29 | - Track subscription status and billing periods
30 |
31 | ### Payment Methods
32 | - Add payment methods using Stripe Elements
33 | - Remove payment methods
34 | - Set default payment method
35 | - View card details (last 4 digits, expiry, brand)
36 |
37 | ### Billing History
38 | - View invoice history
39 | - Download paid invoices
40 | - Track payment status
41 | - See invoice details and amounts
42 |
43 | ## Usage
44 |
45 | ### Basic Usage
46 |
47 | ```tsx
48 | import { useSubscription } from '../features/subscription/hooks/useSubscription';
49 |
50 | function SubscriptionComponent() {
51 | const subscription = useSubscription();
52 |
53 | // Access subscription data
54 | const { currentSubscription, paymentMethods, invoices, isLoading } = subscription;
55 |
56 | // Perform actions
57 | const handleCreateSubscription = async (planId: string) => {
58 | await subscription.actions.createSubscription({ planId });
59 | };
60 |
61 | return (
62 | // Your component JSX
63 | );
64 | }
65 | ```
66 |
67 | ### Adding Payment Methods
68 |
69 | The `AddPaymentMethodModal` component uses Stripe Elements for secure payment method collection:
70 |
71 | ```tsx
72 | setShowModal(false)}
75 | onAddPaymentMethod={handleAddPaymentMethod}
76 | isLoading={isLoading}
77 | />
78 | ```
79 |
80 | ## Dependencies
81 |
82 | - `@stripe/stripe-js` - Stripe JavaScript SDK
83 | - `@stripe/react-stripe-js` - React components for Stripe
84 |
85 | ## Environment Variables
86 |
87 | Required environment variables for the frontend:
88 |
89 | ```env
90 | VITE_STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key_here
91 | ```
92 |
93 | ## API Endpoints
94 |
95 | The subscription service calls the following backend endpoints:
96 |
97 | - `GET /payments/plans` - Get available subscription plans
98 | - `GET /payments/tenants/{uuid}/subscription` - Get current subscription
99 | - `POST /payments/tenants/{uuid}/subscription` - Create subscription
100 | - `PATCH /payments/tenants/{uuid}/subscription` - Update subscription
101 | - `DELETE /payments/tenants/{uuid}/subscription` - Cancel subscription
102 | - `GET /payments/tenants/{uuid}/payment-methods` - Get payment methods
103 | - `POST /payments/tenants/{uuid}/payment-methods` - Add payment method
104 | - `DELETE /payments/tenants/{uuid}/payment-methods/{id}` - Remove payment method
105 | - `PATCH /payments/tenants/{uuid}/payment-methods/{id}/set-default` - Set default payment method
106 | - `GET /payments/tenants/{uuid}/invoices` - Get invoices
107 | - `GET /payments/tenants/{uuid}/invoices/{id}/download` - Download invoice
108 |
109 | ## Security
110 |
111 | - Payment method data is handled securely through Stripe Elements
112 | - Payment method IDs are used instead of raw card data
113 | - All API calls are authenticated with Bearer tokens
114 | - Sensitive card information is not stored in the frontend state
115 |
116 | ## Error Handling
117 |
118 | - Network errors are caught and displayed to users
119 | - Stripe errors are handled in the payment method modal
120 | - Loading states prevent duplicate operations
121 | - User-friendly error messages are shown for common scenarios
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Disclaimer!
2 |
3 | This is a preview of [FastSaas](https://www.fast-saas.com).
4 |
5 | This repository shows the architecture, file structure and main features of the template. Start your SaaS today and get the full version at [www.fast-saas.com](https://www.fast-saas.com).
6 |
7 | # FastSaaS Quick Start Guide
8 |
9 | Get your FastSaaS development environment running in minutes!
10 |
11 | ## 🚀 One-Command Setup
12 |
13 | For new developers, just run:
14 |
15 | ```bash
16 | make setup
17 | ```
18 |
19 | This single command will:
20 | - ✅ Check all prerequisites are installed
21 | - 📝 Set up environment files from templates
22 | - 📦 Install Python and Node.js dependencies
23 | - 🚀 Start the development environment
24 | - 🎉 Show you all the URLs to access your app
25 |
26 | ## 📋 Prerequisites
27 |
28 | Make sure you have these installed:
29 | - **Docker & Docker Compose** - For containerized development
30 | - **uv** - Python package manager ([install guide](https://docs.astral.sh/uv/))
31 | - **Node.js** - For the React frontend
32 |
33 | ## 🔧 Full Setup (Recommended)
34 |
35 | For a complete setup with secure secrets:
36 |
37 | ```bash
38 | make setup-full
39 | ```
40 |
41 | This includes everything from `make setup` plus:
42 | - 🔐 Generates secure secrets for your `.env` file
43 | - 🗄️ Runs database migrations
44 |
45 | ## ⚡ Development URLs
46 |
47 | Once setup is complete, access your app at:
48 |
49 | | Service | URL | Description |
50 | |---------|-----|-------------|
51 | | Frontend | http://localhost:5173 | React development server |
52 | | Backend API | http://localhost:8000 | FastAPI backend |
53 | | API Docs | http://localhost:8000/docs | Interactive API documentation |
54 | | Database UI | http://localhost:8080 | Adminer database interface |
55 |
56 | ## 📝 Next Steps
57 |
58 | After running `make setup`:
59 |
60 | 1. **Configure Services** (Optional):
61 | ```bash
62 | # Generate secure secrets for production
63 | make setup-secrets
64 |
65 | # Copy the generated values to your .env file
66 | # Update Stripe keys and email settings
67 | ```
68 |
69 | 2. **Start Development**:
70 | ```bash
71 | # Start development environment
72 | make dev
73 |
74 | # View logs from all services
75 | make logs
76 |
77 | # Run tests
78 | make tests
79 |
80 | # Format code
81 | make format
82 | ```
83 |
84 | 3. **Database Operations**:
85 | ```bash
86 | # Run migrations
87 | make migrate
88 |
89 | # Create new migration
90 | make migrate-create msg="add new feature"
91 |
92 | # Connect to database
93 | make db-shell
94 | ```
95 |
96 | 4. **Test the application**:
97 |
98 | Login using the credentials defined in your FIRST_SUPERUSER and FIRST_SUPERUSER_PASSWORD environment variables
99 |
100 | ## 🛠️ Common Commands
101 |
102 | ```bash
103 | # Start development environment
104 | make dev
105 |
106 | # Stop development environment
107 | make dev-down
108 |
109 | # Restart everything
110 | make dev-restart
111 |
112 | # View help for all available commands
113 | make help
114 |
115 | # Clean up containers and caches
116 | make clean
117 | ```
118 |
119 | ## 🔍 Troubleshooting
120 |
121 | **Command not found?**
122 | - Make sure `make` is installed on your system
123 | - On macOS: `brew install make` or use Xcode Command Line Tools
124 |
125 | **Docker issues?**
126 | - Ensure Docker is running: `docker --version`
127 | - Check Docker Compose: `docker compose version`
128 |
129 | **Python/Node issues?**
130 | - Install uv: `curl -LsSf https://astral.sh/uv/install.sh | sh`
131 | - Install Node.js: https://nodejs.org/
132 |
133 | **Need help?**
134 | - Run `make help` to see all available commands
135 | - Contact us at admin@fast-saas.com, we'll be happy to assist!
136 |
137 | ## 🏗️ Project Structure
138 |
139 | ```
140 | fastapi-saas/
141 | ├── app/ # Python backend (FastAPI)
142 | ├── frontend/ # React frontend
143 | ├── scripts/ # Development scripts
144 | ├── .env.example # Environment template
145 | ├── Makefile # Development commands
146 | └── docker-compose.yml # Container configuration
147 | ```
148 |
149 | ---
150 |
151 | **That's it!** 🎉
152 |
153 | Your FastSaaS development environment should now be running. Visit http://localhost:5173 to see your application!
154 |
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | # FastSaaS Frontend Authentication
2 |
3 | A modern React TypeScript frontend application with authentication features including registration, login, Google OAuth, and email verification.
4 |
5 | ## Features
6 |
7 | - ✅ User Registration with email verification
8 | - ✅ Email/Password Login
9 | - ✅ Google OAuth Login (placeholder implementation)
10 | - ✅ Email Verification via link
11 | - ✅ Protected Dashboard
12 | - ✅ Responsive Design with Tailwind CSS
13 | - ✅ TypeScript for type safety
14 | - ✅ Feature-based architecture
15 | - ✅ Clean component structure
16 |
17 | ## Tech Stack
18 |
19 | - **React 19** - UI library
20 | - **TypeScript** - Type safety
21 | - **Vite 6** - Build tool
22 | - **React Router 7** - Client-side routing
23 | - **Tailwind CSS 4** - Styling
24 | - **Google Identity Services** - OAuth integration
25 |
26 | ## Project Structure
27 |
28 | ```
29 | src/
30 | ├── features/
31 | │ └── authentication/
32 | │ ├── components/ # Authentication UI components
33 | │ ├── hooks/ # Authentication React hooks
34 | │ ├── services/ # API communication services
35 | │ └── types/ # TypeScript type definitions
36 | ├── shared/
37 | │ ├── components/ # Reusable UI components
38 | │ ├── services/ # Shared services (API client)
39 | │ └── types/ # Shared TypeScript types
40 | ├── routes/ # Page components
41 | └── types/ # Global type declarations
42 | ```
43 |
44 | ## Getting Started
45 |
46 | ### Prerequisites
47 |
48 | - Node.js 20.11+
49 | - npm or yarn
50 | - Backend API running on `http://localhost:8000`
51 |
52 | ### Installation
53 |
54 | 1. Install dependencies:
55 | ```bash
56 | npm install
57 | ```
58 |
59 | 2. Start the development server:
60 | ```bash
61 | npm run dev
62 | ```
63 |
64 | 3. Open http://localhost:5173 in your browser
65 |
66 | ## Available Pages
67 |
68 | ### Authentication Flow
69 |
70 | 1. **Login Page** (`/login`)
71 | - Email/password authentication
72 | - Google OAuth button (requires setup)
73 | - Link to registration page
74 |
75 | 2. **Registration Page** (`/register`)
76 | - Create new account
77 | - Email verification email sent after registration
78 | - Link to login page
79 |
80 | 3. **Email Verification** (`/verify-email?token=...`)
81 | - Verifies email when user clicks verification link
82 | - Automatic verification process
83 | - Success/error states
84 |
85 | 4. **Dashboard** (`/dashboard`)
86 | - Protected route (requires authentication)
87 | - Shows user information
88 | - Logout functionality
89 |
90 | ## API Integration
91 |
92 | The frontend communicates with the FastAPI backend using these endpoints:
93 |
94 | - `POST /auth/register` - User registration
95 | - `POST /auth/login` - Email/password login
96 | - `POST /auth/google-login` - Google OAuth login
97 | - `GET /auth/verify-email?token=...` - Email verification
98 |
99 | ## Authentication State Management
100 |
101 | Authentication state is managed using a custom React hook (`useAuthentication`) that provides:
102 |
103 | - User information and authentication status
104 | - Loading states for async operations
105 | - Error handling and display
106 | - Token persistence in localStorage
107 | - Automatic session restoration
108 |
109 | ## Component Architecture
110 |
111 | The application follows the smart/dumb component pattern:
112 |
113 | - **Smart Components** (Pages): Handle business logic and state
114 | - **Dumb Components** (UI Components): Focus on presentation only
115 | - **Hooks**: Manage stateful logic and side effects
116 | - **Services**: Handle API communication
117 |
118 | ## Google OAuth Setup
119 |
120 | To enable Google OAuth:
121 |
122 | 1. Create a Google Cloud Project
123 | 2. Enable Google Identity Services
124 | 3. Configure OAuth consent screen
125 | 4. Get OAuth 2.0 client ID
126 | 5. Update the Google login component with your client ID
127 |
128 | ## Environment Variables
129 |
130 | Create a `.env` file for configuration:
131 |
132 | ```env
133 | VITE_API_BASE_URL=http://localhost:8000
134 | VITE_GOOGLE_CLIENT_ID=your_google_client_id
135 | ```
136 |
137 | ## Building for Production
138 |
139 | ```bash
140 | npm run build
141 | ```
142 |
143 | The built application will be in the `dist/` directory.
144 |
145 | ## Development Guidelines
146 |
147 | - Follow TypeScript strict mode
148 | - Use functional components with hooks
149 | - Implement proper error boundaries
150 | - Add loading states for async operations
151 | - Ensure accessibility (ARIA attributes, semantic HTML)
152 | - Mobile-first responsive design
153 | - Follow feature-based architecture
154 |
155 | ## Testing the Authentication Flow
156 |
157 | 1. **Registration**:
158 | - Go to `/register`
159 | - Fill in email and password
160 | - Check email for verification link
161 | - Click verification link
162 |
163 | 2. **Login**:
164 | - Go to `/login`
165 | - Use registered credentials
166 | - Should redirect to dashboard
167 |
168 | 3. **Email Verification**:
169 | - Click link from registration email
170 | - Should show success message
171 | - Can then login normally
172 |
173 | 4. **Session Persistence**:
174 | - Login and refresh page
175 | - Should remain logged in
176 | - Check localStorage for token
177 |
178 | ## Troubleshooting
179 |
180 | ### Common Issues
181 |
182 | 1. **CORS Errors**: Ensure backend allows frontend origin
183 | 2. **API Connection**: Verify backend is running on port 8000
184 | 3. **Google OAuth**: Check Google Client ID configuration
185 | 4. **Email Verification**: Verify email service is configured in backend
186 |
187 | ### Development Tips
188 |
189 | - Use browser DevTools to inspect network requests
190 | - Check Console for JavaScript errors
191 | - Verify localStorage for authentication tokens
192 | - Test with different email addresses
193 |
194 | ## Future Enhancements
195 |
196 | - [ ] Password reset functionality
197 | - [ ] Remember me option
198 | - [ ] Multi-factor authentication
199 | - [ ] Social login with other providers
200 | - [ ] User profile management
201 | - [ ] Account settings page
202 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # =============================================================================
2 | # FastSaaS Development Makefile
3 | # =============================================================================
4 | # Quick setup: make setup
5 | # Full setup: make setup-full
6 |
7 | .PHONY: help setup setup-full check-prereqs setup-env setup-secrets install-deps dev-up dev-down
8 | .PHONY: test test-backend test-frontend lint format clean migrate logs db-shell db-reset
9 | .PHONY: build-backend build-frontend build-all deploy-staging deploy-prod
10 |
11 | # Default target
12 | help: ## Show this help message
13 | @echo "FastSaaS Development Environment"
14 | @echo "================================"
15 | @echo ""
16 | @echo "Quick Start Commands:"
17 | @echo " make setup - Complete project setup for new developers"
18 | @echo " make setup-full - Full setup with dependency installation"
19 | @echo " make dev - Start development environment"
20 | @echo ""
21 | @echo "Development Commands:"
22 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
23 |
24 | # =============================================================================
25 | # Setup Commands
26 | # =============================================================================
27 |
28 | setup: check-prereqs setup-env install-deps dev-up setup-complete ## Complete project setup (recommended for new developers)
29 |
30 | setup-full: check-prereqs setup-env setup-secrets install-deps dev-up migrate setup-complete ## Full setup including secrets generation and migrations
31 |
32 | check-prereqs: ## Check if required tools are installed
33 | @echo "🔍 Checking prerequisites..."
34 | @command -v docker >/dev/null 2>&1 || { echo "❌ Docker is required but not installed. Please install Docker and try again."; exit 1; }
35 | @command -v docker compose >/dev/null 2>&1 || { echo "❌ Docker Compose is required but not installed. Please install Docker Compose and try again."; exit 1; }
36 | @command -v uv >/dev/null 2>&1 || { echo "❌ uv is required but not installed. Please install uv (https://docs.astral.sh/uv/) and try again."; exit 1; }
37 | @command -v node >/dev/null 2>&1 || { echo "❌ Node.js is required but not installed. Please install Node.js and try again."; exit 1; }
38 | @echo "✅ All prerequisites are installed!"
39 |
40 | setup-env: ## Set up environment files from templates
41 | @echo "⚙️ Setting up environment files..."
42 | @if [ ! -f .env ]; then \
43 | cp .env.example .env; \
44 | echo "📝 Created .env from .env.example"; \
45 | else \
46 | echo "⚠️ .env already exists, skipping..."; \
47 | fi
48 | @if [ ! -f frontend/.env ]; then \
49 | cp frontend/.env.example frontend/.env; \
50 | echo "📝 Created frontend/.env from frontend/.env.example"; \
51 | else \
52 | echo "⚠️ frontend/.env already exists, skipping..."; \
53 | fi
54 | @echo "⚠️ Remember to update the following in .env for production:"
55 | @echo " - SECRET_KEY (run: make generate-secret)"
56 | @echo " - POSTGRES_PASSWORD (run: make generate-secret)"
57 | @echo " - FIRST_SUPERUSER_PASSWORD"
58 | @echo " - Stripe keys (STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY)"
59 | @echo " - Email service settings"
60 |
61 | setup-secrets: ## Generate secure secrets for .env file
62 | @echo "🔐 Generating secure secrets..."
63 | @echo "SECRET_KEY=$$(python3 -c 'import secrets; print(secrets.token_urlsafe(32))')"
64 | @echo "POSTGRES_PASSWORD=$$(python3 -c 'import secrets; print(secrets.token_urlsafe(16))')"
65 | @echo "FIRST_SUPERUSER_PASSWORD=$$(python3 -c 'import secrets; print(secrets.token_urlsafe(12))')"
66 | @echo ""
67 | @echo "📝 Copy these values to your .env file!"
68 |
69 | generate-secret: ## Generate a single secret key
70 | @python3 -c "import secrets; print(secrets.token_urlsafe(32))"
71 |
72 | setup-complete: ## Show setup completion message
73 | @echo ""
74 | @echo "🎉 Setup Complete!"
75 | @echo "=================="
76 | @echo ""
77 | @echo "Your FastSaaS development environment is ready!"
78 | @echo ""
79 | @echo "URLs:"
80 | @echo " Frontend: http://localhost:5173"
81 | @echo " Backend API: http://localhost:8000"
82 | @echo " API Docs: http://localhost:8000/docs"
83 | @echo " Database UI: http://localhost:8080"
84 | @echo ""
85 | @echo "Next Steps:"
86 | @echo " 1. Update .env with your Stripe keys and email settings"
87 | @echo " 2. Run 'make migrate' to set up the database"
88 | @echo " 3. Run 'make logs' to monitor the application"
89 | @echo " 4. Visit http://localhost:5173 to see your app!"
90 | @echo ""
91 |
92 | # =============================================================================
93 | # Development Environment
94 | # =============================================================================
95 |
96 | install-deps: install-backend-deps install-frontend-deps ## Install all dependencies
97 |
98 | install-backend-deps: ## Install Python backend dependencies
99 | @echo "📦 Installing backend dependencies..."
100 | @uv sync
101 |
102 | install-frontend-deps: ## Install Node.js frontend dependencies
103 | @echo "📦 Installing frontend dependencies..."
104 | @cd frontend && npm install
105 |
106 | dev: dev-up ## Start development environment (alias for dev-up)
107 |
108 | dev-up: ## Start development environment with Docker Compose
109 | @echo "🚀 Starting development environment..."
110 | @docker compose watch
111 |
112 | dev-down: ## Stop development environment
113 | @echo "🛑 Stopping development environment..."
114 | @docker compose down
115 |
116 | dev-restart: dev-down dev-up ## Restart development environment
117 |
118 | logs: ## Show logs from all services
119 | @docker compose logs -f
120 |
121 | logs-backend: ## Show backend logs only
122 | @docker compose logs -f backend
123 |
124 | logs-frontend: ## Show frontend logs only
125 | @docker compose logs -f frontend
126 |
127 | logs-db: ## Show database logs only
128 | @docker compose logs -f db
129 |
130 | # =============================================================================
131 | # Database Management
132 | # =============================================================================
133 |
134 | migrate: ## Run database migrations
135 | @echo "🗄️ Running database migrations..."
136 | @uv run alembic upgrade head
137 |
138 | migrate-create: ## Create a new migration (usage: make migrate-create msg="your message")
139 | @if [ -z "$(msg)" ]; then \
140 | echo "❌ Please provide a message: make migrate-create msg='your message'"; \
141 | exit 1; \
142 | fi
143 | @echo "📝 Creating new migration: $(msg)"
144 | @uv run alembic revision --autogenerate -m "$(msg)"
145 |
146 | migrate-rollback: ## Rollback one migration
147 | @echo "↩️ Rolling back one migration..."
148 | @uv run alembic downgrade -1
149 |
150 | db-shell: ## Connect to database shell
151 | @echo "🔗 Connecting to database..."
152 | @docker compose exec db psql -U postgres -d app
153 |
154 | db-reset: ## Reset database (WARNING: destroys all data)
155 | @echo "⚠️ WARNING: This will destroy all database data!"
156 | @read -p "Are you sure? Type 'yes' to continue: " confirm; \
157 | if [ "$$confirm" = "yes" ]; then \
158 | docker compose down; \
159 | docker volume rm $$(docker volume ls -q | grep postgres) 2>/dev/null || true; \
160 | docker compose up -d db; \
161 | sleep 5; \
162 | make migrate; \
163 | echo "✅ Database reset complete!"; \
164 | else \
165 | echo "❌ Database reset cancelled."; \
166 | fi
167 |
168 | # =============================================================================
169 | # Testing
170 | # =============================================================================
171 |
172 | tests: test-backend-simple
173 |
174 | test-backend-simple: ## Run backend tests without coverage
175 | @echo "🧪 Running backend tests (simple)..."
176 | @uv run pytest
177 |
178 | test-frontend: ## Run frontend tests (if configured)
179 | @echo "🧪 Running frontend tests..."
180 | @cd frontend && npm test
181 |
182 | # =============================================================================
183 | # Code Quality
184 | # =============================================================================
185 |
186 | lint: lint-backend lint-frontend ## Run linting on all code
187 |
188 | lint-backend: ## Run backend linting (mypy + ruff)
189 | @echo "🔍 Running backend linting..."
190 | @uv run mypy app
191 | @uv run ruff check app
192 |
193 | lint-frontend: ## Run frontend linting
194 | @echo "🔍 Running frontend linting..."
195 | @cd frontend && npm run lint
196 |
197 | format: format-backend ## Format all code
198 |
199 | format-backend: ## Format backend code
200 | @echo "✨ Formatting backend code..."
201 | @uv run ruff format app
202 | @uv run ruff check --fix app
203 |
204 | # =============================================================================
205 | # Build Commands
206 | # =============================================================================
207 |
208 | build-backend: ## Build backend Docker image
209 | @echo "🏗️ Building backend image..."
210 | @docker compose build backend
211 |
212 | build-frontend: ## Build frontend for production
213 | @echo "🏗️ Building frontend..."
214 | @cd frontend && npm run build
215 |
216 | build-all: build-backend build-frontend ## Build all components
217 |
218 | # =============================================================================
219 | # Cleanup
220 | # =============================================================================
221 |
222 | clean: ## Clean up Docker containers, volumes, and caches
223 | @echo "🧹 Cleaning up..."
224 | @docker compose down -v
225 | @docker system prune -f
226 | @rm -rf .mypy_cache .pytest_cache .ruff_cache
227 | @rm -rf frontend/node_modules/.cache
228 | @echo "✅ Cleanup complete!"
229 |
230 | clean-all: clean ## Complete cleanup including node_modules and .venv
231 | @echo "🧹 Deep cleaning..."
232 | @rm -rf frontend/node_modules
233 | @rm -rf .venv
234 | @echo "✅ Deep cleanup complete!"
235 |
--------------------------------------------------------------------------------