Create a full-featured REST/GraphQL API from a configuration file.
Development status
This project is still in active development, and is not ready for production. Key features are currently missing.
If you want to follow our progress in the meantime, you are welcome to star this repository.
Overview
Create a simple configuration file describing your data model:
engine: 0collections: users: description: User of the API attributes: id: type: string age: type: integer score: type: number alias: high_score default: 10 validate: minimum: 20 reports: type: reports[] reports: attributes: id: type: string content: type: string default: database: mongodbdatabases: mongodb: hostname: localhost password: secret_mongodb_password dbname: my_database_nameprotocols: http: port: 5001
Then start a full-featured web API.
$ autoserver
Clients will now be able to perform GraphQL requests:
{ find_users( filter: { score: { _gt: 100 } } order: "score" ) { id age score reports: { content } }}
Or REST requests:
GET /rest/users/?filter.score._gt=100&order=score&populate=reports
Features
- Multiple RPC systems, including REST, GraphQL and JSON-RPC
- GraphQL debugging, including introspection, interactive debugger and GraphQL schema printing
- Multiple databases support, including MongoDB and an in-memory database. Different databases can be used at the same time.
- Multiple protocols handling, with support for HTTP/1.1 only at the moment
- Multiple formats support for the configuration files, the client request payloads and the server responses, including JSON, YAML, x-www-form-urlencoded, JavaScript, Hjson, JSON5 and INI
- automatic logging and performance monitoring
- extensive error handling and reporting
- CRUD commands: find, create, patch, upsert, delete. Each command can be performed on a single model or on several models.
- Advanced mutations like incrementing, regular expression replacement, cross-attributes mutations, slicing, etc.
- relations, nested commands and populating between models, including for mutations
- filtering
- sorting
- selecting
- renaming attributes
- pagination
- input validation
- authorization, including readonly attributes
- default values
- computed attributes and normalization
- aliases
- automatic attributes:
created_time
,updated_time
,created_by
,updated_by
- compression of both the response and the request, for any protocol. Brotli support.
- dry runs
- silent outputs
- plugins
- custom logic can be added in JavaScript
Documentation
The documentation is here.
Badge
The following badge can be added to your project:
[](https://github.com/ehmicky/autoserver)
Contribute
See the developer's documentation.