Skip to content

Commit 56f75f2

Browse files
authored
Merge pull request #19 from lbedner/db-config-template
Add database config template and tests
2 parents 0843fb1 + 50c2fb1 commit 56f75f2

6 files changed

Lines changed: 653 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ Shows project information and available components.
8484

8585
## Coding Standards
8686

87+
### Git and Version Control
88+
**DO NOT perform git operations unless explicitly requested.** This includes:
89+
- No `git add`, `git commit`, or `git push` commands
90+
- No creating pull requests
91+
- Wait for explicit user approval before committing changes
92+
8793
### Python Style Guidelines
8894

8995
**Type Hints (MANDATORY - Fortress-Level Type Safety):**

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This Aegis Stack project includes the following components:
1212
- **✅ Scheduler**: APScheduler-based async task scheduling
1313
{%- endif %}
1414
{%- if cookiecutter.include_database == "yes" %}
15-
- **✅ Database**: SQLAlchemy + asyncpg for PostgreSQL
15+
- **✅ Database**: SQLite database with SQLModel ORM
1616
{%- endif %}
1717
{%- if cookiecutter.include_cache == "yes" %}
1818
- **✅ Cache**: Redis-based async caching
@@ -44,7 +44,22 @@ This Aegis Stack project includes the following components:
4444
# Edit .env with your configuration
4545
```
4646

47+
{%- if cookiecutter.include_database == "yes" %}
48+
49+
4. **Set up database:**
50+
```bash
51+
# Create data directory for SQLite database
52+
mkdir -p data
53+
54+
# Database will be created automatically on first run
55+
# Default location: data/app.db
56+
```
57+
58+
5. **Run the application:**
59+
{%- else %}
60+
4761
4. **Run the application:**
62+
{%- endif %}
4863
```bash
4964
make run-local
5065
```
@@ -111,6 +126,41 @@ docker compose --profile dev up
111126
docker compose --profile prod up
112127
```
113128

129+
{%- if cookiecutter.include_database == "yes" %}
130+
131+
## Configuration
132+
133+
### Database Settings
134+
135+
The database component uses SQLite with the following default configuration:
136+
137+
```bash
138+
# Environment variables (add to .env file)
139+
DATABASE_URL=sqlite:///data/app.db # Database file location
140+
DATABASE_ENGINE_ECHO=false # Enable SQL query logging
141+
```
142+
143+
### Database Usage
144+
145+
```python
146+
from app.core.db import db_session
147+
from sqlmodel import SQLModel, Field, select
148+
149+
# Define a model
150+
class User(SQLModel, table=True):
151+
id: int | None = Field(default=None, primary_key=True)
152+
name: str
153+
email: str
154+
155+
# Use the database
156+
with db_session() as session:
157+
user = User(name="John Doe", email="john@example.com")
158+
session.add(user)
159+
# Auto-committed by context manager
160+
```
161+
162+
{%- endif %}
163+
114164
## Project Structure
115165

116166
```
@@ -126,6 +176,9 @@ docker compose --profile prod up
126176
│ ├── core/ # Core utilities
127177
│ │ ├── config.py # Environment-dependent configuration
128178
│ │ ├── constants.py # Immutable constants (12-Factor App)
179+
{%- if cookiecutter.include_database == "yes" %}
180+
│ │ ├── db.py # Database connection and session management
181+
{%- endif %}
129182
│ │ └── log.py # Structured logging
130183
│ ├── entrypoints/ # Execution entry points
131184
│ ├── integrations/ # App composition layer

0 commit comments

Comments
 (0)