Spec-driven backend platform for FastAPI: REST + GraphQL + search + version history + admin UI from a single msgspec.Struct
Project description
Spec-driven backend platform for FastAPI
Generate REST APIs, GraphQL, search, version history, and an admin UI from a single Python model.
Renamed from
autocrudtospecstar(v0.10.0). The old name still installs as a deprecation shim that redirects everyautocrud[.X]import tospecstar[.X]. New projects shouldpip install specstar. See the migration guide.
v0.11 adds spec-driven authoring (additive, zero breaking changes). Edit a single
spec.mdin prose; a Claude Code skill or thespecstar genCLI translates it into the declarative Python the engine consumes. See the Spec-Driven Authoring guide and the v0.11 upgrade notes.
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 spec-driven architecture.
Define your model once, and the framework generates the rest.
What sets SpecStar apart
Most "model → API" generators stop at routes. SpecStar treats every resource as a versioned timeline by default: updates create revisions, history stays queryable, and rollback is built in. Don't need history? Ignore it — the same routes work as plain CRUD.
Example
Define a resource model:
from msgspec import Struct
class User(Struct):
name: str
email: str
Register the model:
from fastapi import FastAPI
from specstar import spec
app = FastAPI()
spec.add_model(User)
spec.apply(app)
Start the server:
uvicorn main:app
Optional startup tuning:
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
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
Spec-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:
pip install specstar
Spec-driven (v0.11+) — bootstrap a starter project, then describe resources in prose:
specstar init my_app
# edit spec.md, then in Claude Code:
/specstar regen
# CI-friendly drift check (no LLM):
specstar verify
See the Spec-Driven Authoring guide for the full workflow.
Classic Python — register models directly:
Run your app:
uvicorn main:app
Open:
http://localhost:8000/docs
Documentation
Full documentation:
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file specstar-0.11.0.tar.gz.
File metadata
- Download URL: specstar-0.11.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5c160a3579ee42dda2bc5cd51aae1c11bf8ab2d1a96027c2e989fc2efe35089
|
|
| MD5 |
34c349c0d3a8fbe5e58e1e2c85e72bd3
|
|
| BLAKE2b-256 |
b14af427bbb1b79bac274ec9f2871e2d19881422e67621e14c9e7153348e36bf
|
File details
Details for the file specstar-0.11.0-py3-none-any.whl.
File metadata
- Download URL: specstar-0.11.0-py3-none-any.whl
- Upload date:
- Size: 391.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b35233ef837adab4e9a86bc401241b79426787d47440bb23786faf9d100d0a8
|
|
| MD5 |
b667e9dd3b69fdaee07654bd80d7a2e9
|
|
| BLAKE2b-256 |
2104b2c18722ff79917762472fc800e7ca5d1580746925b246c4e82bf3111519
|