Grid

Connect to any MySQL, PostgreSQL, or SQLite database to automatically expose your table schemas as secure, type-safe REST endpoints.

Database API

From database to REST API with a single command

Fusio Grid turns an existing MySQL/MariaDB, PostgreSQL or SQLite database into a secure REST API, similar to tools like PostgREST. It reads your database schema and creates schemas, actions and CRUD operations for every table.

Because everything is generated as regular Fusio entities, you can edit the result in the Fusio backend and get all gateway features like authentication, rate limiting, OpenAPI and SDK generation on top. Once your requirements grow beyond plain CRUD, you can extend every operation with custom logic, there is no lock-in.

Headless setup
# expose the ecommerce database under /ecommerce
php bin/fusio grid:setup ecommerce \
  --driver=pdo_mysql \
  --host=127.0.0.1 \
  --dbname=ecommerce_prod \
  --user=db_user \
  --password=secret_pass \
  --prefix=app_ \
  --no-interaction

# or let the command guide you interactively
php bin/fusio grid:setup

Key features

Skip the boilerplate and get a production-ready API for your existing data in minutes.

Instant REST endpoints

Full CRUD endpoints (GET, POST, PUT, DELETE) for every table under /{connection}/{table}.

Type-safe schemas

Columns, types and nullability are reflected into TypeSchema definitions which validate all incoming requests.

Pagination, filtering & sorting

Collection endpoints support paging, sorting and filtering through query parameters out of the box.

Secure by default

All generated operations are private. Access is controlled through API keys, OAuth2 scopes, rate limits and logging.

OpenAPI & SDKs

Generate an OpenAPI specification or client SDKs for TypeScript, PHP, Python, Java, Go, C# and more.

CI/CD friendly

Configure everything through terminal prompts or headless via CLI options, i.e. inside a Docker entrypoint. Re-runs pick up new tables and keep your changes.

The generated API

For a connection named inventory with an items table, Grid creates the following operations:

Method Path Operation Description
GET/inventory/itemsinventory.items.getAllList rows (paginated)
GET/inventory/items/:idinventory.items.getFetch a row by primary key
POST/inventory/itemsinventory.items.createCreate a row
PUT/inventory/items/:idinventory.items.updateUpdate a row by primary key
DELETE/inventory/items/:idinventory.items.deleteDelete a row by primary key

Collection query parameters

  • startIndex / count – offset and number of rows to return
  • sortBy / sortOrder – column and direction (ASC or DESC)
  • filterBy / filterValue – column and value to filter on
  • filterOp – contains, equals, startsWith or present
GET /inventory/items?count=2&sortBy=name&filterBy=name&filterOp=contains&filterValue=chair

{
  "totalResults": 12,
  "itemsPerPage": 2,
  "startIndex": 0,
  "entry": [
    {"id": 3, "name": "Arm chair", "price": 199.9},
    {"id": 7, "name": "Office chair", "price": 249}
  ]
}
SHA1 dfe8502080cba0dd700504d41e3ee0c1f0511742