Python SDK for integrating Velt comments, reactions, attachments, and user management into Django applications
Project description
Velt Python SDK
Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google Docs or Sheets, Recording like Loom, Huddles like Slack, and much more.
velt-py is the official backend SDK for Velt. Use it to power a self-hosted Velt backend or to call Velt's REST APIs directly from any Python service.
The SDK exposes two independent backends:
| Backend | Namespace | Use case |
|---|---|---|
| Self-hosting | sdk.selfHosting.* |
Store Velt data in your own MongoDB + AWS S3 |
| REST API | sdk.api.* |
Call Velt's REST APIs directly — no database required |
- Self-hosting (
sdk.selfHosting.*) simplifies backend implementation by up to 90%. Pass your DB and storage configs to the SDK, call the relevant method with the raw frontend request payload, and return the response directly to the client. - REST API (
sdk.api.*) provides fully-typed@dataclassrequest objects across all Velt REST services, returning raw Velt API responses. No database or AWS configuration needed.
Features
With Velt you can add powerful collaboration features to your backend extremely fast:
- Comments like Figma, Frame.io, Google Docs, Sheets and more
- Recording like Loom (audio, video, screen)
- Huddle like Slack (audio, video, screensharing)
- In-app and off-app notifications
- @mentions and assignment
- Presence, Cursors, Live Selection
- Live state sync and multiplayer editing with conflict resolution (CRDT)
- Activities, access control, GDPR data tooling, and AI-powered agents & workflows
- ... and so much more
Installation
pip install velt-py
Requirements
- Python 3.8+
- MongoDB 6+ (Percona Server or MongoDB Atlas) for self-hosting
requestsfor REST API calls (installed automatically)pymongoandboto3for the self-hosting backend (MongoDB + optional S3 attachments)
Quick Start
Initialize the SDK
Self-hosting (MongoDB + optional AWS S3):
from velt_py import VeltSDK
sdk = VeltSDK.initialize({
'database': {
'connection_string': 'mongodb+srv://user:pass@cluster.mongodb.net/velt-db',
# Or pass individual components:
# 'host': 'localhost:27017',
# 'username': 'your-username',
# 'password': 'your-password',
# 'auth_database': 'admin',
# 'database_name': 'velt-db',
},
'apiKey': 'YOUR_VELT_API_KEY', # or set VELT_API_KEY
'authToken': 'YOUR_VELT_AUTH_TOKEN', # or set VELT_AUTH_TOKEN
})
REST API only (no database needed):
from velt_py import VeltSDK
sdk = VeltSDK.initialize({
'apiKey': 'YOUR_VELT_API_KEY',
'authToken': 'YOUR_VELT_AUTH_TOKEN',
})
# All sdk.api.* services are now available
result = sdk.api.organizations.getOrganizations(
GetOrganizationsRequest(organizationIds=['org-123'])
)
Self-hosting example
Each self-hosting method takes a single typed resolver-request object — build it from the incoming frontend JSON with from_dict(data) and return the result straight to the client:
from velt_py import GetCommentResolverRequest
result = sdk.selfHosting.comments.getComments(
GetCommentResolverRequest.from_dict(data)
)
Comment save payload extensions
The comment save request mirrors the frontend contract:
targetComment—SaveCommentResolverRequest.targetCommentis thePartialCommentthe action occurred on (resolved by the frontend fromcommentId). It is request context for your handler only;saveCommentsdoes not persist it (the comment already lives inside the annotation'scommentsmap).CommentResolverSaveEvent— when the frontend opts into additional save events, theeventfield carries one of these non-core values (status change, priority, assign, approve, reaction, subscribe, …) in addition to the coreResolverActions.from_dictparses core events toResolverActions, additional events toCommentResolverSaveEvent, and any unknown value is preserved as a plain string.
from velt_py import SaveCommentResolverRequest, ResolverActions, CommentResolverSaveEvent
request = SaveCommentResolverRequest.from_dict(data)
if request.event == CommentResolverSaveEvent.PRIORITY_CHANGE:
... # react to an annotation-level priority change
elif request.targetComment is not None:
... # the specific comment the action targeted
sdk.selfHosting.comments.saveComments(request)
Verifying the forwarded resolver token
When the Velt frontend forwards an auth credential to your resolver endpoint (e.g. an
Authorization: Bearer <token> header), sdk.selfHosting.verifyToken(...) authenticates it before
you serve any data. It is opt-in via a resolver_auth config block, framework-agnostic (pass a
headers mapping or a raw token), and fail-closed — it returns a structured VerifyTokenResult
and never raises for a verification outcome.
Install the JWT extra if you use the built-in verifier (the custom-callback path needs nothing extra):
pip install 'velt-py[auth]'
sdk = VeltSDK.initialize({
'database': {...},
'resolver_auth': {
# Built-in JWT/JWKS verifier:
'jwt': {
'secret': 'your-hmac-secret', # HS* — or, for RS*/ES*:
# 'public_key': '-----BEGIN PUBLIC KEY-----...',
# 'jwks_url': 'https://your-idp/.well-known/jwks.json',
'algorithms': ['HS256'], # REQUIRED allowlist (rejects alg=none / confusion)
'issuer': 'https://your-idp', # optional, enforced when set
'audience': 'velt', # optional, enforced when set
'leeway': 30, # optional clock skew (seconds)
# 'require': ['exp'], # optional: reject tokens missing these claims
},
# OR a custom escape hatch (takes priority over `jwt`):
# 'verify': lambda token, headers: my_decode(token), # return claims | None
},
})
result = sdk.selfHosting.verifyToken(headers=request.headers) # or token='...'
if not result.verified:
return HttpResponse(status=401) # result.errorCode tells you why
# result.claims holds the decoded payload
sdk.selfHosting.comments.saveComments(SaveCommentResolverRequest.from_dict(data))
verifyToken authenticates only — it does not authorize. The resolver services keep their own
apiKey/organizationId scoping, and result.claims is informational: if you need tenant
isolation, assert the relevant claim (e.g. an org id) against the resolver payload yourself.
REST API example
Each sdk.api.* method takes a single typed request dataclass:
from velt_py.models.comment_annotation_api import AddCommentAnnotationsRequest
sdk.api.commentAnnotations.addCommentAnnotations(
AddCommentAnnotationsRequest(
organizationId='org-123',
documentId='doc-1',
commentAnnotations=[{
'location': {'id': 'section-1', 'locationName': 'Introduction'},
'commentData': [{
'commentText': 'This needs review',
'from': {'userId': 'user-1', 'name': 'John Doe', 'email': 'john@example.com'},
}],
}],
)
)
Framework integration
Initialize the SDK once and reuse it across requests. For example, with FastAPI:
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from velt_py import VeltSDK, GetCommentResolverRequest
app = FastAPI()
sdk = VeltSDK.initialize({'database': {'connection_string': 'mongodb+srv://...'}})
@app.post('/api/velt/comments/get')
async def get_comments(request: Request):
data = await request.json()
result = sdk.selfHosting.comments.getComments(GetCommentResolverRequest.from_dict(data))
return JSONResponse(content=result, status_code=result.get('statusCode', 200))
See the Python SDK documentation for Django, Flask, and FastAPI integration guides.
Shutdown
Call sdk.close() during graceful shutdown to release the database connection pool:
sdk.close()
Documentation
- Read the Python SDK documentation for the full setup guide, configuration reference, and a complete list of
sdk.selfHosting.*andsdk.api.*methods with request/response examples. - Browse the broader Velt documentation for guides and frontend SDK references.
- velt-py on PyPI
Use cases
- Explore use cases to learn how collaboration could look on your product.
- Figma Template: visualize what collaboration features could look like on your product.
Releases
- See the latest changes.
Security
- Velt is SOC2 Type 2 and HIPAA compliant. Learn more
Community
License
MIT
Support
For issues and questions, contact support@velt.dev or visit docs.velt.dev.
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 velt_py-0.1.14.tar.gz.
File metadata
- Download URL: velt_py-0.1.14.tar.gz
- Upload date:
- Size: 85.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53f05e84e1a4116f4c08a0e4cb8dd5f20d2b78b734edf14eff66f8f46445f98d
|
|
| MD5 |
e4fa44714523336d8a12f1c340f7e29a
|
|
| BLAKE2b-256 |
e4ddfef57deebfaa4682617564a7a181207ea3892f57a061d92e1678182fd764
|
Provenance
The following attestation bundles were made for velt_py-0.1.14.tar.gz:
Publisher:
publish.yml on snippyly/velt-py-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
velt_py-0.1.14.tar.gz -
Subject digest:
53f05e84e1a4116f4c08a0e4cb8dd5f20d2b78b734edf14eff66f8f46445f98d - Sigstore transparency entry: 1870635514
- Sigstore integration time:
-
Permalink:
snippyly/velt-py-sdk@3ff5130aa0faff94813506b7344323ed1a2cad9e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/snippyly
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ff5130aa0faff94813506b7344323ed1a2cad9e -
Trigger Event:
push
-
Statement type:
File details
Details for the file velt_py-0.1.14-py3-none-any.whl.
File metadata
- Download URL: velt_py-0.1.14-py3-none-any.whl
- Upload date:
- Size: 119.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15fccef2e48d697e7fc7181e1c1ea206138604eed766a44641c4ab1f17b458a7
|
|
| MD5 |
b4bc44031ca7f8c7173f2f7f266e8346
|
|
| BLAKE2b-256 |
da1120a63f81001dc9ee9fde387b722757e5ab2043a78b028c95b1e84d915584
|
Provenance
The following attestation bundles were made for velt_py-0.1.14-py3-none-any.whl:
Publisher:
publish.yml on snippyly/velt-py-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
velt_py-0.1.14-py3-none-any.whl -
Subject digest:
15fccef2e48d697e7fc7181e1c1ea206138604eed766a44641c4ab1f17b458a7 - Sigstore transparency entry: 1870635583
- Sigstore integration time:
-
Permalink:
snippyly/velt-py-sdk@3ff5130aa0faff94813506b7344323ed1a2cad9e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/snippyly
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ff5130aa0faff94813506b7344323ed1a2cad9e -
Trigger Event:
push
-
Statement type: