@@ -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+
47614. **Run the application:**
62+ {% - endif %}
4863 ```bash
4964 make run-local
5065 ```
@@ -111,6 +126,41 @@ docker compose --profile dev up
111126docker 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