Fasteve is a rebuild of Eve using FastAPI as a base.
Create a file main.py
with:
from fasteve import Fasteve, MongoModel, Resource
class People(MongoModel):
name: str
people = Resource(model=People)
resources = [people]
app = Fasteve(resources=resources)
Start a database (mongodb default):
$ docker run --rm -p 27017:27017 mongo
Run the server with:
$ uvicorn main:app --reload
The API is now live, ready to be consumed:
$ curl -i http://localhost:8000/people
HTTP/1.1 200
...
{
"_data": [],
"_meta": {"max_results": 25, "total": 0, "page": 1},
"_links": {
"self": {"href": "/people", "title": "people"},
"parent": {"href": "/", "title": "home"},
},
}
- Powered by FastAPI ✅
- Emphasis on REST ✅
- Full range of CRUD operations ✅
- Customizable resource endpoints ✅
- Sub Resources ✅
- Pagination ✅
- HATEOAS ✅
- Bulk create ✅
- Data Validation ✅
- Extensible Data Validation ✅
- Unique Fields ✅
- CORS Cross-Origin Resource Sharing ✅
- Read-only by default ✅
- Default Values ✅
- Embedded Resource Serialization ✅
- Event Hooks ✅
- Custom ID Fields ✅
- Alternative ID Fields ✅
- Interactive API docs (provided by Swagger UI) ✅
- Alternative API docs (provided by ReDoc) ✅
- Repeated Background Tasks ✅
- MongoDB Support ✅
- SQL Support ✅
- Predefined Database Filters
- Projections
- JSONP
- Customizable, multiple item endpoints
- Filtering and Sorting
- JSON and XML Rendering
- Conditional Requests
- Data Integrity and Concurrency Control
- Resource-level Cache Control
- API Versioning
- Document Versioning
- Authentication
- Rate Limiting
- File Storage
- GeoJSON
- Internal Resources
- Enhanced Logging
- Operations Log
- MongoDB Aggregation Framework
Fasteve is a open source project,
distributed under the BSD license
- ✨ add SQL support via sqlmodel. PR #21 by @Wytamma.
- 🎉 v0.1.3. PR #20 by @Wytamma.
- ✨ Add event hooks. PR #17 by @Wytamma.
- ✨ break up endpoints. PR #16 by @Wytamma.
- ✨ Add PATCH method. PR #15 by @Wytamma.
- 🐛 PUT does upsert when ID not found. PR #14 by @Wytamma.
- 🎨 PUT returns 204 (No Content). PR #13 by @Wytamma.
- ✨ Add PUT method. PR #12 by @Wytamma.
- 🎨 Formatting with Black. PR #11 by @Wytamma.