Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ehmicky/autoserver
Create a full-featured REST/GraphQL API from a configuration file
https://github.com/ehmicky/autoserver
api baas cli database deployment es6 framework graphql http javascript json json-rpc library minotoring mongodb nodejs rest-api server serverless yaml
Last synced: 4 days ago
JSON representation
Create a full-featured REST/GraphQL API from a configuration file
- Host: GitHub
- URL: https://github.com/ehmicky/autoserver
- Owner: ehmicky
- License: apache-2.0
- Created: 2017-09-06T11:51:32.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-11-27T19:30:30.000Z (16 days ago)
- Last Synced: 2024-12-04T21:02:49.613Z (8 days ago)
- Topics: api, baas, cli, database, deployment, es6, framework, graphql, http, javascript, json, json-rpc, library, minotoring, mongodb, nodejs, rest-api, server, serverless, yaml
- Language: JavaScript
- Homepage:
- Size: 23 MB
- Stars: 205
- Watchers: 12
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-list - autoserver - featured REST/GraphQL API from a configuration file | ehmicky | 191 | (JavaScript)
- awesome-starred - ehmicky/autoserver - Create a full-featured REST/GraphQL API from a configuration file (serverless)
README
[![Node](https://img.shields.io/badge/-Node.js-808080?logo=node.js&colorA=404040&logoColor=66cc33)](https://www.npmjs.com/package/autoserver)
[![Mastodon](https://img.shields.io/badge/-Mastodon-808080.svg?logo=mastodon&colorA=404040&logoColor=9590F9)](https://fosstodon.org/@ehmicky)
[![Medium](https://img.shields.io/badge/-Medium-808080.svg?logo=medium&colorA=404040)](https://medium.com/@ehmicky)Create a full-featured REST/GraphQL API from a configuration file.
# Hire me
Please
[reach out](https://www.linkedin.com/feed/update/urn:li:activity:7117265228068716545/)
if you're looking for a Node.js API or CLI engineer (11 years of experience).
Most recently I have been [Netlify Build](https://github.com/netlify/build)'s
and [Netlify Plugins](https://www.netlify.com/products/build/plugins/)'
technical lead for 2.5 years. I am available for full-time remote positions.# Development status
This project is still in active development, and is not ready for production.
[Key features](docs/dev/ROADMAP.md) 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](docs/server/configuration/configuration.md#configuration-file)
describing your data model:```yml
engine: 0
collections:
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: mongodb
databases:
mongodb:
hostname: localhost
password: secret_mongodb_password
dbname: my_database_name
protocols:
http:
port: 5001
```Then start a full-featured web API.
```bash
$ autoserver
```Clients will now be able to perform [GraphQL](docs/client/rpc/graphql.md)
requests:```graphql
{
find_users(
filter: { score: { _gt: 100 } }
order: "score"
) {
id
age
score
reports: { content }
}
}
```Or [REST](docs/client/rpc/rest.md) requests:
```HTTP
GET /rest/users/?filter.score._gt=100&order=score&populate=reports
``````json
{
"data": [
{
"id": "15",
"age": 32,
"score": 150,
"reports": { "id": "65", "content": "..." }
},
{
"id": "251",
"age": 24,
"score": 168,
"reports": { "id": "67", "content": "..." }
},
{
"id": "7",
"age": 51,
"score": 192,
"reports": { "id": "10", "content": "..." }
}
]
}
```# Features
- [Multiple RPC systems](docs/client/rpc/README.md), including
[REST](docs/client/rpc/rest.md), [GraphQL](docs/client/rpc/graphql.md) and
[JSON-RPC](docs/client/rpc/jsonrpc.md)
- [GraphQL debugging](docs/client/rpc/graphql.md), including introspection,
interactive debugger and GraphQL schema printing
- [Multiple databases](docs/server/databases/README.md) support, including
[MongoDB](docs/server/databases/mongodb.md) and an
[in-memory database](docs/server/databases/memorydb.md). Different databases
can be used at the same time.
- [Multiple protocols](docs/client/protocols/README.md) handling, with support
for [HTTP/1.1](docs/server/protocols/http.md) only at the moment
- [Multiple formats](docs/client/protocols/formats.md) support for the
configuration files, the client request payloads and the server responses,
including [JSON](docs/client/protocols/formats.md#json),
[YAML](docs/client/protocols/formats.md#yaml),
[x-www-form-urlencoded](docs/client/protocols/formats.md#x-www-form-urlencoded),
[JavaScript](docs/server/configuration/formats.md#javascript),
[Hjson](docs/client/protocols/formats.md#hjson),
[JSON5](docs/client/protocols/formats.md#json5) and
[INI](docs/client/protocols/formats.md#ini)
- automatic [logging](docs/server/quality/logging.md) and
[performance monitoring](docs/server/quality/logging.md#performance-monitoring)
- extensive
[error handling and reporting](docs/server/usage/error.md#exceptions)
- [CRUD commands](docs/client/request/crud.md): find, create, patch, upsert,
delete. Each command can be performed on a single model or on several models.
- [Advanced mutations](docs/client/request/patch.md) like incrementing, regular
expression replacement, cross-attributes mutations, slicing, etc.
- [relations, nested commands](docs/client/request/relations.md) and populating
between models, including for mutations
- [filtering](docs/client/arguments/filtering.md)
- [sorting](docs/client/arguments/sorting.md)
- [selecting](docs/client/arguments/selecting.md)
- [renaming attributes](docs/client/arguments/renaming.md)
- [pagination](docs/client/arguments/pagination.md)
- [input validation](docs/server/data_model/validation.md#data-validation)
- [authorization](docs/server/data_model/authorization.md), including
[readonly](docs/server/data_model/authorization.md#readonly-attributes)
attributes
- [default values](docs/server/data_model/default.md)
- [computed attributes and normalization](docs/server/data_model/transformation.md)
- [aliases](docs/server/data_model/compatibility.md#aliases)
- automatic attributes:
[`created_time`, `updated_time`](docs/server/plugins/timestamp.md),
[`created_by`, `updated_by`](docs/server/plugins/author.md)
- [compression](docs/client/arguments/compression.md) of both the response and
the request, for any protocol. [Brotli](https://en.wikipedia.org/wiki/Brotli)
support.
- [dry runs](docs/client/arguments/dryrun.md)
- [silent outputs](docs/client/arguments/silent.md)
- [plugins](docs/server/plugins/README.md)
- [custom logic](docs/server/configuration/functions.md) can be added in
JavaScript# Documentation
The documentation is [here](docs/README.md).
# Badge
The following badge can be added to your project:
[![autoserver](https://img.shields.io/badge/auto-server-406890.svg?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWx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TE5LjMzNSA1MS4xOTgsLTI5LjAyOSAxMi45NzQsLTcuMzggMjYuMDE5LC0xNC42MzMgMzguODUyLC0yMi4yNTYgMTAuNzkzLC02LjQyNiAxMC43NjQsLTE1Ljc0IDAuMDUyLC0yMi40NzcgeiIgLz4KPC9nPgo8L3N2Zz4=)](https://github.com/ehmicky/autoserver)```markdown
[![autoserver](https://img.shields.io/badge/auto-server-406890.svg?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIKICAgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNDU5IDQ1OSIKICAgdmlld0JveD0iMCAwIDQwNS4yMjY5OSA0MDUuMjI4IgogICBoZWlnaHQ9IjQwNS4yMjgiCiAgIHdpZHRoPSI0MDUuMjI2OTkiCiAgIHk9IjBweCIKICAgeD0iMHB4IgogICBpZD0iTGF5ZXJfMSIKICAgdmVyc2lvbj0iMS4xIj48bWV0YWRhdGEKICAgaWQ9Im1ldGFkYXRhMTA4NSI+PHJkZjpSREY+PGNjOldvcmsKICAgICAgIHJkZjphYm91dD0iIj48ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD48ZGM6dHlwZQogICAgICAgICByZGY6cmVzb3VyY2U9Im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