fastapi-auth-starter 0.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. fastapi_auth_starter/__init__.py +7 -0
  2. fastapi_auth_starter/cli.py +326 -0
  3. fastapi_auth_starter-0.1.3.data/data/README.md +247 -0
  4. fastapi_auth_starter-0.1.3.data/data/alembic/README +1 -0
  5. fastapi_auth_starter-0.1.3.data/data/alembic/env.py +100 -0
  6. fastapi_auth_starter-0.1.3.data/data/alembic/script.py.mako +28 -0
  7. fastapi_auth_starter-0.1.3.data/data/alembic/versions/279c472f4fd8_add_user_table.py +42 -0
  8. fastapi_auth_starter-0.1.3.data/data/alembic/versions/5f062b3648fa_change_user_id_from_uuid_to_string_for_.py +38 -0
  9. fastapi_auth_starter-0.1.3.data/data/alembic/versions/8d275132562b_create_tasks_table.py +44 -0
  10. fastapi_auth_starter-0.1.3.data/data/alembic.ini +150 -0
  11. fastapi_auth_starter-0.1.3.data/data/app/__init__.py +5 -0
  12. fastapi_auth_starter-0.1.3.data/data/app/api/__init__.py +4 -0
  13. fastapi_auth_starter-0.1.3.data/data/app/api/v1/__init__.py +4 -0
  14. fastapi_auth_starter-0.1.3.data/data/app/api/v1/api.py +21 -0
  15. fastapi_auth_starter-0.1.3.data/data/app/api/v1/routes/__init__.py +4 -0
  16. fastapi_auth_starter-0.1.3.data/data/app/api/v1/routes/auth.py +513 -0
  17. fastapi_auth_starter-0.1.3.data/data/app/api/v1/routes/health.py +50 -0
  18. fastapi_auth_starter-0.1.3.data/data/app/api/v1/routes/task.py +182 -0
  19. fastapi_auth_starter-0.1.3.data/data/app/api/v1/routes/user.py +144 -0
  20. fastapi_auth_starter-0.1.3.data/data/app/api/v1/schemas/__init__.py +8 -0
  21. fastapi_auth_starter-0.1.3.data/data/app/api/v1/schemas/auth.py +198 -0
  22. fastapi_auth_starter-0.1.3.data/data/app/api/v1/schemas/task.py +61 -0
  23. fastapi_auth_starter-0.1.3.data/data/app/api/v1/schemas/user.py +96 -0
  24. fastapi_auth_starter-0.1.3.data/data/app/core/__init__.py +4 -0
  25. fastapi_auth_starter-0.1.3.data/data/app/core/config.py +107 -0
  26. fastapi_auth_starter-0.1.3.data/data/app/core/database.py +106 -0
  27. fastapi_auth_starter-0.1.3.data/data/app/core/dependencies.py +148 -0
  28. fastapi_auth_starter-0.1.3.data/data/app/core/exceptions.py +7 -0
  29. fastapi_auth_starter-0.1.3.data/data/app/db/__init__.py +4 -0
  30. fastapi_auth_starter-0.1.3.data/data/app/main.py +91 -0
  31. fastapi_auth_starter-0.1.3.data/data/app/models/__init__.py +14 -0
  32. fastapi_auth_starter-0.1.3.data/data/app/models/task.py +56 -0
  33. fastapi_auth_starter-0.1.3.data/data/app/models/user.py +45 -0
  34. fastapi_auth_starter-0.1.3.data/data/app/services/__init__.py +8 -0
  35. fastapi_auth_starter-0.1.3.data/data/app/services/auth.py +405 -0
  36. fastapi_auth_starter-0.1.3.data/data/app/services/task.py +165 -0
  37. fastapi_auth_starter-0.1.3.data/data/app/services/user.py +108 -0
  38. fastapi_auth_starter-0.1.3.data/data/pyproject.toml +77 -0
  39. fastapi_auth_starter-0.1.3.data/data/runtime.txt +2 -0
  40. fastapi_auth_starter-0.1.3.data/data/vercel.json +19 -0
  41. fastapi_auth_starter-0.1.3.dist-info/METADATA +283 -0
  42. fastapi_auth_starter-0.1.3.dist-info/RECORD +44 -0
  43. fastapi_auth_starter-0.1.3.dist-info/WHEEL +4 -0
  44. fastapi_auth_starter-0.1.3.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,28 @@
1
+ """${message}
2
+
3
+ Revision ID: ${up_revision}
4
+ Revises: ${down_revision | comma,n}
5
+ Create Date: ${create_date}
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+ ${imports if imports else ""}
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = ${repr(up_revision)}
16
+ down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
17
+ branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
18
+ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
19
+
20
+
21
+ def upgrade() -> None:
22
+ """Upgrade schema."""
23
+ ${upgrades if upgrades else "pass"}
24
+
25
+
26
+ def downgrade() -> None:
27
+ """Downgrade schema."""
28
+ ${downgrades if downgrades else "pass"}
@@ -0,0 +1,42 @@
1
+ """Add user table
2
+
3
+ Revision ID: 279c472f4fd8
4
+ Revises: 8d275132562b
5
+ Create Date: 2025-11-05 10:15:15.526956
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = '279c472f4fd8'
16
+ down_revision: Union[str, Sequence[str], None] = '8d275132562b'
17
+ branch_labels: Union[str, Sequence[str], None] = None
18
+ depends_on: Union[str, Sequence[str], None] = None
19
+
20
+
21
+ def upgrade() -> None:
22
+ """Upgrade schema."""
23
+ # ### commands auto generated by Alembic - please adjust! ###
24
+ op.create_table('users',
25
+ sa.Column('id', sa.UUID(), nullable=False),
26
+ sa.Column('email', sa.String(), nullable=False),
27
+ sa.Column('first_name', sa.String(), nullable=True),
28
+ sa.Column('last_name', sa.String(), nullable=True),
29
+ sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
30
+ sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
31
+ sa.PrimaryKeyConstraint('id')
32
+ )
33
+ op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
34
+ # ### end Alembic commands ###
35
+
36
+
37
+ def downgrade() -> None:
38
+ """Downgrade schema."""
39
+ # ### commands auto generated by Alembic - please adjust! ###
40
+ op.drop_index(op.f('ix_users_email'), table_name='users')
41
+ op.drop_table('users')
42
+ # ### end Alembic commands ###
@@ -0,0 +1,38 @@
1
+ """Change user id from UUID to String for WorkOS
2
+
3
+ Revision ID: 5f062b3648fa
4
+ Revises: 279c472f4fd8
5
+ Create Date: 2025-11-05 10:50:28.499234
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = '5f062b3648fa'
16
+ down_revision: Union[str, Sequence[str], None] = '279c472f4fd8'
17
+ branch_labels: Union[str, Sequence[str], None] = None
18
+ depends_on: Union[str, Sequence[str], None] = None
19
+
20
+
21
+ def upgrade() -> None:
22
+ """Upgrade schema."""
23
+ # ### commands auto generated by Alembic - please adjust! ###
24
+ op.alter_column('users', 'id',
25
+ existing_type=sa.UUID(),
26
+ type_=sa.String(),
27
+ existing_nullable=False)
28
+ # ### end Alembic commands ###
29
+
30
+
31
+ def downgrade() -> None:
32
+ """Downgrade schema."""
33
+ # ### commands auto generated by Alembic - please adjust! ###
34
+ op.alter_column('users', 'id',
35
+ existing_type=sa.String(),
36
+ type_=sa.UUID(),
37
+ existing_nullable=False)
38
+ # ### end Alembic commands ###
@@ -0,0 +1,44 @@
1
+ """Create tasks table
2
+
3
+ Revision ID: 8d275132562b
4
+ Revises:
5
+ Create Date: 2025-11-04 21:48:32.061970
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = '8d275132562b'
16
+ down_revision: Union[str, Sequence[str], None] = None
17
+ branch_labels: Union[str, Sequence[str], None] = None
18
+ depends_on: Union[str, Sequence[str], None] = None
19
+
20
+
21
+ def upgrade() -> None:
22
+ """Upgrade schema."""
23
+ # ### commands auto generated by Alembic - please adjust! ###
24
+ op.create_table('tasks',
25
+ sa.Column('id', sa.Integer(), nullable=False),
26
+ sa.Column('title', sa.String(length=200), nullable=False),
27
+ sa.Column('description', sa.String(length=1000), nullable=True),
28
+ sa.Column('completed', sa.Boolean(), nullable=False),
29
+ sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
30
+ sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
31
+ sa.PrimaryKeyConstraint('id')
32
+ )
33
+ op.create_index(op.f('ix_tasks_id'), 'tasks', ['id'], unique=False)
34
+ op.create_index(op.f('ix_tasks_title'), 'tasks', ['title'], unique=False)
35
+ # ### end Alembic commands ###
36
+
37
+
38
+ def downgrade() -> None:
39
+ """Downgrade schema."""
40
+ # ### commands auto generated by Alembic - please adjust! ###
41
+ op.drop_index(op.f('ix_tasks_title'), table_name='tasks')
42
+ op.drop_index(op.f('ix_tasks_id'), table_name='tasks')
43
+ op.drop_table('tasks')
44
+ # ### end Alembic commands ###
@@ -0,0 +1,150 @@
1
+ # A generic, single database configuration.
2
+
3
+ [alembic]
4
+ # path to migration scripts.
5
+ # this is typically a path given in POSIX (e.g. forward slashes)
6
+ # format, relative to the token %(here)s which refers to the location of this
7
+ # ini file
8
+ script_location = %(here)s/alembic
9
+
10
+ # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
11
+ # Uncomment the line below if you want the files to be prepended with date and time
12
+ # see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
13
+ # for all available tokens
14
+ # file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
15
+
16
+ # sys.path path, will be prepended to sys.path if present.
17
+ # defaults to the current working directory. for multiple paths, the path separator
18
+ # is defined by "path_separator" below.
19
+ prepend_sys_path = .
20
+
21
+
22
+ # timezone to use when rendering the date within the migration file
23
+ # as well as the filename.
24
+ # If specified, requires the tzdata library which can be installed by adding
25
+ # `alembic[tz]` to the pip requirements.
26
+ # string value is passed to ZoneInfo()
27
+ # leave blank for localtime
28
+ # timezone =
29
+
30
+ # max length of characters to apply to the "slug" field
31
+ # truncate_slug_length = 40
32
+
33
+ # set to 'true' to run the environment during
34
+ # the 'revision' command, regardless of autogenerate
35
+ # revision_environment = false
36
+
37
+ # set to 'true' to allow .pyc and .pyo files without
38
+ # a source .py file to be detected as revisions in the
39
+ # versions/ directory
40
+ # sourceless = false
41
+
42
+ # version location specification; This defaults
43
+ # to <script_location>/versions. When using multiple version
44
+ # directories, initial revisions must be specified with --version-path.
45
+ # The path separator used here should be the separator specified by "path_separator"
46
+ # below.
47
+ # version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
48
+
49
+ # path_separator; This indicates what character is used to split lists of file
50
+ # paths, including version_locations and prepend_sys_path within configparser
51
+ # files such as alembic.ini.
52
+ # The default rendered in new alembic.ini files is "os", which uses os.pathsep
53
+ # to provide os-dependent path splitting.
54
+ #
55
+ # Note that in order to support legacy alembic.ini files, this default does NOT
56
+ # take place if path_separator is not present in alembic.ini. If this
57
+ # option is omitted entirely, fallback logic is as follows:
58
+ #
59
+ # 1. Parsing of the version_locations option falls back to using the legacy
60
+ # "version_path_separator" key, which if absent then falls back to the legacy
61
+ # behavior of splitting on spaces and/or commas.
62
+ # 2. Parsing of the prepend_sys_path option falls back to the legacy
63
+ # behavior of splitting on spaces, commas, or colons.
64
+ #
65
+ # Valid values for path_separator are:
66
+ #
67
+ # path_separator = :
68
+ # path_separator = ;
69
+ # path_separator = space
70
+ # path_separator = newline
71
+ #
72
+ # Use os.pathsep. Default configuration used for new projects.
73
+ path_separator = os
74
+
75
+ # set to 'true' to search source files recursively
76
+ # in each "version_locations" directory
77
+ # new in Alembic version 1.10
78
+ # recursive_version_locations = false
79
+
80
+ # the output encoding used when revision files
81
+ # are written from script.py.mako
82
+ # output_encoding = utf-8
83
+
84
+ # database URL. This is consumed by the user-maintained env.py script only.
85
+ # other means of configuring database URLs may be customized within the env.py
86
+ # file.
87
+ # Note: The database URL is loaded from .env file via app.core.config.settings
88
+ # env.py automatically converts asyncpg URL to psycopg2 for migrations
89
+ # Leave this empty or comment it out - env.py will use DATABASE_URL from .env
90
+ # sqlalchemy.url =
91
+
92
+
93
+ [post_write_hooks]
94
+ # post_write_hooks defines scripts or Python functions that are run
95
+ # on newly generated revision scripts. See the documentation for further
96
+ # detail and examples
97
+
98
+ # format using "black" - use the console_scripts runner, against the "black" entrypoint
99
+ # hooks = black
100
+ # black.type = console_scripts
101
+ # black.entrypoint = black
102
+ # black.options = -l 79 REVISION_SCRIPT_FILENAME
103
+
104
+ # lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
105
+ # hooks = ruff
106
+ # ruff.type = module
107
+ # ruff.module = ruff
108
+ # ruff.options = check --fix REVISION_SCRIPT_FILENAME
109
+
110
+ # Alternatively, use the exec runner to execute a binary found on your PATH
111
+ # hooks = ruff
112
+ # ruff.type = exec
113
+ # ruff.executable = ruff
114
+ # ruff.options = check --fix REVISION_SCRIPT_FILENAME
115
+
116
+ # Logging configuration. This is also consumed by the user-maintained
117
+ # env.py script only.
118
+ [loggers]
119
+ keys = root,sqlalchemy,alembic
120
+
121
+ [handlers]
122
+ keys = console
123
+
124
+ [formatters]
125
+ keys = generic
126
+
127
+ [logger_root]
128
+ level = WARNING
129
+ handlers = console
130
+ qualname =
131
+
132
+ [logger_sqlalchemy]
133
+ level = WARNING
134
+ handlers =
135
+ qualname = sqlalchemy.engine
136
+
137
+ [logger_alembic]
138
+ level = INFO
139
+ handlers =
140
+ qualname = alembic
141
+
142
+ [handler_console]
143
+ class = StreamHandler
144
+ args = (sys.stderr,)
145
+ level = NOTSET
146
+ formatter = generic
147
+
148
+ [formatter_generic]
149
+ format = %(levelname)-5.5s [%(name)s] %(message)s
150
+ datefmt = %H:%M:%S
@@ -0,0 +1,5 @@
1
+ """
2
+ FastAPI Auth Starter Application
3
+ Main application package
4
+ """
5
+
@@ -0,0 +1,4 @@
1
+ """
2
+ API routes and endpoints
3
+ """
4
+
@@ -0,0 +1,4 @@
1
+ """
2
+ API v1 routes
3
+ """
4
+
@@ -0,0 +1,21 @@
1
+ """
2
+ API v1 router aggregation
3
+ Combines all v1 route handlers into a single router
4
+ Reference: https://fastapi.tiangolo.com/tutorial/bigger-applications/
5
+ """
6
+ from fastapi import APIRouter
7
+
8
+ from app.api.v1.routes import health, task, user, auth
9
+ from app.core.config import settings
10
+
11
+
12
+ # Create main API router for v1
13
+ # All v1 routes will be prefixed with /api/v1
14
+ api_router = APIRouter(prefix=settings.API_V1_PREFIX)
15
+
16
+ # Include route modules
17
+ # Each route module is added as a sub-router
18
+ api_router.include_router(auth.router)
19
+ api_router.include_router(user.router)
20
+ api_router.include_router(task.router)
21
+ api_router.include_router(health.router)
@@ -0,0 +1,4 @@
1
+ """
2
+ API v1 route handlers
3
+ """
4
+