https://github.com/manosbatsis/restdude
Full stack, high level framework for horizontal, model-driven application hackers.
https://github.com/manosbatsis/restdude
Last synced: 6 months ago
JSON representation
Full stack, high level framework for horizontal, model-driven application hackers.
- Host: GitHub
- URL: https://github.com/manosbatsis/restdude
- Owner: manosbatsis
- Created: 2016-10-21T07:29:24.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-28T00:38:24.000Z (about 2 years ago)
- Last Synced: 2025-03-26T03:33:12.169Z (7 months ago)
- Language: JavaScript
- Homepage: https://manosbatsis.github.io/restdude
- Size: 58.3 MB
- Stars: 4
- Watchers: 4
- Forks: 4
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Restdude
[](https://travis-ci.org/manosbatsis/restdude)
Full stack, high level framework for horizontal, model-driven application hackers.
## Technology Stack
- Choose between Spring MVC or Spring Boot
- Support a [3rd level](https://martinfowler.com/articles/richardsonMaturityModel.html#level3) RESTful API out of the box with [HATEOAS](https://en.wikipedia.org/wiki/HATEOAS)
- Allow clients to use plain model-based REST or [JSON API 1.x](http://jsonapi.org/format)
- Enjoy effortless, model-driven search endpoints with sorting, paging and dynamic criteria support for simple URL params or [RSQL/FIQL](https://manosbatsis.github.io/restdude/rsql.html)
- Use a 3-tier architecture without the boilerplate with [restdude-mdd](restdude-mdd)
- Annotate your models to configure API documentation, authorization, validation and auditing
- Sleep better with built-in [error-management](restdude-error)
- Customize and integrate according to your needs with Spring Security
- Interact with your users via websockets and STOMP
- Persist to relational databases with JPA
- Free your persisted data structures with ElasticSearch, Solr, MongoDB, Redis, Cassandra, Counchbase, Neo4J, Hazelcast and more
- Automate basic or fine grained auditing using Envers and Javers
- Publish REST API documentation effortlesly thanks to Springfox and Swagger UI
- Optional web UI and admin panel provided out-of the-box based on bootstrap 4, backbone.marionette, core-UI, requirejs and more.
- Coming up:
- Support for json-ld and hydra via model annotations.
- Dynamic CORS with fine-grained settings down to entity model records
- Support for JWT (JSON Web Token)## Why?
Contrary to other frameworks that squeeze everything within two (i.e. Controller, Repository) or even a single tier, restdude provides effortless SCRUD services by generating controller, service and repository components
for you classes during application startup.This provides an extensible 3-tier architecture without any need for boilerplate code and allows to replace and extend the generated components with your own at any time when custom or
otherwise additional functionality is needed.Besides automating SCRUD, restdude provides other conveniences with a focus on hypermedia, like dynamic generation of HATEOAS/JSON-API links and controller request mappings
based on entity model relationships.## Example Model
```java
@Entity
@Table(name = "host")
@ModelResource(
path = "hosts",
apiName = "Hosts",
apiDescription = "Operations about hosts")
public class Host extends AbstractSystemUuidPersistable {@NotNull
@Column(name = "name", nullable = false, unique = true)
private String name;@NotNull
@Column(name = "description", length = 500, nullable = false)
private String description;@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "country_id", referencedColumnName = "id")
private Country country;
@OneToMany(mappedBy = "host")
private List sites;
// other properties, getters/setters etc.
}
```-
### Generated Components
Based on the above model, restdude will generate any missing components like a `Controller`, `Service` and `Repository`
to give you the following architecture without the need for boilerplate code. You can replace or extend those with your
custom components at any time.
+-------------------------+ +---------------------+ +------------------+
Browser, App, | RESTful SCRUD | | Content negotiation | | Websockets |
or other Client +-------------+-----------+ +-----------+---------+ +-------+----------+
| | |
--------------------------------- | ------------------------- | ------------------- | -----------
| | |
JSON+HATEOAS or JSON-API 1.x | |
Network with RSQL/FIQL or URL params | STOMP
| | |
| | |
--------------------------------- | ------------------------- | ------------------- | -----------
| | |
+-------------+---------------------------+----------+ +-------+----------+
| HostController +--+ Message Broker |
+--------------------------+-------------------------+ +-------+----------+
| |
Restdude | |
+--------------------------+------------------------------------+----------+
| HostService |
+--------+--------------------+---------------------+---------------+------+
| | | |
| | | |
+--------+-------+ +----------+-----------+ +-------+-------+ +-----+------+
| HostRepository | | FileService (FS, S3) | | EmailService | | Misc Util |
+----------------+ +----------------------+ +---------------+ +------------+
### Generated Services
Some of the RESTful services provided out of the box for the above model:
Method | Path | Description
------------ | ------- | -------------------
GET | /api/rest/hosts/{id} | Fetch the host matching the id
GET | /api/rest/hosts/{id}/relationships/country | Fetch the country of the host matching the id
GET | /api/rest/hosts/{id}/relationships/sites | Search the sites of the host matching the id, see search endpoints bellow for filtering etc (paged)
GET | /api/rest/hosts?country.code=GR&name=%25startsWith | Search based on model properties using simple URL params (paged)
GET | /api/rest/hosts?filter=country.code=in=(GR,UK);name==%25startsWith | Search based on model properties using [RSQL or FIQL](https://manosbatsis.github.io/restdude/rsql.html) (paged)
POST | /api/rest/hosts | Create a new host
PUT | /api/rest/hosts/{id} | Update the host matching the id
PATCH | /api/rest/hosts/{id} | Partially update the host matching the id
DELETE | /api/rest/hosts/{id} | Delete the host matching the id
GET | /api/rest/hosts/jsonschema | Get the JSONSchema for hostsThe endpoints support the following content types:
- `application/json` and `application/hal+json` for HATEOAS Resource response and plain JSON request bodies, with both being based on model structure
- `application/vnd.api+json` for [JSON-API](http://jsonapi.org/format)-compliant request/response bodies## Documentation
See https://manosbatsis.github.io/restdude/
## License
Restdude is distributed under the GNU Lesser General Public License![]()