astris-python 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.
- astris_python-0.1.0/LICENSE +21 -0
- astris_python-0.1.0/PKG-INFO +241 -0
- astris_python-0.1.0/README.md +195 -0
- astris_python-0.1.0/pyproject.toml +74 -0
- astris_python-0.1.0/pyproject.toml.orig +73 -0
- astris_python-0.1.0/src/astris/__init__.py +7 -0
- astris_python-0.1.0/src/astris/assets/favicon.ico +0 -0
- astris_python-0.1.0/src/astris/auth/__init__.py +29 -0
- astris_python-0.1.0/src/astris/auth/installer.py +512 -0
- astris_python-0.1.0/src/astris/auth/session.py +241 -0
- astris_python-0.1.0/src/astris/cli.py +421 -0
- astris_python-0.1.0/src/astris/config.py +50 -0
- astris_python-0.1.0/src/astris/database/__init__.py +28 -0
- astris_python-0.1.0/src/astris/database/migrations.py +259 -0
- astris_python-0.1.0/src/astris/database/session.py +108 -0
- astris_python-0.1.0/src/astris/http/__init__.py +25 -0
- astris_python-0.1.0/src/astris/http/static.py +31 -0
- astris_python-0.1.0/src/astris/inertia/__init__.py +8 -0
- astris_python-0.1.0/src/astris/inertia/exceptions.py +133 -0
- astris_python-0.1.0/src/astris/inertia/response.py +99 -0
- astris_python-0.1.0/src/astris/inertia/shared.py +176 -0
- astris_python-0.1.0/src/astris/inertia/vite.py +89 -0
- astris_python-0.1.0/src/astris/installer.py +595 -0
- astris_python-0.1.0/src/astris/kernel.py +230 -0
- astris_python-0.1.0/src/astris/py.typed +0 -0
- astris_python-0.1.0/src/astris/routing/__init__.py +31 -0
- astris_python-0.1.0/src/astris/routing/router.py +38 -0
- astris_python-0.1.0/src/astris/security/__init__.py +3 -0
- astris_python-0.1.0/src/astris/security/csrf.py +100 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Felix Gomez
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: astris-python
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The modern full-stack web framework for Python. Everything you need to go from idea to orbit; for developers who want to build and ship at escape velocity.
|
|
5
|
+
Author: Felix Gomez
|
|
6
|
+
Author-email: Felix Gomez <felix@felixgomez.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: AsyncIO
|
|
12
|
+
Classifier: Framework :: FastAPI
|
|
13
|
+
Classifier: Framework :: Pydantic
|
|
14
|
+
Classifier: Framework :: Pydantic :: 2
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Information Technology
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Topic :: Internet
|
|
27
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
28
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
29
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
30
|
+
Classifier: Topic :: Software Development
|
|
31
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
32
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
34
|
+
Classifier: Typing :: Typed
|
|
35
|
+
Requires-Dist: alembic>=1.19.1
|
|
36
|
+
Requires-Dist: fastapi>=0.141.1
|
|
37
|
+
Requires-Dist: itsdangerous>=2.2.0
|
|
38
|
+
Requires-Dist: pwdlib[argon2]>=0.3.1
|
|
39
|
+
Requires-Dist: pydantic>=2.13.4
|
|
40
|
+
Requires-Dist: pydantic-settings>=2.15.0
|
|
41
|
+
Requires-Dist: sqlmodel>=0.0.39
|
|
42
|
+
Requires-Dist: typer>=0.27.1
|
|
43
|
+
Requires-Dist: uvicorn[standard]>=0.52.4
|
|
44
|
+
Requires-Python: >=3.11
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
<p align="center" style="padding: 20px 0 10px 0;">
|
|
48
|
+
<a href="https://github.com/TheFelixGomez/astris">
|
|
49
|
+
<img src="https://raw.githubusercontent.com/TheFelixGomez/astris/main/.github/assets/astris-logo-name.png" alt="Astris" width="380">
|
|
50
|
+
</a>
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<strong>The modern full-stack web framework for Python.</strong><br>
|
|
55
|
+
Full-stack simplicity with modern Python performance.
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<a href="https://pypi.org/project/astris-python/"><img src="https://img.shields.io/pypi/v/astris-python.svg" alt="PyPI version"></a>
|
|
60
|
+
<a href="https://pypi.org/project/astris-python/"><img src="https://img.shields.io/pypi/pyversions/astris-python.svg" alt="Python Versions"></a>
|
|
61
|
+
<a href="https://github.com/TheFelixGomez/astris/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
> ⚠️ **Early Alpha**: Astris is currently in active alpha development. APIs and features may undergo breaking changes until production-ready status is confirmed. Feedback, bug reports, and ideas are welcome!
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## What is Astris?
|
|
69
|
+
|
|
70
|
+
**Astris** bridges the gap between the rapid, joyful developer experience of classic full-stack frameworks (like Laravel and Rails) and the raw performance, modern typing, and async concurrency of **FastAPI** and **Python 3.11+**.
|
|
71
|
+
|
|
72
|
+
By combining **FastAPI**, **Inertia.js**, **Vue 3**, **Tailwind CSS v4**, and **SQLModel**, Astris lets you build rich, dynamic single-page applications without the overhead of maintaining separate API layers or complex state synchronization.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🌟 Key Features
|
|
77
|
+
|
|
78
|
+
* **⚡ Lightning-Fast Core**: ASGI performance powered by FastAPI and Uvicorn with auto-generated OpenAPI & Swagger documentation.
|
|
79
|
+
* **🧩 Modern Monolith with Inertia.js**: Render Vue 3 components directly from FastAPI controllers with full server-side state hydration and zero REST boilerplate.
|
|
80
|
+
* **🛡️ Production-Ready Authentication**: Cryptographically signed cookie sessions, OWASP-standard **Argon2id** password hashing (`pwdlib`), and full-stack auth starter kit.
|
|
81
|
+
* **🗄️ SQLModel & Alembic Database Engine**: Unified declarative models, DTOs, and automatic schema migrations out-of-the-box.
|
|
82
|
+
* **⚙️ Type-Safe Centralized Configuration**: Powered by `pydantic-settings` for `.env` management, type casting, and fail-fast startup validation.
|
|
83
|
+
* **🪐 Orbit CLI**: An artisan developer CLI for scaffolding modules, generating migrations, and serving full-stack applications with hot-reloading.
|
|
84
|
+
* **🎨 Tailwind CSS v4 Pre-configured**: Instant zero-config styling powered by `@tailwindcss/vite`.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🚀 Quickstart
|
|
89
|
+
|
|
90
|
+
Create a new full-stack Astris application in seconds using `uvx` (or `pipx`):
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# 1. Create a new project
|
|
94
|
+
uvx --from astris-python astris new my_app
|
|
95
|
+
|
|
96
|
+
# Or install globally as a CLI tool:
|
|
97
|
+
# uv tool install astris-python
|
|
98
|
+
# astris new my_app
|
|
99
|
+
|
|
100
|
+
# 2. Enter directory and install frontend dependencies
|
|
101
|
+
cd my_app
|
|
102
|
+
npm install
|
|
103
|
+
|
|
104
|
+
# 3. Start full-stack development server (FastAPI + Vite HMR)
|
|
105
|
+
uv run orbit serve
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Open **`http://localhost:8000`** in your browser. Your full-stack app with authentication, Inertia.js, and SQLite is live!
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 💡 How It Feels
|
|
113
|
+
|
|
114
|
+
### 1. Controllers & Inertia Rendering
|
|
115
|
+
Write clean, expressive controllers that return frontend views or JSON seamlessly:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from astris.auth import AuthUser, auth_required
|
|
119
|
+
from astris.inertia import InertiaResponse
|
|
120
|
+
from astris.routing import Controller
|
|
121
|
+
|
|
122
|
+
controller = Controller(prefix="/dashboard", dependencies=[auth_required])
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@controller.get("/")
|
|
126
|
+
async def dashboard_page(request: Request, user: AuthUser) -> InertiaResponse:
|
|
127
|
+
# Props are passed directly to Vue 3 with $page.props
|
|
128
|
+
return InertiaResponse(request, "Dashboard", props={"username": user["name"]})
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 2. Unified SQLModel Models
|
|
132
|
+
Define database tables and validation schemas in a single declarative model:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from astris.database import Field, SQLModel
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class ArticleBase(SQLModel):
|
|
139
|
+
title: str = Field(index=True)
|
|
140
|
+
content: str
|
|
141
|
+
is_published: bool = Field(default=False)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class Article(ArticleBase, table=True):
|
|
145
|
+
id: int | None = Field(default=None, primary_key=True)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class ArticleCreate(ArticleBase):
|
|
149
|
+
pass
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 3. Frontend Views (Vue 3 + Inertia)
|
|
153
|
+
Build dynamic reactive pages without configuring client-side routers:
|
|
154
|
+
|
|
155
|
+
```vue
|
|
156
|
+
<script setup lang="ts">
|
|
157
|
+
import { Head, Link } from '@inertiajs/vue3'
|
|
158
|
+
|
|
159
|
+
defineProps<{
|
|
160
|
+
username: string
|
|
161
|
+
}>()
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<template>
|
|
165
|
+
<Head title="Dashboard" />
|
|
166
|
+
<div class="min-h-screen bg-slate-950 text-slate-100 p-8">
|
|
167
|
+
<h1 class="text-3xl font-bold">Welcome back, {{ username }}!</h1>
|
|
168
|
+
</div>
|
|
169
|
+
</template>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 🪐 The Orbit CLI
|
|
175
|
+
|
|
176
|
+
Astris comes equipped with **Orbit**, a developer toolkit for rapid development:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Start FastAPI backend + Vite frontend concurrently
|
|
180
|
+
uv run orbit serve
|
|
181
|
+
|
|
182
|
+
# Scaffold a new domain module (controller, service, model)
|
|
183
|
+
uv run orbit make:module billing
|
|
184
|
+
|
|
185
|
+
# Create and apply database migrations
|
|
186
|
+
uv run orbit make:migration "create_billing_table"
|
|
187
|
+
uv run orbit migrate
|
|
188
|
+
|
|
189
|
+
# Generate encryption keys
|
|
190
|
+
uv run orbit key:generate
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 📂 Project Architecture
|
|
196
|
+
|
|
197
|
+
Astris structures projects with a modular, **Domain-Driven Design** that grows gracefully:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
my_app/
|
|
201
|
+
├── app/
|
|
202
|
+
│ ├── core/
|
|
203
|
+
│ │ └── config.py # Centralized Pydantic settings & .env loading
|
|
204
|
+
│ └── modules/
|
|
205
|
+
│ ├── auth/ # Authentication domain (controller, service, model)
|
|
206
|
+
│ └── welcome/ # Welcome domain
|
|
207
|
+
├── database/
|
|
208
|
+
│ └── migrations/ # Alembic database migration versions
|
|
209
|
+
├── resources/
|
|
210
|
+
│ ├── css/
|
|
211
|
+
│ │ └── app.css # Tailwind CSS v4 styling
|
|
212
|
+
│ ├── js/
|
|
213
|
+
│ │ ├── Pages/ # Inertia Vue 3 views & components
|
|
214
|
+
│ │ └── app.ts # Vue entrypoint
|
|
215
|
+
│ └── views/
|
|
216
|
+
│ └── root.html # HTML shell template
|
|
217
|
+
├── .env # App configuration & APP_KEY
|
|
218
|
+
└── pyproject.toml # Python dependencies
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 🙏 Acknowledgments
|
|
224
|
+
|
|
225
|
+
Astris is built upon the work of giants. Huge gratitude to the incredible open-source projects and creators that make Astris possible:
|
|
226
|
+
|
|
227
|
+
* **[FastAPI](https://fastapi.tiangolo.com/) & [SQLModel](https://sqlmodel.tiangolo.com/)** by [Tiangolo](https://github.com/tiangolo) - for setting the standard in modern Python type safety, speed, and ergonomics.
|
|
228
|
+
* **[Inertia.js](https://inertiajs.com/)** by [Jonathan Reinink](https://github.com/reinink) - for the modern monolith architecture that bridges backend controllers and frontend SPAs without API boilerplate.
|
|
229
|
+
* **[Vue.js](https://vuejs.org/)** by [Evan You](https://github.com/yyx990803) - for the approachable and performant frontend component framework.
|
|
230
|
+
* **[Starlette](https://www.starlette.io/) & [Uvicorn](https://www.uvicorn.org/)** by [Encode](https://www.encode.io/) - for the lightning-fast ASGI toolkit and web server engine.
|
|
231
|
+
* **[Pydantic](https://docs.pydantic.dev/)** by [Samuel Colvin](https://github.com/samuelcolvin) & team - for rock-solid runtime data validation and centralized settings.
|
|
232
|
+
* **[Tailwind CSS](https://tailwindcss.com/)** by [Tailwind Labs](https://github.com/tailwindlabs) - for zero-config utility-first styling.
|
|
233
|
+
* **[Laravel](https://laravel.com/)** by [Taylor Otwell](https://github.com/taylorotwell) - for inspiring developer-first framework craftsmanship.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 📄 License
|
|
238
|
+
|
|
239
|
+
The Astris framework is open source and licensed under the terms of the MIT license.
|
|
240
|
+
|
|
241
|
+
Built with ❤️ by [Felix Gomez](https://github.com/TheFelixGomez).
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<p align="center" style="padding: 20px 0 10px 0;">
|
|
2
|
+
<a href="https://github.com/TheFelixGomez/astris">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/TheFelixGomez/astris/main/.github/assets/astris-logo-name.png" alt="Astris" width="380">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>The modern full-stack web framework for Python.</strong><br>
|
|
9
|
+
Full-stack simplicity with modern Python performance.
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://pypi.org/project/astris-python/"><img src="https://img.shields.io/pypi/v/astris-python.svg" alt="PyPI version"></a>
|
|
14
|
+
<a href="https://pypi.org/project/astris-python/"><img src="https://img.shields.io/pypi/pyversions/astris-python.svg" alt="Python Versions"></a>
|
|
15
|
+
<a href="https://github.com/TheFelixGomez/astris/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
> ⚠️ **Early Alpha**: Astris is currently in active alpha development. APIs and features may undergo breaking changes until production-ready status is confirmed. Feedback, bug reports, and ideas are welcome!
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## What is Astris?
|
|
23
|
+
|
|
24
|
+
**Astris** bridges the gap between the rapid, joyful developer experience of classic full-stack frameworks (like Laravel and Rails) and the raw performance, modern typing, and async concurrency of **FastAPI** and **Python 3.11+**.
|
|
25
|
+
|
|
26
|
+
By combining **FastAPI**, **Inertia.js**, **Vue 3**, **Tailwind CSS v4**, and **SQLModel**, Astris lets you build rich, dynamic single-page applications without the overhead of maintaining separate API layers or complex state synchronization.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🌟 Key Features
|
|
31
|
+
|
|
32
|
+
* **⚡ Lightning-Fast Core**: ASGI performance powered by FastAPI and Uvicorn with auto-generated OpenAPI & Swagger documentation.
|
|
33
|
+
* **🧩 Modern Monolith with Inertia.js**: Render Vue 3 components directly from FastAPI controllers with full server-side state hydration and zero REST boilerplate.
|
|
34
|
+
* **🛡️ Production-Ready Authentication**: Cryptographically signed cookie sessions, OWASP-standard **Argon2id** password hashing (`pwdlib`), and full-stack auth starter kit.
|
|
35
|
+
* **🗄️ SQLModel & Alembic Database Engine**: Unified declarative models, DTOs, and automatic schema migrations out-of-the-box.
|
|
36
|
+
* **⚙️ Type-Safe Centralized Configuration**: Powered by `pydantic-settings` for `.env` management, type casting, and fail-fast startup validation.
|
|
37
|
+
* **🪐 Orbit CLI**: An artisan developer CLI for scaffolding modules, generating migrations, and serving full-stack applications with hot-reloading.
|
|
38
|
+
* **🎨 Tailwind CSS v4 Pre-configured**: Instant zero-config styling powered by `@tailwindcss/vite`.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🚀 Quickstart
|
|
43
|
+
|
|
44
|
+
Create a new full-stack Astris application in seconds using `uvx` (or `pipx`):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 1. Create a new project
|
|
48
|
+
uvx --from astris-python astris new my_app
|
|
49
|
+
|
|
50
|
+
# Or install globally as a CLI tool:
|
|
51
|
+
# uv tool install astris-python
|
|
52
|
+
# astris new my_app
|
|
53
|
+
|
|
54
|
+
# 2. Enter directory and install frontend dependencies
|
|
55
|
+
cd my_app
|
|
56
|
+
npm install
|
|
57
|
+
|
|
58
|
+
# 3. Start full-stack development server (FastAPI + Vite HMR)
|
|
59
|
+
uv run orbit serve
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Open **`http://localhost:8000`** in your browser. Your full-stack app with authentication, Inertia.js, and SQLite is live!
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 💡 How It Feels
|
|
67
|
+
|
|
68
|
+
### 1. Controllers & Inertia Rendering
|
|
69
|
+
Write clean, expressive controllers that return frontend views or JSON seamlessly:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from astris.auth import AuthUser, auth_required
|
|
73
|
+
from astris.inertia import InertiaResponse
|
|
74
|
+
from astris.routing import Controller
|
|
75
|
+
|
|
76
|
+
controller = Controller(prefix="/dashboard", dependencies=[auth_required])
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@controller.get("/")
|
|
80
|
+
async def dashboard_page(request: Request, user: AuthUser) -> InertiaResponse:
|
|
81
|
+
# Props are passed directly to Vue 3 with $page.props
|
|
82
|
+
return InertiaResponse(request, "Dashboard", props={"username": user["name"]})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Unified SQLModel Models
|
|
86
|
+
Define database tables and validation schemas in a single declarative model:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from astris.database import Field, SQLModel
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ArticleBase(SQLModel):
|
|
93
|
+
title: str = Field(index=True)
|
|
94
|
+
content: str
|
|
95
|
+
is_published: bool = Field(default=False)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class Article(ArticleBase, table=True):
|
|
99
|
+
id: int | None = Field(default=None, primary_key=True)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class ArticleCreate(ArticleBase):
|
|
103
|
+
pass
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. Frontend Views (Vue 3 + Inertia)
|
|
107
|
+
Build dynamic reactive pages without configuring client-side routers:
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<script setup lang="ts">
|
|
111
|
+
import { Head, Link } from '@inertiajs/vue3'
|
|
112
|
+
|
|
113
|
+
defineProps<{
|
|
114
|
+
username: string
|
|
115
|
+
}>()
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<template>
|
|
119
|
+
<Head title="Dashboard" />
|
|
120
|
+
<div class="min-h-screen bg-slate-950 text-slate-100 p-8">
|
|
121
|
+
<h1 class="text-3xl font-bold">Welcome back, {{ username }}!</h1>
|
|
122
|
+
</div>
|
|
123
|
+
</template>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🪐 The Orbit CLI
|
|
129
|
+
|
|
130
|
+
Astris comes equipped with **Orbit**, a developer toolkit for rapid development:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Start FastAPI backend + Vite frontend concurrently
|
|
134
|
+
uv run orbit serve
|
|
135
|
+
|
|
136
|
+
# Scaffold a new domain module (controller, service, model)
|
|
137
|
+
uv run orbit make:module billing
|
|
138
|
+
|
|
139
|
+
# Create and apply database migrations
|
|
140
|
+
uv run orbit make:migration "create_billing_table"
|
|
141
|
+
uv run orbit migrate
|
|
142
|
+
|
|
143
|
+
# Generate encryption keys
|
|
144
|
+
uv run orbit key:generate
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 📂 Project Architecture
|
|
150
|
+
|
|
151
|
+
Astris structures projects with a modular, **Domain-Driven Design** that grows gracefully:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
my_app/
|
|
155
|
+
├── app/
|
|
156
|
+
│ ├── core/
|
|
157
|
+
│ │ └── config.py # Centralized Pydantic settings & .env loading
|
|
158
|
+
│ └── modules/
|
|
159
|
+
│ ├── auth/ # Authentication domain (controller, service, model)
|
|
160
|
+
│ └── welcome/ # Welcome domain
|
|
161
|
+
├── database/
|
|
162
|
+
│ └── migrations/ # Alembic database migration versions
|
|
163
|
+
├── resources/
|
|
164
|
+
│ ├── css/
|
|
165
|
+
│ │ └── app.css # Tailwind CSS v4 styling
|
|
166
|
+
│ ├── js/
|
|
167
|
+
│ │ ├── Pages/ # Inertia Vue 3 views & components
|
|
168
|
+
│ │ └── app.ts # Vue entrypoint
|
|
169
|
+
│ └── views/
|
|
170
|
+
│ └── root.html # HTML shell template
|
|
171
|
+
├── .env # App configuration & APP_KEY
|
|
172
|
+
└── pyproject.toml # Python dependencies
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 🙏 Acknowledgments
|
|
178
|
+
|
|
179
|
+
Astris is built upon the work of giants. Huge gratitude to the incredible open-source projects and creators that make Astris possible:
|
|
180
|
+
|
|
181
|
+
* **[FastAPI](https://fastapi.tiangolo.com/) & [SQLModel](https://sqlmodel.tiangolo.com/)** by [Tiangolo](https://github.com/tiangolo) - for setting the standard in modern Python type safety, speed, and ergonomics.
|
|
182
|
+
* **[Inertia.js](https://inertiajs.com/)** by [Jonathan Reinink](https://github.com/reinink) - for the modern monolith architecture that bridges backend controllers and frontend SPAs without API boilerplate.
|
|
183
|
+
* **[Vue.js](https://vuejs.org/)** by [Evan You](https://github.com/yyx990803) - for the approachable and performant frontend component framework.
|
|
184
|
+
* **[Starlette](https://www.starlette.io/) & [Uvicorn](https://www.uvicorn.org/)** by [Encode](https://www.encode.io/) - for the lightning-fast ASGI toolkit and web server engine.
|
|
185
|
+
* **[Pydantic](https://docs.pydantic.dev/)** by [Samuel Colvin](https://github.com/samuelcolvin) & team - for rock-solid runtime data validation and centralized settings.
|
|
186
|
+
* **[Tailwind CSS](https://tailwindcss.com/)** by [Tailwind Labs](https://github.com/tailwindlabs) - for zero-config utility-first styling.
|
|
187
|
+
* **[Laravel](https://laravel.com/)** by [Taylor Otwell](https://github.com/taylorotwell) - for inspiring developer-first framework craftsmanship.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 📄 License
|
|
192
|
+
|
|
193
|
+
The Astris framework is open source and licensed under the terms of the MIT license.
|
|
194
|
+
|
|
195
|
+
Built with ❤️ by [Felix Gomez](https://github.com/TheFelixGomez).
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "astris-python"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "The modern full-stack web framework for Python. Everything you need to go from idea to orbit; for developers who want to build and ship at escape velocity."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 3 - Alpha",
|
|
11
|
+
"Environment :: Web Environment",
|
|
12
|
+
"Framework :: AsyncIO",
|
|
13
|
+
"Framework :: FastAPI",
|
|
14
|
+
"Framework :: Pydantic",
|
|
15
|
+
"Framework :: Pydantic :: 2",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Intended Audience :: Information Technology",
|
|
18
|
+
"Intended Audience :: System Administrators",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
27
|
+
"Topic :: Internet",
|
|
28
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
29
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
30
|
+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
31
|
+
"Topic :: Software Development",
|
|
32
|
+
"Topic :: Software Development :: Libraries",
|
|
33
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"alembic>=1.19.1",
|
|
39
|
+
"fastapi>=0.141.1",
|
|
40
|
+
"itsdangerous>=2.2.0",
|
|
41
|
+
"pwdlib[argon2]>=0.3.1",
|
|
42
|
+
"pydantic>=2.13.4",
|
|
43
|
+
"pydantic-settings>=2.15.0",
|
|
44
|
+
"sqlmodel>=0.0.39",
|
|
45
|
+
"typer>=0.27.1",
|
|
46
|
+
"uvicorn[standard]>=0.52.4",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[[project.authors]]
|
|
50
|
+
name = "Felix Gomez"
|
|
51
|
+
email = "felix@felixgomez.com"
|
|
52
|
+
|
|
53
|
+
[project.scripts]
|
|
54
|
+
astris = "astris.installer:installer_cli"
|
|
55
|
+
astris-python = "astris.installer:installer_cli"
|
|
56
|
+
orbit = "astris.cli:orbit_cli"
|
|
57
|
+
|
|
58
|
+
[build-system]
|
|
59
|
+
requires = ["uv_build>=0.12.5,<0.13.0"]
|
|
60
|
+
build-backend = "uv_build"
|
|
61
|
+
|
|
62
|
+
[tool.uv.build-backend]
|
|
63
|
+
module-name = "astris"
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint.isort]
|
|
66
|
+
combine-as-imports = true
|
|
67
|
+
|
|
68
|
+
[dependency-groups]
|
|
69
|
+
dev = [
|
|
70
|
+
"pytest>=9.1.1",
|
|
71
|
+
"pytest-cov>=7.1.0",
|
|
72
|
+
"ruff>=0.16.4",
|
|
73
|
+
"ty>=0.0.74",
|
|
74
|
+
]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "astris-python"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "The modern full-stack web framework for Python. Everything you need to go from idea to orbit; for developers who want to build and ship at escape velocity."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Felix Gomez", email = "felix@felixgomez.com" }
|
|
8
|
+
]
|
|
9
|
+
license = "MIT"
|
|
10
|
+
license-files = ["LICENSE"]
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Environment :: Web Environment",
|
|
15
|
+
"Framework :: AsyncIO",
|
|
16
|
+
"Framework :: FastAPI",
|
|
17
|
+
"Framework :: Pydantic",
|
|
18
|
+
"Framework :: Pydantic :: 2",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: Information Technology",
|
|
21
|
+
"Intended Audience :: System Administrators",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Programming Language :: Python :: 3.14",
|
|
30
|
+
"Topic :: Internet",
|
|
31
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
32
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
33
|
+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
34
|
+
"Topic :: Software Development",
|
|
35
|
+
"Topic :: Software Development :: Libraries",
|
|
36
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
37
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
38
|
+
"Typing :: Typed",
|
|
39
|
+
]
|
|
40
|
+
dependencies = [
|
|
41
|
+
"alembic>=1.19.1",
|
|
42
|
+
"fastapi>=0.141.1",
|
|
43
|
+
"itsdangerous>=2.2.0",
|
|
44
|
+
"pwdlib[argon2]>=0.3.1",
|
|
45
|
+
"pydantic>=2.13.4",
|
|
46
|
+
"pydantic-settings>=2.15.0",
|
|
47
|
+
"sqlmodel>=0.0.39",
|
|
48
|
+
"typer>=0.27.1",
|
|
49
|
+
"uvicorn[standard]>=0.52.4",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.scripts]
|
|
53
|
+
astris = "astris.installer:installer_cli"
|
|
54
|
+
astris-python = "astris.installer:installer_cli"
|
|
55
|
+
orbit = "astris.cli:orbit_cli"
|
|
56
|
+
|
|
57
|
+
[build-system]
|
|
58
|
+
requires = ["uv_build>=0.12.5,<0.13.0"]
|
|
59
|
+
build-backend = "uv_build"
|
|
60
|
+
|
|
61
|
+
[tool.uv.build-backend]
|
|
62
|
+
module-name = "astris"
|
|
63
|
+
|
|
64
|
+
[dependency-groups]
|
|
65
|
+
dev = [
|
|
66
|
+
"pytest>=9.1.1",
|
|
67
|
+
"pytest-cov>=7.1.0",
|
|
68
|
+
"ruff>=0.16.4",
|
|
69
|
+
"ty>=0.0.74",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[tool.ruff.lint.isort]
|
|
73
|
+
combine-as-imports = true
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from astris.auth.session import (
|
|
2
|
+
AuthUser,
|
|
3
|
+
AuthUserId,
|
|
4
|
+
auth_required,
|
|
5
|
+
get_auth_user,
|
|
6
|
+
get_user_id,
|
|
7
|
+
guest_required,
|
|
8
|
+
hash_password,
|
|
9
|
+
is_authenticated,
|
|
10
|
+
login_user,
|
|
11
|
+
logout_user,
|
|
12
|
+
verify_and_update_password,
|
|
13
|
+
verify_password,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"AuthUser",
|
|
18
|
+
"AuthUserId",
|
|
19
|
+
"auth_required",
|
|
20
|
+
"get_auth_user",
|
|
21
|
+
"get_user_id",
|
|
22
|
+
"guest_required",
|
|
23
|
+
"hash_password",
|
|
24
|
+
"is_authenticated",
|
|
25
|
+
"login_user",
|
|
26
|
+
"logout_user",
|
|
27
|
+
"verify_and_update_password",
|
|
28
|
+
"verify_password",
|
|
29
|
+
]
|