crudadmin 0.1.0__tar.gz

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 (58) hide show
  1. crudadmin-0.1.0/LICENSE +21 -0
  2. crudadmin-0.1.0/PKG-INFO +270 -0
  3. crudadmin-0.1.0/README.md +208 -0
  4. crudadmin-0.1.0/crudadmin/__init__.py +3 -0
  5. crudadmin-0.1.0/crudadmin/admin_interface/__init__.py +0 -0
  6. crudadmin-0.1.0/crudadmin/admin_interface/admin_site.py +643 -0
  7. crudadmin-0.1.0/crudadmin/admin_interface/auth.py +122 -0
  8. crudadmin-0.1.0/crudadmin/admin_interface/crud_admin.py +1174 -0
  9. crudadmin-0.1.0/crudadmin/admin_interface/helper.py +122 -0
  10. crudadmin-0.1.0/crudadmin/admin_interface/middleware/__init__.py +9 -0
  11. crudadmin-0.1.0/crudadmin/admin_interface/middleware/auth.py +117 -0
  12. crudadmin-0.1.0/crudadmin/admin_interface/middleware/https.py +21 -0
  13. crudadmin-0.1.0/crudadmin/admin_interface/middleware/ip_restriction.py +89 -0
  14. crudadmin-0.1.0/crudadmin/admin_interface/model_view.py +1181 -0
  15. crudadmin-0.1.0/crudadmin/admin_interface/typing.py +7 -0
  16. crudadmin-0.1.0/crudadmin/admin_token/__init__.py +19 -0
  17. crudadmin-0.1.0/crudadmin/admin_token/models.py +35 -0
  18. crudadmin-0.1.0/crudadmin/admin_token/schemas.py +25 -0
  19. crudadmin-0.1.0/crudadmin/admin_token/service.py +119 -0
  20. crudadmin-0.1.0/crudadmin/admin_user/__init__.py +23 -0
  21. crudadmin-0.1.0/crudadmin/admin_user/models.py +29 -0
  22. crudadmin-0.1.0/crudadmin/admin_user/schemas.py +69 -0
  23. crudadmin-0.1.0/crudadmin/admin_user/service.py +128 -0
  24. crudadmin-0.1.0/crudadmin/core/__init__.py +21 -0
  25. crudadmin-0.1.0/crudadmin/core/db.py +257 -0
  26. crudadmin-0.1.0/crudadmin/core/exceptions.py +19 -0
  27. crudadmin-0.1.0/crudadmin/core/schemas/__init__.py +5 -0
  28. crudadmin-0.1.0/crudadmin/core/schemas/timestamp.py +23 -0
  29. crudadmin-0.1.0/crudadmin/event/__init__.py +38 -0
  30. crudadmin-0.1.0/crudadmin/event/decorators.py +327 -0
  31. crudadmin-0.1.0/crudadmin/event/integration.py +120 -0
  32. crudadmin-0.1.0/crudadmin/event/models.py +97 -0
  33. crudadmin-0.1.0/crudadmin/event/schemas.py +65 -0
  34. crudadmin-0.1.0/crudadmin/event/service.py +254 -0
  35. crudadmin-0.1.0/crudadmin/py.typed +0 -0
  36. crudadmin-0.1.0/crudadmin/session/__init__.py +17 -0
  37. crudadmin-0.1.0/crudadmin/session/manager.py +284 -0
  38. crudadmin-0.1.0/crudadmin/session/models.py +46 -0
  39. crudadmin-0.1.0/crudadmin/session/schemas.py +41 -0
  40. crudadmin-0.1.0/crudadmin/static/favicon.png +0 -0
  41. crudadmin-0.1.0/crudadmin/static/htmx.min.js +1 -0
  42. crudadmin-0.1.0/crudadmin/templates/admin/dashboard/dashboard.html +35 -0
  43. crudadmin-0.1.0/crudadmin/templates/admin/dashboard/dashboard_content.html +155 -0
  44. crudadmin-0.1.0/crudadmin/templates/admin/management/events.html +437 -0
  45. crudadmin-0.1.0/crudadmin/templates/admin/management/events_content.html +191 -0
  46. crudadmin-0.1.0/crudadmin/templates/admin/management/health.html +241 -0
  47. crudadmin-0.1.0/crudadmin/templates/admin/management/health_content.html +49 -0
  48. crudadmin-0.1.0/crudadmin/templates/admin/model/components/list_content.html +115 -0
  49. crudadmin-0.1.0/crudadmin/templates/admin/model/components/pagination.html +41 -0
  50. crudadmin-0.1.0/crudadmin/templates/admin/model/components/table_content.html +16 -0
  51. crudadmin-0.1.0/crudadmin/templates/admin/model/create.html +384 -0
  52. crudadmin-0.1.0/crudadmin/templates/admin/model/list.html +609 -0
  53. crudadmin-0.1.0/crudadmin/templates/admin/model/update.html +396 -0
  54. crudadmin-0.1.0/crudadmin/templates/auth/login.html +160 -0
  55. crudadmin-0.1.0/crudadmin/templates/base/base.html +418 -0
  56. crudadmin-0.1.0/crudadmin/templates/shared/utils/refresh.html +9 -0
  57. crudadmin-0.1.0/pyproject.toml +141 -0
  58. crudadmin-0.1.0/tests/__init__.py +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Igor Benav
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,270 @@
1
+ Metadata-Version: 2.1
2
+ Name: crudadmin
3
+ Version: 0.1.0
4
+ Summary: FastAPI-based admin interface with authentication, event logging and CRUD operations
5
+ Author-Email: Igor Benav <igor.magalhaes.r@gmail.com>
6
+ Classifier: Development Status :: 3 - Alpha
7
+ Classifier: Environment :: Web Environment
8
+ Classifier: Framework :: FastAPI
9
+ Classifier: Framework :: Pydantic
10
+ Classifier: Framework :: Pydantic :: 2
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Topic :: Internet :: WWW/HTTP
22
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
23
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
24
+ Classifier: Typing :: Typed
25
+ Project-URL: Homepage, https://github.com/igorbenav/crudadmin
26
+ Project-URL: Documentation, https://igorbenav.github.io/crudadmin
27
+ Project-URL: Repository, https://github.com/igorbenav/crudadmin
28
+ Project-URL: Issues, https://github.com/igorbenav/crudadmin/issues
29
+ Project-URL: Changelog, https://github.com/igorbenav/crudadmin/releases
30
+ Requires-Python: >=3.9
31
+ Requires-Dist: bcrypt>=4.2.1
32
+ Requires-Dist: fastapi>=0.115.6
33
+ Requires-Dist: fastcrud>=0.15.5
34
+ Requires-Dist: jinja2>=3.1.5
35
+ Requires-Dist: pydantic[email]>=2.10.4
36
+ Requires-Dist: python-jose>=3.3.0
37
+ Requires-Dist: python-multipart>=0.0.20
38
+ Requires-Dist: sqlalchemy>=2.0.36
39
+ Requires-Dist: user-agents>=2.2.0
40
+ Requires-Dist: aiosqlite>=0.20.0
41
+ Requires-Dist: greenlet>=3.1.1
42
+ Provides-Extra: standard
43
+ Requires-Dist: uvicorn[standard]>=0.12.0; extra == "standard"
44
+ Provides-Extra: dev
45
+ Requires-Dist: pytest>=8.3.4; extra == "dev"
46
+ Requires-Dist: pytest-asyncio>=0.25.3; extra == "dev"
47
+ Requires-Dist: testcontainers[postgresql]>=4.9.1; extra == "dev"
48
+ Requires-Dist: ruff>=0.9.3; extra == "dev"
49
+ Requires-Dist: mypy>=1.9.0; extra == "dev"
50
+ Requires-Dist: httptools>=0.6.4; extra == "dev"
51
+ Requires-Dist: httpx>=0.28.1; extra == "dev"
52
+ Requires-Dist: sqlalchemy[mypy]>=2.0.36; extra == "dev"
53
+ Requires-Dist: sqlalchemy-utils>=0.41.2; extra == "dev"
54
+ Provides-Extra: docs
55
+ Requires-Dist: mkdocs>=1.6.1; extra == "docs"
56
+ Requires-Dist: mkdocs-meta-descriptions-plugin>=4.0.0; extra == "docs"
57
+ Requires-Dist: mkdocs-material>=9.6.1; extra == "docs"
58
+ Requires-Dist: mkdocstrings[python]>=0.27.0; extra == "docs"
59
+ Provides-Extra: all
60
+ Requires-Dist: crudadmin[dev,docs,standard]; extra == "all"
61
+ Description-Content-Type: text/markdown
62
+
63
+ # CRUDAdmin
64
+
65
+ <p align="center">
66
+ <a href="https://igorbenav.github.io/crudadmin/">
67
+ <img src="docs/assets/CRUDAdmin.png" alt="CRUDAdmin logo" width="45%" height="auto">
68
+ </a>
69
+ </p>
70
+
71
+ <p align="center">
72
+ <i>Modern admin interface for FastAPI with built-in authentication, event tracking, and security features</i>
73
+ </p>
74
+
75
+ <p align="center">
76
+ <a href="https://pypi.org/project/crudadmin">
77
+ <img src="https://img.shields.io/pypi/v/crudadmin?color=%2334D058&label=pypi%20package" alt="Package version"/>
78
+ </a>
79
+ <a href="https://pypi.org/project/crudadmin">
80
+ <img src="https://img.shields.io/pypi/pyversions/crudadmin.svg?color=%2334D058" alt="Supported Python versions"/>
81
+ </a>
82
+ </p>
83
+
84
+ <hr>
85
+ <p align="justify">
86
+ <b>CRUDAdmin</b> is a robust admin interface generator for <b>FastAPI</b> applications, offering secure authentication, comprehensive event tracking, and essential monitoring features. Built on top of FastCRUD and SQLAlchemy, it helps you create production-ready admin panels with minimal configuration.
87
+ </p>
88
+
89
+ <p><b>Documentation</b>: <a href="https://igorbenav.github.io/crudadmin/">https://igorbenav.github.io/crudadmin/</a></p>
90
+
91
+ <hr>
92
+
93
+ ## Features
94
+
95
+ - 🔒 **Session-based Authentication**: Secure session management with inactivity timeouts and concurrent session limits
96
+ - 🛡️ **Built-in Security**: IP restrictions, HTTPS enforcement, and secure cookie handling
97
+ - 📝 **Event Tracking**: Comprehensive audit logs for all admin actions with user attribution
98
+ - 🏥 **Health Monitoring**: Real-time system status dashboard with key metrics
99
+ - 📊 **Auto-generated Interface**: Creates admin UI directly from your SQLAlchemy models
100
+ - 🔍 **Smart Filtering**: Type-aware field filtering and efficient search
101
+ - 🌗 **Modern UI**: Clean interface with dark/light theme support
102
+
103
+ ## Requirements
104
+
105
+ Before installing CRUDAdmin, ensure you have:
106
+
107
+ - **FastAPI**: Latest version for the web framework
108
+ - **SQLAlchemy**: Version 2.0+ for database operations
109
+ - **Pydantic**: Version 2.0+ for data validation
110
+
111
+ ## Installing
112
+
113
+ ```sh
114
+ pip install crudadmin
115
+ ```
116
+
117
+ Or using poetry:
118
+
119
+ ```sh
120
+ poetry add crudadmin
121
+ ```
122
+
123
+ ## Usage
124
+
125
+ CRUDAdmin offers a straightforward way to create admin interfaces. Here's how to get started:
126
+
127
+ ### Define Your Models and Schemas
128
+
129
+ **models.py**
130
+ ```python
131
+ from sqlalchemy.orm import DeclarativeBase
132
+ from sqlalchemy import Column, Integer, String
133
+
134
+ class Base(DeclarativeBase):
135
+ pass
136
+
137
+ class User(Base):
138
+ __tablename__ = "users"
139
+ id = Column(Integer, primary_key=True)
140
+ username = Column(String, unique=True)
141
+ email = Column(String)
142
+ role = Column(String)
143
+ ```
144
+
145
+ **schemas.py**
146
+ ```python
147
+ from pydantic import BaseModel, EmailStr
148
+
149
+ class UserCreate(BaseModel):
150
+ username: str
151
+ email: EmailStr
152
+ role: str = "user"
153
+
154
+ class UserUpdate(BaseModel):
155
+ email: EmailStr | None = None
156
+ role: str | None = None
157
+ ```
158
+
159
+ ### Set Up the Admin Interface
160
+
161
+ **main.py**
162
+ ```python
163
+ from contextlib import asynccontextmanager
164
+ from fastapi import FastAPI
165
+ from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
166
+ from crudadmin import CRUDAdmin
167
+ import os
168
+
169
+ # Database setup
170
+ engine = create_async_engine("sqlite+aiosqlite:///app.db")
171
+ session = AsyncSession(engine)
172
+
173
+ # Create admin interface
174
+ admin = CRUDAdmin(
175
+ session=session,
176
+ SECRET_KEY=os.environ.get("ADMIN_SECRET_KEY"),
177
+ initial_admin={
178
+ "username": "admin",
179
+ "password": "secure_password123"
180
+ }
181
+ )
182
+
183
+ # Add models to admin
184
+ admin.add_view(
185
+ model=User,
186
+ create_schema=UserCreate,
187
+ update_schema=UserUpdate,
188
+ allowed_actions={"view", "create", "update"}
189
+ )
190
+
191
+ # Setup FastAPI with proper initialization
192
+ @asynccontextmanager
193
+ async def lifespan(app: FastAPI):
194
+ # Initialize database tables
195
+ async with engine.begin() as conn:
196
+ await conn.run_sync(Base.metadata.create_all)
197
+
198
+ # Initialize admin interface
199
+ await admin.initialize()
200
+ yield
201
+
202
+ # Create and mount the app
203
+ app = FastAPI(lifespan=lifespan)
204
+ app.mount("/admin", admin.app)
205
+ ```
206
+
207
+ ### Enable Event Tracking
208
+
209
+ ```python
210
+ admin = CRUDAdmin(
211
+ session=session,
212
+ SECRET_KEY=SECRET_KEY,
213
+ track_events=True,
214
+ admin_db_url="postgresql+asyncpg://user:pass@localhost/admin_logs"
215
+ )
216
+
217
+ @asynccontextmanager
218
+ async def lifespan(app: FastAPI):
219
+ async with engine.begin() as conn:
220
+ await conn.run_sync(Base.metadata.create_all)
221
+ await admin.initialize() # Creates event tracking tables
222
+ yield
223
+ ```
224
+
225
+ ### Configure Security Features
226
+
227
+ ```python
228
+ admin = CRUDAdmin(
229
+ session=session,
230
+ SECRET_KEY=SECRET_KEY,
231
+ # Security settings
232
+ allowed_ips=["10.0.0.1"],
233
+ allowed_networks=["192.168.1.0/24"],
234
+ secure_cookies=True,
235
+ enforce_https=True,
236
+ # Session settings
237
+ max_sessions_per_user=5,
238
+ session_timeout_minutes=30
239
+ )
240
+
241
+ @asynccontextmanager
242
+ async def lifespan(app: FastAPI):
243
+ async with engine.begin() as conn:
244
+ await conn.run_sync(Base.metadata.create_all)
245
+ await admin.initialize() # Initializes security features
246
+ yield
247
+ ```
248
+
249
+ ## Current Limitations (coming soon)
250
+
251
+ - No file upload support yet
252
+ - No custom admin views (model-based only)
253
+ - No custom field widgets
254
+ - No SQLAlchemy relationship support
255
+ - No export functionality
256
+
257
+ ## Similar Projects
258
+
259
+ - **[Django Admin](https://docs.djangoproject.com/en/stable/ref/contrib/admin/)**: The inspiration for this project
260
+ - **[Flask-Admin](https://flask-admin.readthedocs.io/)**: Similar project for Flask
261
+ - **[Sqladmin](https://github.com/aminalaee/sqladmin)**: Another FastAPI admin interface
262
+
263
+ ## License
264
+
265
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
266
+
267
+ ## Contact
268
+
269
+ Igor Benav – [@igorbenav](https://x.com/igorbenav) – igormagalhaesr@gmail.com
270
+ [github.com/igorbenav](https://github.com/igorbenav/)
@@ -0,0 +1,208 @@
1
+ # CRUDAdmin
2
+
3
+ <p align="center">
4
+ <a href="https://igorbenav.github.io/crudadmin/">
5
+ <img src="docs/assets/CRUDAdmin.png" alt="CRUDAdmin logo" width="45%" height="auto">
6
+ </a>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <i>Modern admin interface for FastAPI with built-in authentication, event tracking, and security features</i>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://pypi.org/project/crudadmin">
15
+ <img src="https://img.shields.io/pypi/v/crudadmin?color=%2334D058&label=pypi%20package" alt="Package version"/>
16
+ </a>
17
+ <a href="https://pypi.org/project/crudadmin">
18
+ <img src="https://img.shields.io/pypi/pyversions/crudadmin.svg?color=%2334D058" alt="Supported Python versions"/>
19
+ </a>
20
+ </p>
21
+
22
+ <hr>
23
+ <p align="justify">
24
+ <b>CRUDAdmin</b> is a robust admin interface generator for <b>FastAPI</b> applications, offering secure authentication, comprehensive event tracking, and essential monitoring features. Built on top of FastCRUD and SQLAlchemy, it helps you create production-ready admin panels with minimal configuration.
25
+ </p>
26
+
27
+ <p><b>Documentation</b>: <a href="https://igorbenav.github.io/crudadmin/">https://igorbenav.github.io/crudadmin/</a></p>
28
+
29
+ <hr>
30
+
31
+ ## Features
32
+
33
+ - 🔒 **Session-based Authentication**: Secure session management with inactivity timeouts and concurrent session limits
34
+ - 🛡️ **Built-in Security**: IP restrictions, HTTPS enforcement, and secure cookie handling
35
+ - 📝 **Event Tracking**: Comprehensive audit logs for all admin actions with user attribution
36
+ - 🏥 **Health Monitoring**: Real-time system status dashboard with key metrics
37
+ - 📊 **Auto-generated Interface**: Creates admin UI directly from your SQLAlchemy models
38
+ - 🔍 **Smart Filtering**: Type-aware field filtering and efficient search
39
+ - 🌗 **Modern UI**: Clean interface with dark/light theme support
40
+
41
+ ## Requirements
42
+
43
+ Before installing CRUDAdmin, ensure you have:
44
+
45
+ - **FastAPI**: Latest version for the web framework
46
+ - **SQLAlchemy**: Version 2.0+ for database operations
47
+ - **Pydantic**: Version 2.0+ for data validation
48
+
49
+ ## Installing
50
+
51
+ ```sh
52
+ pip install crudadmin
53
+ ```
54
+
55
+ Or using poetry:
56
+
57
+ ```sh
58
+ poetry add crudadmin
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ CRUDAdmin offers a straightforward way to create admin interfaces. Here's how to get started:
64
+
65
+ ### Define Your Models and Schemas
66
+
67
+ **models.py**
68
+ ```python
69
+ from sqlalchemy.orm import DeclarativeBase
70
+ from sqlalchemy import Column, Integer, String
71
+
72
+ class Base(DeclarativeBase):
73
+ pass
74
+
75
+ class User(Base):
76
+ __tablename__ = "users"
77
+ id = Column(Integer, primary_key=True)
78
+ username = Column(String, unique=True)
79
+ email = Column(String)
80
+ role = Column(String)
81
+ ```
82
+
83
+ **schemas.py**
84
+ ```python
85
+ from pydantic import BaseModel, EmailStr
86
+
87
+ class UserCreate(BaseModel):
88
+ username: str
89
+ email: EmailStr
90
+ role: str = "user"
91
+
92
+ class UserUpdate(BaseModel):
93
+ email: EmailStr | None = None
94
+ role: str | None = None
95
+ ```
96
+
97
+ ### Set Up the Admin Interface
98
+
99
+ **main.py**
100
+ ```python
101
+ from contextlib import asynccontextmanager
102
+ from fastapi import FastAPI
103
+ from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
104
+ from crudadmin import CRUDAdmin
105
+ import os
106
+
107
+ # Database setup
108
+ engine = create_async_engine("sqlite+aiosqlite:///app.db")
109
+ session = AsyncSession(engine)
110
+
111
+ # Create admin interface
112
+ admin = CRUDAdmin(
113
+ session=session,
114
+ SECRET_KEY=os.environ.get("ADMIN_SECRET_KEY"),
115
+ initial_admin={
116
+ "username": "admin",
117
+ "password": "secure_password123"
118
+ }
119
+ )
120
+
121
+ # Add models to admin
122
+ admin.add_view(
123
+ model=User,
124
+ create_schema=UserCreate,
125
+ update_schema=UserUpdate,
126
+ allowed_actions={"view", "create", "update"}
127
+ )
128
+
129
+ # Setup FastAPI with proper initialization
130
+ @asynccontextmanager
131
+ async def lifespan(app: FastAPI):
132
+ # Initialize database tables
133
+ async with engine.begin() as conn:
134
+ await conn.run_sync(Base.metadata.create_all)
135
+
136
+ # Initialize admin interface
137
+ await admin.initialize()
138
+ yield
139
+
140
+ # Create and mount the app
141
+ app = FastAPI(lifespan=lifespan)
142
+ app.mount("/admin", admin.app)
143
+ ```
144
+
145
+ ### Enable Event Tracking
146
+
147
+ ```python
148
+ admin = CRUDAdmin(
149
+ session=session,
150
+ SECRET_KEY=SECRET_KEY,
151
+ track_events=True,
152
+ admin_db_url="postgresql+asyncpg://user:pass@localhost/admin_logs"
153
+ )
154
+
155
+ @asynccontextmanager
156
+ async def lifespan(app: FastAPI):
157
+ async with engine.begin() as conn:
158
+ await conn.run_sync(Base.metadata.create_all)
159
+ await admin.initialize() # Creates event tracking tables
160
+ yield
161
+ ```
162
+
163
+ ### Configure Security Features
164
+
165
+ ```python
166
+ admin = CRUDAdmin(
167
+ session=session,
168
+ SECRET_KEY=SECRET_KEY,
169
+ # Security settings
170
+ allowed_ips=["10.0.0.1"],
171
+ allowed_networks=["192.168.1.0/24"],
172
+ secure_cookies=True,
173
+ enforce_https=True,
174
+ # Session settings
175
+ max_sessions_per_user=5,
176
+ session_timeout_minutes=30
177
+ )
178
+
179
+ @asynccontextmanager
180
+ async def lifespan(app: FastAPI):
181
+ async with engine.begin() as conn:
182
+ await conn.run_sync(Base.metadata.create_all)
183
+ await admin.initialize() # Initializes security features
184
+ yield
185
+ ```
186
+
187
+ ## Current Limitations (coming soon)
188
+
189
+ - No file upload support yet
190
+ - No custom admin views (model-based only)
191
+ - No custom field widgets
192
+ - No SQLAlchemy relationship support
193
+ - No export functionality
194
+
195
+ ## Similar Projects
196
+
197
+ - **[Django Admin](https://docs.djangoproject.com/en/stable/ref/contrib/admin/)**: The inspiration for this project
198
+ - **[Flask-Admin](https://flask-admin.readthedocs.io/)**: Similar project for Flask
199
+ - **[Sqladmin](https://github.com/aminalaee/sqladmin)**: Another FastAPI admin interface
200
+
201
+ ## License
202
+
203
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
204
+
205
+ ## Contact
206
+
207
+ Igor Benav – [@igorbenav](https://x.com/igorbenav) – igormagalhaesr@gmail.com
208
+ [github.com/igorbenav](https://github.com/igorbenav/)
@@ -0,0 +1,3 @@
1
+ from .admin_interface.crud_admin import CRUDAdmin
2
+
3
+ __all__ = ["CRUDAdmin"]
File without changes