Skip to main content

Serve flat files (CSV, XLSX, JSON) as a local REST API instantly.

Project description

⚡ flatapicli

Serve flat files (CSV, XLSX, JSON) as a local REST API instantly.

Python FastAPI Pandas Uvicorn Typer Watchdog License


Install

pip install flatapicli

Usage

# Start the server pointing at a directory
flatapicli serve --dir ./data

# Custom port
flatapicli serve --dir ./data --port 8080

# Expose to network (VPS / LAN)
flatapicli serve --dir ./data --host 0.0.0.0

# Auto-reload store on file change (no server restart)
flatapicli serve --dir ./data --watch

# Inspect files without starting server
flatapicli list-files --dir ./data

While running:

  • r + Enter → reload data files without restarting server
  • q + Enter → clean shutdown

URL Structure

Given a directory with products.csv, orders.xlsx (sheets: jan, feb), and users.json:

URL Response
GET / All loaded files
GET /products/api Schema, columns, row count
GET /products/api/rows All rows
GET /products/api/rows?limit=10&offset=0 Paginated rows
GET /products/api/name All values in column name
GET /orders/api Schema for all sheets
GET /orders/api/jan/rows All rows in sheet jan
GET /orders/api/jan/amount Column amount from sheet jan
GET /orders/api/jan/amount/0 Single cell: row 0, column amount, sheet jan

Supported Formats

Format Extension Multi-sheet
CSV .csv No
Excel .xlsx, .xls Yes
JSON .json Yes (object of arrays)

JSON format

Single sheet (array of objects):

[{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]

Multi-sheet (object of arrays):

{
  "users": [{"id": 1, "name": "Alice"}],
  "admins": [{"id": 99, "name": "Root"}]
}

Interactive Docs

Custom Swagger UI with chained dropdowns (File → Sheet → Column) available at http://localhost:3000/docs.

Deployment (VPS)

pip install flatapicli
flatapicli serve --dir /data/files --host 0.0.0.0 --port 3000

Run behind nginx or use a systemd service for production stability.

Contributing

TOON (Token-Oriented Object Notation) parser contributions welcome. Add a parser in flatapicli/parsers/ following the existing pattern and register it in flatapicli/parsers/__init__.py.

License

MIT

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

flatapicli-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

flatapicli-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file flatapicli-0.1.0.tar.gz.

File metadata

  • Download URL: flatapicli-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for flatapicli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3239b9137deae286f9b95437e80837c21abf202c09a58e6d93df23be7e1a59e1
MD5 97f7c6ec769295644f4bc2db191b9445
BLAKE2b-256 f60322d73641c2c0797bedab01bf811e495d80b0ec1a67854c23c659d731484f

See more details on using hashes here.

File details

Details for the file flatapicli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flatapicli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for flatapicli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35c0465f33fba89ad4377e45fe3986090c3dde3f2b5078adf3948233bc64b85b
MD5 65935968112d8e6605ae4445bb6554a5
BLAKE2b-256 53932fecea530ecdc0bf59344de1c2174348f2b79d8f7ffe956551a31cc75983

See more details on using hashes here.

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