https://github.com/roschaefer/auteon-saas
Demo application for apollo federation, Dgraph and GraphQL subscriptions
https://github.com/roschaefer/auteon-saas
Last synced: about 1 year ago
JSON representation
Demo application for apollo federation, Dgraph and GraphQL subscriptions
- Host: GitHub
- URL: https://github.com/roschaefer/auteon-saas
- Owner: roschaefer
- Created: 2021-11-17T16:06:19.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-22T08:48:22.000Z (over 4 years ago)
- Last Synced: 2025-02-07T05:29:22.882Z (over 1 year ago)
- Language: TypeScript
- Size: 110 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installation
Run:
```
docker-compose up --build
```
Wait for the Dgraph service to get up and running. Then:
```
curl -X POST localhost:4001/admin/schema --data-binary '@backend/src/gateway/dgraph/types.graphql'
```
## Keycloak
Open keycloak at http://localhost:5000. Default admin username and password is
`admin`.
Follow this tutorial to set up openid: https://developers.redhat.com/blog/2020/01/29/api-login-and-jwt-token-generation-using-keycloak
Get the public key to verify JWTs in the backend:
`Realm Settings` >> `Keys` >> `Public keys`
## Workaround runtime dependencies
The backend has a runtime dependency on Dgraph at the moment, so Dgraph must
expose a valid schema before the backend starts.
You can start individual docker services after you populated the schema with the
`curl` command from above:
```
docker-compose up dgraph keycloak
```
Then start the backend manually:
```
cd backend
npm install
npm run build
DGRAPH_ENDPOINT=http://localhost:4001/graphql JWT_PUBLIC_KEY="" yarn run start
```
## Usage
To get a valid JWT token that you can use as a HTTP Bearer token, run the
following command:
```bash
curl -L -X POST 'http://localhost:5000/auth/realms/master/protocol/openid-connect/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'scope=openid' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=' \
--data-urlencode 'username=' \
--data-urlencode 'password='
```