Skip to main content

Fortitude Framework

Fortitude is a web framework that enables server-side components defined as Pydantic models, which can be used as input and output schemas for endpoints registered as tools in an external registry.

Features

  • Define data models with Pydantic
  • Automatic CRUD API endpoints
  • Server-side NextJS UI components
  • Tool registry integration
  • CLI for project management
  • MCP (Model Context Protocol) integration for LLM sampling
  • Advanced Rails-like scaffolding for rapid development
  • Domain-driven design support
  • Microservices architecture
  • Database migrations

Installation

# Clone the repository
git clone https://github.com/your-username/fortitude.git
cd fortitude

# Install dependencies
pip install -e .

Quick Start

# Create a new project
fort new myproject
cd myproject

# Install dependencies
pip install -r requirements.txt
cd ui && npm install && cd ..

# Generate a model
fort model User

# Start the servers
fort start

Project Structure

myproject/
├── ui/                    # NextJS UI server
│   ├── app/               # App router
│   ├── components/        # React components
│   ├── public/            # Static assets
│   └── package.json
├── backend/               # Backend API server
│   ├── models/            # Pydantic models
│   ├── endpoints/         # API endpoints
│   └── mcp/               # MCP integration
├── main.py                # Main application entry point
└── requirements.txt

Creating Models

Models are defined as Pydantic classes that inherit from FortitudeBaseModel:

from fortitude.backend.models import FortitudeBaseModel
from pydantic import Field
from typing import Optional

class User(FortitudeBaseModel):
    name: str
    email: str
    age: Optional[int] = None

Register the model in your main application:

from backend.models.user import User
app.register_model(User)

Advanced Rails-like Scaffolding

Fortitude offers powerful Rails-like scaffolding capabilities with both standard and advanced options:

Basic Resource Generation

# Generate a complete resource scaffold
fort resource Product

This creates:

  • Pydantic model
  • CRUD controller
  • Service layer
  • UI components (list, form, detail views)
  • MCP integrations
  • Tests

Advanced Resource Generation

# Generate an advanced resource scaffold with relationships, validation, and more
fort resource Product --advanced

The advanced scaffold includes:

  • Models with relationships, validations, and computed properties
  • Full-featured controllers with authentication
  • Service layer with caching, transactions, and error handling
  • Advanced UI components with filtering, sorting, pagination
  • Comprehensive test suite
  • Deployment configurations

Domain-Driven Design

# Generate a domain-driven design scaffold
fort domain Store User:name,email,age Product:name,price,stock Order

This creates a complete domain structure with:

  • Core domain models
  • Value objects
  • Repositories
  • Domain services
  • Application services
  • Aggregates
  • Entity relationships

Microservices

# Generate microservices
fort microservice auth --type api
fort microservice worker --type worker
fort microservice gateway --type gateway
fort microservice ai-assistant --type mcp-server

Generates specialized microservices with:

  • Containerization
  • API gateways
  • Service discovery
  • Health checks
  • Message queues

Custom Scaffolds

For maximum flexibility, generate and customize your own scaffolds:

# Generate a scaffold configuration (standard or advanced)
fort generate Task --advanced --output task_scaffold.py

# Edit the configuration file to customize everything
# Then create the scaffold
fort scaffold task_scaffold.py --advanced

MCP Integration

Fortitude provides comprehensive MCP support with both client and server capabilities:

Running an MCP Server

# Start an MCP server
fort mcp-server --name "My MCP Server" --port 8888

# Create a custom sampling handler
fort mcp-handler my_handler --type sampling

# Create a tool handler
fort mcp-handler my_tool --type tool

# Create a resource handler
fort mcp-handler my_resource --type resource

Using MCP with Models

# Generate an MCP client for a model
fort model-mcp-client User --endpoint http://localhost:8888/mcp

# Generate an MCP server for a model
fort model-mcp-server User --port 8889

Sampling from LLMs

# Sample from LLM using MCP
result = await endpoint.sample_llm(
    prompt="What insights can you provide about this data?",
    system_prompt="You are a data analysis expert",
    max_tokens=1000
)

The client will display the sample request and handle user approval through the MCP protocol.

Accessing the UI

Once the servers are running:

  • UI Server: http://localhost:9996
  • API Server: http://localhost:9997
  • API Documentation: http://localhost:9997/docs
  • MCP Server: http://localhost:8888/mcp (when running)

Registry Integration

Endpoints are automatically registered as tools in the external registry at https://arthurcolle--registry.modal.run, making them available for agents to use.

License

MIT

Metadata

Release files for fortitude-framework 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fortitude-framework 0.1.0
File Size Uploaded Provenance Actions
fortitude_framework-0.1.0.tar.gz 85.9 kB Without provenance Details for fortitude_framework-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fortitude-framework 0.1.0
File Interpreter ABI Platform Actions
fortitude_framework-0.1.0-py3-none-any.whl Python 3 none any Details for fortitude_framework-0.1.0-py3-none-any.whl

Total release size: 196.0 kB

Release files / fortitude_framework-0.1.0.tar.gz

Download URL fortitude_framework-0.1.0.tar.gz
Size 85.9 kB
Tags Source
SHA-256 checksum
How to use checksums
332de9ec84d3048b867eb39f80d2f3e624373a6ccd7d2cbe1f01c30e843fc4eb
BLAKE2b-256 checksum
How to use checksums
39dcd8893dd1bdeca8e5a4d32e0ba2dfd43d17c560d99c91f810e3d2af32220d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.4 Darwin/24.4.0

Release files / fortitude_framework-0.1.0-py3-none-any.whl

Download URL fortitude_framework-0.1.0-py3-none-any.whl
Size 110.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aeda381f0f422afc6e70971441b22c5842d7adb79a6831c126e75af67765e7ac
BLAKE2b-256 checksum
How to use checksums
4833fda0cb848eb61a38d4f7db064d48111d643e685db1ff0f3f019195f19b59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.4 Darwin/24.4.0

Security for fortitude-framework 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page