A ready to use local development environment for Dgraph project
- Schema Hot Reload
- Lambda Script Hot Reload
- Multi-Schema Support
- All Logs are shown together
- Ready-To-Use Pipeline that contains[install, lint, test, schema validation]
For using this feature put schema.graphql
in gitignore
and start creating files with .graphql
in src
folder. Then if you run npm run start:dev
with each change in one of these files it starts merging them into one file: schema.graphql
. This file should exists in working directory.
First install the packages:
npm install
and then all you need to do is to run this command in project folder:
npm run start:dev
It is nodejs script that does these things:
- In case this is the first time you are running it, it creates a empty
bundle.js
file so Lambda container does not fail. - It runs
docker compose up
and onealpha
, onezero
, onelambda
is going to start running detached. - Deploy Schema(schema.graphql)
- Bundle Typescript files in
src
folder - Watch changes of
schema.graphql
to Redeploy Schema with each change. - Watch changes in
*.graphql
files insrc
folder in merge these files and overwritesschema.graphql
- Watch changes in
src
folder and run webpack to create Javascript Bundle. - Show you logs of all Docker Containers.
- Dgraph Lambda Version:
Dgraph@v22
- Javascript Bundle file is created in
dist/bundle.js
and mounted to the docker container I have used for this project and this version needs external lambda container. - Prettier as Formatter: prettier
- ESLint as Linter : eslint
- Bundling with Webpack 5: webpack 5.
- Ratel:9000 use
localhost:9000
for accessing ratel and executing dql commands. - Alpha:8080,9080,8000 these ports are mapped to alpha container
- Zero:5080,6080 these ports are mapped to zero container
- Lambda:8686 these ports are mapped to lambda container
You can send graphql requests to this address: http://localhost:8080/graphql
On Ratel set Dgraph server URL to: http://localhost:8080
- How to use Authentication
- How to use Lambda Scripts
Feel free to open issues and pull requests.