Skip to content

Page Setup

reflex_clerk.install_pages

install_pages(
    app,
    publishable_key=None,
    signin_route="/signin",
    signup_route="/signup",
    **props
)

Installs the signin and signup pages for the given app.

Parameters:

Name Type Description Default
app App

The app instance for which the pages need to be installed.

required
publishable_key str

The publishable key to be used for payment processing. Defaults to None.

None
signin_route str

The route at which the signin page should be installed. Defaults to "/signin".

'/signin'
signup_route str

The route at which the signup page should be installed. Defaults to "/signup".

'/signup'
Example
import reflex_clerk as clerk
import reflex as rx
app = rx.App()
clerk.install_pages(app, publishable_key='your_publishable_key')

Returns:

Type Description
None

None

Source code in custom_components/reflex_clerk/lib/reflex_clerk.py
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
def install_pages(
        app: rx.App,
        publishable_key=None,
        signin_route="/signin",
        signup_route="/signup",
        **props
) -> None:
    """Installs the signin and signup pages for the given app.

    Args:
        app (rx.App): The app instance for which the pages need to be installed.
        publishable_key (str, optional): The publishable key to be used for payment processing. Defaults to None.
        signin_route (str, optional): The route at which the signin page should be installed. Defaults to "/signin".
        signup_route (str, optional): The route at which the signup page should be installed. Defaults to "/signup".

    Example:
        ```python
        import reflex_clerk as clerk
        import reflex as rx
        app = rx.App()
        clerk.install_pages(app, publishable_key='your_publishable_key')
        ```

    Returns:
        None
    """
    install_signin_page(app, publishable_key=publishable_key, route=signin_route, **props)
    install_signup_page(app, publishable_key=publishable_key, route=signup_route, **props)

reflex_clerk.install_signin_page

install_signin_page(
    app, publishable_key=None, route="/signin", **props
)

This method installs a login page on the given App instance. It creates a centered layout using the rx.center() function, with a sign-in form generated by the reflex_clerk.sign_in function. The sign-in form is vertically stacked using the rx.vstack() function, with a spacing of 7 units between each element. The entire layout is set to a height of 100vh.

The login page is then installed on the App instance using the clerk_provider() function. If a publishable key is provided, it will be used for authentication.

Example
import reflex_clerk
app = App()
reflex_clerk.install_signin_page(app, publishable_key='your_publishable_key')

Parameters:

Name Type Description Default
app App

The app instance to install the login page on.

required
publishable_key str

The publishable key to use for authentication.

None
route str

The route to install the login page on. Defaults to "/signin".

'/signin'
Source code in custom_components/reflex_clerk/lib/reflex_clerk.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def install_signin_page(app: rx.App, publishable_key=None, route="/signin", **props) -> None:
    """
    This method installs a login page on the given App instance.
    It creates a centered layout using the rx.center() function,
    with a sign-in form generated by the [reflex_clerk.sign_in][] function.
    The sign-in form is vertically stacked using the rx.vstack() function,
    with a spacing of 7 units between each element. The entire layout is
    set to a height of 100vh.

    The login page is then installed on the App instance using the
    clerk_provider() function. If a publishable key is provided,
    it will be used for authentication.

    Example:
        ```python
        import reflex_clerk
        app = App()
        reflex_clerk.install_signin_page(app, publishable_key='your_publishable_key')
        ```

    Parameters:
        app (rx.App): The app instance to install the login page on.
        publishable_key (str): The publishable key to use for authentication.
        route (str): The route to install the login page on.  Defaults to "/signin".


    """

    assert route.startswith("/"), "Expected route to be absolute (e.g. starts with '/')"

    signin_page = clerk_provider(
        rx.center(
            rx.vstack(
                sign_in(
                    path=route,
                    **props
                ),
                align="center",
                spacing="7",
            ),
            height="100vh",
        ),
        publishable_key=publishable_key
    )

    app.pages[route[1:] + "/[[...signin]]/index"] = signin_page

reflex_clerk.install_signup_page

install_signup_page(
    app, publishable_key=None, route="/signup", **props
)

This method installs a signup page on the given App instance. It creates a centered layout using the rx.center() function, with a sign-in form generated by the reflex_clerk.sign_up function. The sign-in form is vertically stacked using the rx.vstack() function, with a spacing of 7 units between each element. The entire layout is set to a height of 100vh.

The login page is then installed on the App instance using the clerk_provider() function. If a publishable key is provided, it will be used for authentication.

Example
import reflex_clerk
app = App()
reflex_clerk.install_signup_page(app, publishable_key='your_publishable_key')

Parameters:

Name Type Description Default
app App

The app instance to install the login page on.

required
publishable_key str

The publishable key to use for authentication.

None
route str

The route to install the login page on. Defaults to "/signup".

'/signup'
Source code in custom_components/reflex_clerk/lib/reflex_clerk.py
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
def install_signup_page(app: rx.App, publishable_key=None, route="/signup", **props) -> None:
    """
    This method installs a signup page on the given App instance.
    It creates a centered layout using the rx.center() function,
    with a sign-in form generated by the [reflex_clerk.sign_up][] function.
    The sign-in form is vertically stacked using the rx.vstack() function,
    with a spacing of 7 units between each element. The entire layout is
    set to a height of 100vh.

    The login page is then installed on the App instance using the
    clerk_provider() function. If a publishable key is provided,
    it will be used for authentication.

    Example:
        ```python
        import reflex_clerk
        app = App()
        reflex_clerk.install_signup_page(app, publishable_key='your_publishable_key')
        ```

    Parameters:
        app (rx.App): The app instance to install the login page on.
        publishable_key (str): The publishable key to use for authentication.
        route (str): The route to install the login page on.  Defaults to "/signup".


    """

    assert route.startswith("/"), "Expected route to be absolute (e.g. starts with '/')"

    signup_page = clerk_provider(
        rx.center(
            rx.vstack(
                sign_up(
                    path=route,
                    **props
                ),
                align="center",
                spacing="7",
            ),
            height="100vh",
        ),
        publishable_key=publishable_key
    )

    app.pages[route[1:] + "/[[...signup]]/index"] = signup_page