Skip to main content

Adaptive file-backed FastAPI server that turns datasets into CRUD APIs and UIs.

Project description

Adapt

Adapt is a FastAPI server that turns files in a directory into APIs and UIs.

  • Datasets (.csv, .xlsx, .parquet) become CRUD endpoints and DataTables UIs
  • Markdown/HTML become browsable pages
  • Media files become streaming endpoints and player/gallery UIs
  • Python files can register custom routers

Quick Start

pip install adapt-server
adapt addsuperuser --username admin /path/to/docroot
adapt serve /path/to/docroot

# Generate permissions for all discovered resources
adapt admin create-permissions /path/to/docroot __all__

# Everything below here can be done in the admin UI at
# http://localhost:8000/admin/ after logging in with the superuser account.
#
# Create a regular user
adapt admin create-user --username editor --password secret /path/to/docroot

# By default, the editor user has no permissions.
# See available groups (created by `adapt admin create-permissions`) and assign user to desired group
adapt admin list-groups /path/to/docroot
adapt admin add-to-group --username editor --group <group_name> /path/to/docroot

Useful URLs:

  • / landing page
  • /admin/ admin UI
  • /api/<resource> resource API
  • /ui/<resource> resource UI
  • /schema/<resource> resource schema

What Adapt Generates

From files in your docroot, Adapt auto-discovers resources and mounts routes with extensionless URLs where possible.

Example:

data/
  employees.csv
  sales.xlsx
  video.mp4
  readme.md
  stats.py

Rough output:

  • /api/employees, /ui/employees, /schema/employees
  • /api/sales/<sheet>, /ui/sales/<sheet>
  • /media/video.mp4, /ui/video.mp4, /ui/media
  • /readme
  • /api/stats/*

Current Security Posture

This reflects the current implementation in the codebase.

In Place

  • Authentication: session cookies and API keys (X-API-Key)
  • Authorization: RBAC (users, groups, permissions), plus superuser bypass
  • Password security: PBKDF2 hashing with per-user salts
  • Session security: expiration enforcement, sliding renewal, cleanup task
  • CSRF protection: enforced for cookie-authenticated unsafe methods (POST/PUT/PATCH/DELETE), including mixed session + API-key requests
  • Redirect hardening: login next paths are validated as local relative paths
  • Response hardening: CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, HSTS (when TLS is enabled)
  • Host header hardening: Trusted Host middleware
  • Data integrity: lock-based, atomic writes for mutable dataset plugins
  • Auditability: admin/audit logging for security-relevant actions
  • Sensitive response cleanup: admin user APIs no longer expose password_hash

Important Deployment Notes

  • Use TLS in non-local environments (--tls-cert + --tls-key) so secure cookies and HSTS protections are effective.
  • API-key-only clients are exempt from CSRF checks by design; cookie-auth browser flows require CSRF tokens.

Core Features

  • Adaptive discovery and route generation
  • Dataset CRUD with schema exposure
  • Caching with invalidation on mutations
  • Built-in admin UI for users/groups/permissions/locks/cache/api keys/audit logs
  • Plugin architecture with companion overrides in .adapt/

Dataset Mutation Envelope

For dataset endpoints, write operations use this payload structure:

{
  "action": "create|update|delete",
  "data": []
}

Use object data for update/delete as needed (for example, with _row_id).

CLI (Common Commands)

adapt serve <root> [--host ... --port ... --tls-cert ... --tls-key ... --reload --readonly --debug]
adapt check <root>
adapt addsuperuser <root> --username <name>
adapt list-endpoints <root>
adapt admin list-resources <root>
adapt admin create-permissions <root> __all__

Documentation

Detailed docs live under docs/manual/.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adapt_server-0.2.3.tar.gz (91.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adapt_server-0.2.3-py3-none-any.whl (99.8 kB view details)

Uploaded Python 3

File details

Details for the file adapt_server-0.2.3.tar.gz.

File metadata

  • Download URL: adapt_server-0.2.3.tar.gz
  • Upload date:
  • Size: 91.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adapt_server-0.2.3.tar.gz
Algorithm Hash digest
SHA256 291a243da35de8300dfabd2efc534e45c6372cd940dd1ad5a39595f2cb4e97dc
MD5 67a711c1c37454c1c5670c2ccd21ea6d
BLAKE2b-256 6d3fb0fd2123b4e95d896f30f390ed97e2cdb76c6139159fff5eb4f6c20db6fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for adapt_server-0.2.3.tar.gz:

Publisher: publish-pypi.yml on McIndi/adapt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adapt_server-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: adapt_server-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 99.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adapt_server-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2bbf35e9d52507448d54e9496122388b4aca31a11f64b065cf780e3edcebf68b
MD5 affbd429576ddbbd30a4aa55eb0fcd30
BLAKE2b-256 3c19244839b6001ec555657edb005f504dcc4cc42615130403111e9c0818d1ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for adapt_server-0.2.3-py3-none-any.whl:

Publisher: publish-pypi.yml on McIndi/adapt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page