Skip to content

Commit da2ac2e

Browse files
authored
Merge pull request #173 from lbedner/service-documentation
Service Documentation
2 parents d4641ea + f1bd155 commit da2ac2e

15 files changed

Lines changed: 974 additions & 46 deletions

File tree

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img src="docs/images/aegis-manifesto.png" alt="Aegis Stack" width="400">
44
</picture>
55

6-
**Build production-ready Python applications with your chosen components.**
6+
**Build production-ready Python applications with your chosen components and services.**
77

88
[![CI](https://github.com/lbedner/aegis-stack/workflows/CI/badge.svg)](https://github.com/lbedner/aegis-stack/actions/workflows/ci.yml)
99
[![Documentation](https://github.com/lbedner/aegis-stack/workflows/Deploy%20Documentation/badge.svg)](https://github.com/lbedner/aegis-stack/actions/workflows/docs.yml)
@@ -17,11 +17,14 @@ Aegis Stack is a CLI-driven framework for creating custom Python applications. S
1717
# Run instantly without installation
1818
uvx aegis-stack init my-api
1919

20-
# Create with background processing
20+
# Create with user authentication
21+
uvx aegis-stack init user-app --services auth
22+
23+
# Create with background processing
2124
uvx aegis-stack init task-processor --components scheduler,worker
2225

2326
# Start building
24-
cd my-api && uv sync && cp .env.example .env && make run-local
27+
cd my-api && uv sync && cp .env.example .env && make server
2528
```
2629

2730
## Installation
@@ -45,8 +48,9 @@ pip install aegis-stack
4548
aegis init my-project
4649
```
4750

48-
## Available Components
51+
## Available Components & Services
4952

53+
### Infrastructure Components
5054
| Component | Purpose | Status |
5155
|-----------|---------|--------|
5256
| **Core** (FastAPI + Flet) | Web API + Frontend |**Always Included** |
@@ -55,6 +59,12 @@ aegis init my-project
5559
| **Worker** | Async task queues (arq + Redis) | 🧪 **Experimental** |
5660
| **Cache** | Redis caching and sessions | 🚧 **Coming Soon** |
5761

62+
### Business Services
63+
| Service | Purpose | Status |
64+
|---------|---------|--------|
65+
| **Auth** | User authentication & JWT |**Available** |
66+
| **AI** | OpenAI integration | 🚧 **Coming Soon** |
67+
5868
## See It In Action
5969

6070
### System Health Dashboard
@@ -72,7 +82,8 @@ Rich terminal output showing detailed component status, health metrics, and syst
7282
## Learn More
7383

7484
- **[📖 CLI Reference](docs/cli-reference.md)** - Complete command reference
75-
- **[🏗️ Components](docs/components/index.md)** - Deep dive into available components
85+
- **[🏗️ Components](docs/components/index.md)** - Deep dive into available components
86+
- **[🔧 Services](docs/services/index.md)** - Business services (auth, AI)
7687
- **[🧠 Philosophy](docs/philosophy.md)** - Architecture and design principles
7788

7889
## For The Veterans

aegis/commands/init.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ def init_command(
153153
interactive_project_selection()
154154
)
155155

156-
# Merge interactively selected services with any already specified
157-
if interactive_services:
158-
selected_services = list(set(selected_services + interactive_services))
159-
160156
# Resolve dependencies for interactively selected components
161157
if selected_components:
162158
# Clean component names for dependency resolution (remove engine info)
@@ -179,22 +175,8 @@ def init_command(
179175
if auto_added:
180176
typer.echo(f"\n📦 Auto-added dependencies: {', '.join(auto_added)}")
181177

182-
# Resolve service dependencies for interactively selected services
183-
if interactive_services:
184-
service_components, _ = ServiceResolver.resolve_service_dependencies(
185-
interactive_services
186-
)
187-
# Merge service-required components with existing components
188-
all_components = list(set(selected_components + service_components))
189-
if service_components:
190-
new_components = [
191-
c for c in service_components if c not in selected_components
192-
]
193-
if new_components:
194-
typer.echo(
195-
f"\n🔧 Auto-added components for services: {', '.join(new_components)}"
196-
)
197-
selected_components = all_components
178+
# Merge interactively selected services with any already selected services
179+
selected_services = list(set(selected_services + interactive_services))
198180

199181
# Create template generator with scheduler backend context
200182
template_gen = TemplateGenerator(
@@ -291,7 +273,7 @@ def init_command(
291273
typer.echo(f" cd {project_path.resolve()}")
292274
typer.echo(" uv sync")
293275
typer.echo(" cp .env.example .env")
294-
typer.echo(" make run-local")
276+
typer.echo(" make server")
295277

296278
except ImportError:
297279
typer.echo("❌ Error: cookiecutter not installed", err=True)

aegis/templates/cookiecutter-aegis-project/{{cookiecutter.project_slug}}/README.md.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This Aegis Stack project includes the following components:
6161
4. **Run the application:**
6262
{%- endif %}
6363
```bash
64-
make run-local
64+
make server
6565
```
6666

6767
The application will be available at `http://127.0.0.1:8000`.

aegis/templates/cookiecutter-aegis-project/{{cookiecutter.project_slug}}/app/cli/health.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async def get_health_data(
119119
raise ConnectionError(
120120
f"Cannot connect to API server at {base_url}. "
121121
"Make sure the application is running with "
122-
"'make run-local' or 'make run-dev'."
122+
"'make server' or 'make run-dev'."
123123
) from None
124124
except httpx.TimeoutException:
125125
raise TimeoutError(

aegis/templates/cookiecutter-aegis-project/{{cookiecutter.project_slug}}/clean-validation/README.md.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This Aegis Stack project includes the following components:
4848

4949
5. **Run the application:**
5050
```bash
51-
make run-local
51+
make server
5252
```
5353

5454
The application will be available at `http://127.0.0.1:8000`.

aegis/templates/cookiecutter-aegis-project/{{cookiecutter.project_slug}}/tests/api/test_scheduler_endpoints.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class TestSchedulerEndpoints:
145145

146146
if tasks:
147147
# Test detail endpoint with first available job
148-
job_id = tasks[0]["id"]
148+
job_id = tasks[0]["job_id"]
149149
url = f"/api/v1/scheduler/jobs/{job_id}"
150150
detail_response = await async_client.get(url)
151151

docs/cli-reference.md

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,34 @@ aegis init PROJECT_NAME [OPTIONS]
1818
**Options:**
1919

2020
- `--components, -c TEXT` - Comma-separated list of components (scheduler,worker,database,cache)
21+
- `--services, -s TEXT` - Comma-separated list of services (auth,payment,ai,analytics)
2122
- `--interactive / --no-interactive, -i / -ni` - Use interactive component selection (default: interactive)
2223
- `--force, -f` - Overwrite existing directory if it exists
23-
- `--output-dir, -o PATH` - Directory to create the project in (default: current directory)
24+
- `--output-dir, -o PATH` - Directory to create the project in (default: current directory)
2425
- `--yes, -y` - Skip confirmation prompt
2526

2627
**Examples:**
2728
```bash
2829
# Simple API project
2930
aegis init my-api
3031

31-
# Background processing system with scheduler
32+
# Background processing system with scheduler
3233
aegis init task-processor --components scheduler
3334

3435
# Background processing system with worker
3536
aegis init task-processor --components worker
3637

37-
# Full stack (future)
38-
aegis init webapp --components scheduler,worker,database,cache
38+
# User authentication system
39+
aegis init user-app --services auth
40+
41+
# Full business application
42+
aegis init business-app --services auth,payment --components worker
3943

4044
# Non-interactive with custom location
41-
aegis init my-app --components scheduler --no-interactive --output-dir /projects --yes
45+
aegis init my-app --services auth --no-interactive --output-dir /projects --yes
46+
47+
# Combined services and components (must include auth's required components)
48+
aegis init full-stack --services auth --components database,scheduler,worker
4249
```
4350

4451
**Available Components:**
@@ -47,9 +54,65 @@ aegis init my-app --components scheduler --no-interactive --output-dir /projects
4754
|-----------|--------|-------------|
4855
| `scheduler` | ✅ Available | APScheduler-based async task scheduling |
4956
| `worker` | ✅ Available | Pure arq worker with multiple queues for background processing |
50-
| `database` | 🚧 Coming Soon | SQLAlchemy + asyncpg for PostgreSQL |
57+
| `database` | ✅ Available | SQLite database with SQLModel ORM |
5158
| `cache` | 🚧 Coming Soon | Redis-based async caching |
5259

60+
**Available Services:**
61+
62+
| Service | Status | Description | Auto-Added Components |
63+
|---------|--------|-------------|---------------------|
64+
| `auth` | ✅ Available | User authentication and authorization with JWT tokens | database *(backend+frontend always included)* |
65+
| `ai` | 🚧 Coming Soon | OpenAI integration for AI features | worker *(backend+frontend always included)* |
66+
67+
**Service Auto-Resolution:**
68+
69+
When you select services, required components are automatically included:
70+
71+
```mermaid
72+
graph LR
73+
Service["--services auth"] --> Core["backend + frontend<br/>Always included"]
74+
Service --> Database["database component<br/>Auto-added by auth"]
75+
Service --> AuthFiles["Auth API routes + User models"]
76+
77+
style Service fill:#e8f5e8
78+
style Core fill:#e8f4fd
79+
style Database fill:#fff3e0
80+
style AuthFiles fill:#f1f8e9
81+
```
82+
83+
**Important CLI Behavior:**
84+
- `backend` and `frontend` components are always included in every project
85+
- **Interactive mode** (`aegis init project`): Services auto-add their required components
86+
- **Non-interactive mode** (`--components` specified): You must explicitly include all required components
87+
- Example: `--services auth` requires `--components database` (auth won't auto-add it)
88+
89+
## aegis services
90+
91+
List available services and their dependencies.
92+
93+
**Usage:**
94+
```bash
95+
aegis services
96+
```
97+
98+
**Example Output:**
99+
```
100+
🔧 AVAILABLE SERVICES
101+
========================================
102+
103+
🔐 Authentication Services
104+
----------------------------------------
105+
auth - User authentication and authorization with JWT tokens
106+
Requires components: backend, database
107+
108+
💰 Payment Services
109+
----------------------------------------
110+
No services available yet.
111+
112+
🤖 AI & Machine Learning Services
113+
----------------------------------------
114+
No services available yet.
115+
```
53116

54117
## aegis version
55118

@@ -118,7 +181,7 @@ cd my-project
118181
uv sync # Install dependencies and create virtual environment
119182
source .venv/bin/activate # Activate virtual environment (important!)
120183
cp .env.example .env # Configure environment
121-
make run-local # Start development server
184+
make server # Start development server
122185
make test # Run test suite
123186
make check # Run all quality checks
124187
```

docs/components/index.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Components Overview
22

3-
Components are the building blocks of your Aegis Stack application. Each component provides a specific capability like API serving, background tasks, or data persistence.
3+
Components are the **infrastructure building blocks** of your Aegis Stack application. Each component provides a specific capability like API serving, background tasks, or data persistence.
4+
5+
!!! info "Components vs Services"
6+
**Components** = Infrastructure capabilities (database, workers, scheduling)
7+
**Services** = Business functionality (auth, payments, AI integrations)
8+
9+
See **[Services Overview](../services/index.md)** for business-level features.
410

511
> 💡 **New to Aegis Stack?** See the [Philosophy Guide](../philosophy.md) for complete component design principles.
612
@@ -14,14 +20,20 @@ The interactive CLI guides you through component choices and explains integratio
1420
# Basic web application (FastAPI + Flet)
1521
aegis init my-project
1622

23+
# Add user authentication (auto-includes database)
24+
aegis init user-app --services auth
25+
1726
# Add background task scheduling
1827
aegis init scheduled-app --components scheduler
1928

2029
# Add job persistence + automatic backup job
2130
aegis init persistent-jobs --components scheduler,database
2231

2332
# Full async task processing
24-
aegis init task-processor --components worker,redis
33+
aegis init task-processor --components worker
34+
35+
# Business app with auth and background processing
36+
aegis init business-app --services auth --components worker,scheduler
2537
```
2638

2739
## Component Architecture

docs/index.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ pip install aegis-stack
1818
# Create a simple API
1919
aegis init my-api
2020

21-
# Create with background processing
21+
# Create with user authentication
22+
aegis init user-app --services auth
23+
24+
# Create with background processing
2225
aegis init task-processor --components scheduler,worker
2326

2427
# Start building
25-
cd my-project && uv sync && source .venv/bin/activate && make run-local
28+
cd my-project && uv sync && source .venv/bin/activate && make server
2629
```
2730

2831
## 🔨 Know What You're Doing?
@@ -32,13 +35,14 @@ cd my-project && uv sync && source .venv/bin/activate && make run-local
3235
**"I know more than you."** - Got it. Here's what you can build with:
3336

3437
```bash
35-
aegis init my-project --components worker,scheduler,database
38+
aegis init my-project --services auth --components worker,scheduler
3639
```
3740

3841
Your stack. Your rules. No hand-holding.
3942

40-
## 🧩 Available Components
43+
## 🧩 Available Components & Services
4144

45+
### Infrastructure Components
4246
| Component | Purpose | Status |
4347
|-----------|---------|--------|
4448
| **Core** (FastAPI + Flet) | Web API + Frontend |**Always Included** |
@@ -47,6 +51,12 @@ Your stack. Your rules. No hand-holding.
4751
| **Worker** | Async task queues (arq + Redis) | 🧪 **Experimental** |
4852
| **Cache** | Redis caching and sessions | 🚧 **Coming Soon** |
4953

54+
### Business Services
55+
| Service | Purpose | Status |
56+
|---------|---------|--------|
57+
| **Auth** | User authentication & JWT |**Available** |
58+
| **AI** | OpenAI integration | 🚧 **Coming Soon** |
59+
5060
## What You Get
5161

5262
- **FastAPI backend** with automatic API documentation
@@ -65,13 +75,14 @@ Real-time monitoring with component status, health percentages, and cross-platfo
6575
## 📚 Learn More
6676

6777
- **[📖 CLI Reference](cli-reference.md)** - Complete command reference
68-
- **[🏗️ Components](components/index.md)** - Deep dive into available components
78+
- **[🏗️ Components](components/index.md)** - Infrastructure components (database, worker, scheduler)
79+
- **[🔧 Services](services/index.md)** - Business services (auth, payment, AI)
6980
- **[🧠 Philosophy](philosophy.md)** - Architecture and design principles
7081

7182
## Development Commands
7283

7384
```bash
74-
make run-local # Start development server
85+
make server # Start development server
7586
make test # Run test suite
7687
make check # Run all quality checks
7788
make docs-serve # Serve documentation

0 commit comments

Comments
 (0)