Forge
Getting Started
Installation
Requirements
Install from PyPI
Verify Installation
Install from Source
Optional Dependencies
Next Steps
Quickstart
Create a Project
Project Structure
Run the Project
Access the API
What’s Next
Your First Project
Creating the Project
Understanding the Generated Code
Entry Point: main.py
Configuration: Settings
Database Models
Authentication Flow
Setting Up the Database
Configure Environment
Create the Database
Run Migrations
Running the Application
Development Mode
With Docker
Testing the API
Register a User
Login
Access Protected Endpoint
Running Tests
Next Steps
User Guide
Configuration
Configuration File Structure
Project Information
Database Configuration
database.type
database.orm
Feature Flags
features.auth
features.cors
features.redis
features.celery
features.testing
features.docker
features.migration
features.dev_tools
Environment Variables
Application Settings
Database Settings
JWT Settings
Email Settings (Complete Auth)
Redis Settings
Celery Settings
Logging Settings
Modifying Configuration
Database
Supported Databases
ORM Options
SQLModel
SQLAlchemy
Database Connection
Connection Manager
Getting a Session
Connection Pool Settings
Database Migrations
Configuration
Creating Migrations
Applying Migrations
Rolling Back
Viewing History
Adding New Models
Step 1: Create the Model
Step 2: Import in env.py
Step 3: Generate Migration
Step 4: Apply Migration
CRUD Operations
Docker Database Setup
Authentication
Authentication Types
Basic JWT Auth
Complete JWT Auth
Security Components
Password Hashing
Password Validation
JWT Tokens
API Endpoints
Basic JWT Auth Endpoints
Complete JWT Auth Endpoints
Authentication Flow
Basic Auth Flow
Complete Auth Flow
Password Reset Flow
Using Authentication in Routes
Protecting Routes
Optional Authentication
Email Configuration
Email Templates
JWT Configuration
Token Payload
Database Models
User Model
RefreshToken Model (Complete Auth)
VerificationCode Model (Complete Auth)
Security Best Practices
Redis Caching
Configuration
RedisManager
Initialization
Async Operations (FastAPI)
Sync Operations (Celery)
Available Methods
Async Methods
Sync Methods
Common Use Cases
Caching API Responses
Cache Invalidation
Pattern-Based Invalidation
Rate Limiting
Session Storage
Connection Management
Health Check
Direct Client Access
Docker Setup
Celery Background Tasks
Prerequisites
Configuration
Celery Application
Writing Tasks
Basic Task
Task with Database Access
Task with Retry
Calling Tasks
Task Execution Flow
Async Execution
Check Task Status
Scheduled Tasks
Schedule Options
Built-in Database Backup Task
Running Celery
Development
Docker
Monitoring with Flower
Best Practices
Testing
Test Structure
Configuration
Fixtures
Database Session
Test Client
Test Users
Auth Headers
Writing Tests
API Tests
Unit Tests
Testing with Database
Running Tests
Run All Tests
Run with Verbose Output
Run Specific File
Run Specific Test
Run with Coverage
Test Database
Best Practices
Deployment
Generated Files
Docker Architecture
Dockerfile
Docker Compose Services
Application Service
Database Service
Migration Service
Redis Service
Celery Services
Deployment Steps
1. Configure Production Environment
2. Build and Start
3. Verify Deployment
Managing the Deployment
View Logs
Restart Services
Stop Services
Update Application
Production Considerations
Security
Performance
Monitoring
Backup
Example: Production docker-compose Override
Best Practices
Project Structure
Keep the Generated Structure
Adding New Features
Example: Adding a Posts Feature
Security
Environment Variables
JWT Configuration
Password Security
CORS Configuration
Database
Connection Pool Tuning
Migration Best Practices
Query Optimization
API Design
Versioning
Error Handling
Pagination
Performance
Async Operations
Caching with Redis
Background Tasks
Testing
Test Coverage
Test Isolation
Mock External Services
Logging
Use the Logger
Log Levels
Code Quality
Type Hints
Development Tools
Architecture
Architecture Overview
High-Level Flow
Core Components
CLI Layer
Configuration Layer
Generation Layer
Generator Layer
Utility Layer
Generator Categories
Dependency Resolution
Conditional Generation
Generated Project Architecture
Generator System
Components
Global Registry
@Generator Decorator
GeneratorOrchestrator
Execution Flow
1. Discovery
2. Filtering
3. Sorting
4. Execution
Dependency Resolution
Declaring Dependencies
Resolution Rules
Example Dependency Chain
Conditional Execution
Using enabled_when
Common Conditions
Conditional Dependencies
Generator Implementation
Base Class
Implementation Pattern
Current Generators
API Reference
ConfigReader API
Location
Constructor
Methods
Project Information
get_project_name()
Database Configuration
get_database_type()
get_orm_type()
Authentication
has_auth()
get_auth_type()
has_refresh_token()
Feature Flags
has_cors()
has_redis()
has_celery()
has_testing()
has_docker()
has_migration()
has_dev_tools()
Raw Configuration Access
config
Configuration Structure
Usage in Generators
@Generator Decorator
Location
Signature
Parameters
category (required)
priority (required)
requires (optional)
enabled_when (optional)
description (optional)
How It Works
Examples
Basic Generator
Generator with Dependencies
Conditional Generator
Generator with Complex Condition
Accessing the Registry
Common Patterns
Feature-Specific Generator
Database-Specific Generator
Auth-Type-Specific Generator
GeneratorOrchestrator
Location
Constructor
Methods
execute_generators()
Internal Process
1. Discovery
2. Filtering
3. Dependency Resolution
4. Priority Sorting
5. Execution
Error Handling
Missing Dependency
Circular Dependency
Generator Failure
Usage in ProjectGenerator
Execution Order Example
Debugging
List Registered Generators
Check Generator Conditions
Trace Execution
Developer Guide
Development Setup
Prerequisites
Clone the Repository
Install Dependencies
Project Structure
Running Locally
Running Tests
Code Quality
Formatting
Linting
Type Checking
Building
Test Build
Build Package
Version Management
Development Workflow
Key Files to Understand
Debugging Tips
View Generator Registry
Test a Single Generator
Inspect Generated Files
Creating Generators
How Generators Work
Generator Structure
@Generator Decorator Parameters
Category
Priority
Requires
enabled_when
BaseTemplateGenerator
Available Properties
Using ConfigReader
Using FileOperations
Create a File
Create a Python File
Create JSON File
Create Markdown File
Complete Example
Generator File Locations
Adding New Features
Overview
Example: Adding GraphQL Support
Step 1: Configuration Collection
Step 2: Extend ConfigReader
Step 3: Create Generators
GraphQL Schema Generator
GraphQL Router Generator
Step 4: Update Dependencies
Step 5: Update Main Generator
Step 6: Add Tests
Step 7: Update Documentation
Checklist for New Features
Tips
Additional
Changelog
[0.1.8] - Latest
Features
Improvements
Documentation
[0.1.7]
Features
Improvements
[0.1.6]
Features
[0.1.5]
Features
[0.1.0]
Initial Release
Forge
Index
Edit on GitHub
Index