Metadata-Version: 2.4
Name: specstar
Version: 0.10.0
Summary: Model-driven backend platform for FastAPI: REST + GraphQL + search + version history + admin UI from a single msgspec.Struct
Project-URL: Homepage, https://github.com/HYChou0515/specstar
Project-URL: Documentation, https://HYChou0515.github.io/specstar/
Project-URL: Repository, https://github.com/HYChou0515/specstar.git
Project-URL: Issues, https://github.com/HYChou0515/specstar/issues
Author-email: HYChou0515 <hychou.svm@example.com>
License: MIT License
        
        Copyright (c) 2025 HYChou0515
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api,automation,crud,fastapi,rest
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: fastapi<1,>=0.115
Requires-Dist: jsonpatch>=1.33
Requires-Dist: jsonpointer>=3.0.0
Requires-Dist: more-itertools>=10.7.0
Requires-Dist: msgpack>=1.1.1
Requires-Dist: msgspec>=0.19.0
Requires-Dist: pydantic<3,>=1.10.26
Requires-Dist: python-multipart>=0.0.22
Requires-Dist: qqabc>=0.2.1
Requires-Dist: ty[dev]>=0.0.33
Requires-Dist: xxhash>=3.5.0
Provides-Extra: all
Requires-Dist: boto3>=1.40.21; extra == 'all'
Requires-Dist: celery>=5.6.2; extra == 'all'
Requires-Dist: datamodel-code-generator[http]>=0.35.0; extra == 'all'
Requires-Dist: httpx>=0.28.1; extra == 'all'
Requires-Dist: oracledb>=3.4.2; extra == 'all'
Requires-Dist: pika>=1.3.2; extra == 'all'
Requires-Dist: psycopg2-binary>=2.9.10; extra == 'all'
Requires-Dist: pymysql>=1.1.2; extra == 'all'
Requires-Dist: python-magic>=0.4.27; extra == 'all'
Requires-Dist: redis>=6.4.0; extra == 'all'
Requires-Dist: sqlalchemy>=2.0.46; extra == 'all'
Requires-Dist: strawberry-graphql>=0.288.1; extra == 'all'
Requires-Dist: tenacity>=9.1.2; extra == 'all'
Requires-Dist: textual>=6.3.0; extra == 'all'
Requires-Dist: typer>=0.20.0; extra == 'all'
Provides-Extra: benchmark
Requires-Dist: matplotlib>=3.8; extra == 'benchmark'
Requires-Dist: pyyaml>=6.0; extra == 'benchmark'
Requires-Dist: rich>=13.0; extra == 'benchmark'
Provides-Extra: celery
Requires-Dist: celery>=5.6.2; extra == 'celery'
Provides-Extra: cli
Requires-Dist: datamodel-code-generator[http]>=0.35.0; extra == 'cli'
Requires-Dist: httpx>=0.28.1; extra == 'cli'
Requires-Dist: tenacity>=9.1.2; extra == 'cli'
Requires-Dist: textual>=6.3.0; extra == 'cli'
Requires-Dist: typer>=0.20.0; extra == 'cli'
Provides-Extra: dev
Requires-Dist: boto3>=1.40.21; extra == 'dev'
Requires-Dist: celery>=5.6.2; extra == 'dev'
Requires-Dist: coverage>=7.9.2; extra == 'dev'
Requires-Dist: datamodel-code-generator[http]>=0.35.0; extra == 'dev'
Requires-Dist: httpx>=0.28.1; extra == 'dev'
Requires-Dist: matplotlib>=3.8; extra == 'dev'
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == 'dev'
Requires-Dist: mkdocs-literate-nav>=0.6.0; extra == 'dev'
Requires-Dist: mkdocs-material-extensions>=1.3.0; extra == 'dev'
Requires-Dist: mkdocs-material>=9.5.0; extra == 'dev'
Requires-Dist: mkdocs-section-index>=0.3.0; extra == 'dev'
Requires-Dist: mkdocs-static-i18n>=1.2.0; extra == 'dev'
Requires-Dist: mkdocs>=1.6.0; extra == 'dev'
Requires-Dist: mkdocstrings[python]>=0.26.0; extra == 'dev'
Requires-Dist: oracledb>=3.4.2; extra == 'dev'
Requires-Dist: pika>=1.3.2; extra == 'dev'
Requires-Dist: psycopg2-binary>=2.9.10; extra == 'dev'
Requires-Dist: pymdown-extensions>=10.0.0; extra == 'dev'
Requires-Dist: pymysql>=1.1.2; extra == 'dev'
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'dev'
Requires-Dist: pytest-markdown-docs>=0.9.1; extra == 'dev'
Requires-Dist: pytest-rerunfailures>=15.0; extra == 'dev'
Requires-Dist: pytest>=8.4.1; extra == 'dev'
Requires-Dist: python-magic>=0.4.27; extra == 'dev'
Requires-Dist: pyyaml>=6.0; extra == 'dev'
Requires-Dist: redis>=6.4.0; extra == 'dev'
Requires-Dist: rich>=13.0; extra == 'dev'
Requires-Dist: ruff>=0.12.4; extra == 'dev'
Requires-Dist: sqlalchemy>=2.0.46; extra == 'dev'
Requires-Dist: strawberry-graphql>=0.288.1; extra == 'dev'
Requires-Dist: tenacity>=9.1.2; extra == 'dev'
Requires-Dist: textual>=6.3.0; extra == 'dev'
Requires-Dist: typer>=0.20.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: boto3>=1.40.21; extra == 'docs'
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == 'docs'
Requires-Dist: mkdocs-literate-nav>=0.6.0; extra == 'docs'
Requires-Dist: mkdocs-material-extensions>=1.3.0; extra == 'docs'
Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
Requires-Dist: mkdocs-section-index>=0.3.0; extra == 'docs'
Requires-Dist: mkdocs-static-i18n>=1.2.0; extra == 'docs'
Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.26.0; extra == 'docs'
Requires-Dist: pymdown-extensions>=10.0.0; extra == 'docs'
Provides-Extra: graphql
Requires-Dist: strawberry-graphql>=0.288.1; extra == 'graphql'
Provides-Extra: magic
Requires-Dist: python-magic>=0.4.27; extra == 'magic'
Provides-Extra: mq
Requires-Dist: pika>=1.3.2; extra == 'mq'
Provides-Extra: mysql
Requires-Dist: pymysql>=1.1.2; extra == 'mysql'
Provides-Extra: oracle
Requires-Dist: oracledb>=3.4.2; extra == 'oracle'
Provides-Extra: postgresql
Requires-Dist: psycopg2-binary>=2.9.10; extra == 'postgresql'
Provides-Extra: redis
Requires-Dist: redis>=6.4.0; extra == 'redis'
Provides-Extra: s3
Requires-Dist: boto3>=1.40.21; extra == 's3'
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy>=2.0.46; extra == 'sqlalchemy'
Description-Content-Type: text/markdown

<p align="center">
  <img src="branding/logo-text.svg" alt="SpecStar" height="120">
</p>

<p align="center">
  <strong>Model-driven backend platform for FastAPI</strong><br>
  Generate REST APIs, GraphQL, search, version history, and an admin UI from a single Python model.
</p>

<p align="center">
  <a href="https://pypi.org/project/specstar/"><img alt="PyPI" src="https://img.shields.io/pypi/v/specstar"></a>
  <a href="https://github.com/HYChou0515/specstar/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/pypi/l/specstar"></a>
  <a href="https://hychou0515.github.io/specstar/"><img alt="Docs" src="https://img.shields.io/badge/docs-mkdocs-blue"></a>
</p>

> **Renamed from `autocrud` to `specstar` (v0.10.0).** The old name still installs as a deprecation shim that redirects every `autocrud[.X]` import to `specstar[.X]`. New projects should `pip install specstar`. See the [migration guide](MIGRATION.md).

Focus on **business logic**, not infrastructure.

⭐ If you find this project useful, consider giving it a star.

---

# Why SpecStar

Modern backend development repeatedly rebuilds the same infrastructure:

- CRUD APIs
- validation
- search and filtering
- version history
- permissions
- background jobs
- admin tools

Most of this code is **not business logic**.

SpecStar eliminates this repetition by using a **model-driven architecture**.

Define your model once, and the framework generates the rest.

---

# Example

Define a resource model:

```python
from msgspec import Struct

class User(Struct):
    name: str
    email: str
```

Register the model:

```python
from fastapi import FastAPI
from specstar import spec

app = FastAPI()

spec.add_model(User)
spec.apply(app)
```

Start the server:

```bash
uvicorn main:app
```

Optional startup tuning:

```bash
export SPECSTAR_DEFAULT_QUERY_LIMIT=1000
```

This controls the default page size for list endpoints. Per-request `limit`
still overrides it.

You now automatically get:

```
POST   /users
GET    /users
GET    /users/{id}
PUT    /users/{id}
PATCH  /users/{id}
DELETE /users/{id}
```

OpenAPI documentation is generated automatically.

---

# Architecture

```mermaid
graph TD

FastAPI --> SpecStar
SpecStar --> ResourceManager
ResourceManager --> Storage

Storage --> MetaStore
Storage --> RevisionStore
Storage --> BlobStore

SpecStar --> REST_API
SpecStar --> GraphQL_API
SpecStar --> UI_Generator
```

---

# Core Features

## Model-driven APIs

SpecStar generates APIs directly from Python models.

```
Model
  ↓
REST API
GraphQL API
OpenAPI
```

---

## Versioned resources

Every resource maintains immutable revision history.

```
Resource
 ├── r1
 ├── r2
 └── r3
```

Advantages:

* audit history
* rollback
* draft workflows
* debugging

---

## Built-in search

Search operates on indexed metadata instead of scanning full resource payloads.

```
QueryBuilder
   ↓
ResourceManager.search()
   ↓
MetaStore.search()
```

---

## Background jobs

Jobs are modeled as resources.

```
create()
  ↓
message_queue.put(resource_id)
```

Workers process jobs through:

```
ResourceManager.start_consume()
```

---

## Storage abstraction

SpecStar supports multiple storage backends.

| Backend  | Meta       | Revision | Blob       |
| -------- | ---------- | -------- | ---------- |
| Memory   | memory     | memory   | memory     |
| Disk     | SQLite     | files    | filesystem |
| S3       | SQLite     | S3       | S3         |
| Postgres | PostgreSQL | S3       | S3         |

You can also implement custom storage systems.

---

## UI generation

SpecStar can generate a web interface directly from the API.

```
API
 ↓
UI generator
 ↓
admin dashboard
```

This allows rapid creation of internal tools.

---

# Comparison

| Feature         | SpecStar  | Hasura     | Django     |
| --------------- | --------- | ---------- | ---------- |
| REST API        | ✅         | ❌          | ✅          |
| GraphQL         | ✅         | ✅          | ⚠️         |
| Version history | ✅         | ❌          | ❌          |
| Search engine   | ✅         | SQL        | ORM        |
| Storage         | pluggable | PostgreSQL | relational |
| Background jobs | built-in  | external   | external   |
| UI generation   | ✅         | console    | admin      |

---

# Quickstart

Install:

```bash
pip install specstar
```

Run your app:

```bash
uvicorn main:app
```

Open:

```
http://localhost:8000/docs
```

---

# Documentation

Full documentation:

[https://hychou0515.github.io/specstar/](https://hychou0515.github.io/specstar/)

---

# Example use cases

SpecStar works well for:

* internal tools
* content systems
* configuration management
* job processing systems
* administrative APIs
* workflow management systems

---

# License

MIT
