Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tdolsen/edgedb-nestjs-example
Simple example of configuring a NestJS application to use EdgeDB (and a bespoke GraphQL API).
https://github.com/tdolsen/edgedb-nestjs-example
docker edgedb edgeql graphql nestjs typescript
Last synced: 2 months ago
JSON representation
Simple example of configuring a NestJS application to use EdgeDB (and a bespoke GraphQL API).
- Host: GitHub
- URL: https://github.com/tdolsen/edgedb-nestjs-example
- Owner: tdolsen
- License: unlicense
- Created: 2022-05-01T23:29:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-25T08:29:19.000Z (about 2 years ago)
- Last Synced: 2024-08-02T06:14:08.816Z (5 months ago)
- Topics: docker, edgedb, edgeql, graphql, nestjs, typescript
- Language: TypeScript
- Homepage:
- Size: 95.7 KB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-edgedb - EdgeDB + NestJS - A NestJS application that uses EdgeDB and exposes a GraphQL API. (Applications)
README
# NestJS + EdgeDB
## Setup
1. `edgedb project init`
2. `yarn install`
3. `yarn generate:edgeql`
4. `yarn dev`
5. Server should now be running!## GraphQL
This example uses the `@nestjs/graphql` module, setting up it's own GraphQL endpoint at [localhost:3000/graphql](https://localhost:3000/graphql).
## Generated code path mapping
- `tsconfig.compilerOptions.paths` ensures `generated/edgeql` is available in sources with imports from `~/edgeql`.
- The generated code is placed outside of `src`.
- It proved more convenient when having to commit the generated code into the repo (of the project making the basis for this example).
- Specifically for the purpose of building Docker images in CI.
- And without having a running EdgeDB instance to introspect.
- Child paths immediately inside `src/*` are also available from `~/*`, so beware of conflicts; eg.:
- `~/edgedb` refers to `src/edgedb`
- `~/edgeql` refers to `generated/edgeql`## Docker
Also included in this repo are two `Dockerfile`s (API + EdgeDB), as well as a `docker-compose.yml` configuration for building and instantiating them.
- Simply running `docker-compose up -d` should do the trick.
- Then `docker-compose build` to rebuild upon any changes you make to the code.