Platformics
Platformics is a GraphQL API framework that relies on code generation to implement a full featured GraphQL API on top of a PostgreSQL database, with support for authorization policy enforcement and file persistence via S3. It's built on top of the best available Python tools and frameworks!
The libraries and tools that make Platformics work:
Links to these tools/libraries
- LinkML - Schema modeling language
- FastAPI - Async HTTP router
- Strawberry - GraphQL Framework
- Pydantic - Data validation
- Cerbos - Authorization
- SQLAlchemy - Database Access / ORM
- factory_boy - Test fixtures
- Alembic - Database migrations
Current Features
- Express your schema in a straightforward YAML format
- GraphQL Dataloader pattern (no n+1 queries!)
- Authorization policy enforcement
- Flexible Filtering
- Data aggregation
- Top-level pagination
- Relationship traversal
- DB migrations
- Generated Test fixtures
- pytest wiring
- VSCode debugger integration
- Add custom REST endpoints to generated API
- Add custom GQL queries/mutations to generated API
- Support arbitrary class inheritance hierarchies (1-level deep)
- Package and publish to PyPI
Roadmap
- Plugin hooks to add business logic to generated GQL resolvers
How to set up your own platformics API
- Copy the test_app boilerplate code to your own repository.
- Edit
schema/schema.ymlto reflect your application's data model. - Run
make buildand thenmake initto build and run your own GraphQL API service. - Browse to http://localhost:9009/graphql to interact with your api!
- Run
make tokento generate an authorization token that you can use to interact with the API. Themaketarget copies the necessary headers to the system clipboard. Paste the token into theheaderssection at the bottom of the GraphQL explorer API
Versioning platformics
Platformics can be used in downstream applications by either
- using the platformics image as the base Docker image. To select a version of platformics, add the appropriate version tags to the docker image
- installing as a python dependency,
pip install platformics.
The version in pyproject.toml is managed using poetry-dynamic-versioning which determines version based on git tags.
Iterating on your schema
- Make changes to
schema/schema.yml - Run
make codegento re-run code gen and restart the API service - If your changes require DB schema changes, run
make alembic-autogenerateandmake alembic-upgrade-headto generate DB migrations and run them.
HOWTO
- Work with platformics
- Extend the generated API
- Customize Codegen templates
- Override Default Authorization Behaviors
Contributing
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to opensource@chanzuckerberg.com.
Reporting Security Issues
Please disclose security issues responsibly by contacting security@chanzuckerberg.com.
Metadata
Release files for platformics 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| platformics-1.0.3.tar.gz | 52.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| platformics-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.1 kB
Release files / platformics-1.0.3.tar.gz
| Download URL | platformics-1.0.3.tar.gz |
|---|---|
| Size | 52.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fdebe98db5630fb9c13ee38c3461a07b78091059bc9761758fe7928ef532aaf
|
|
BLAKE2b-256 checksum How to use checksums |
177af7ca9d1467d54fc4c0b42a2b57a35fd0786f5bea58241327c497f9f060b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2025.
Transparency logRelease files / platformics-1.0.3-py3-none-any.whl
| Download URL | platformics-1.0.3-py3-none-any.whl |
|---|---|
| Size | 66.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19e1de43507b109e51de7ec6f5249ab516a46e045dd1a572a6040b1d9df9c36a
|
|
BLAKE2b-256 checksum How to use checksums |
9f5ddc2ea417feb38f2ae2a8d382b12cead07a95542cda928e06c1156c45594f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2025.
Transparency logSecurity for platformics 1.0.3
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for platformics-1.0.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2025.
Transparency logA 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.