GraphQL

Write an awesome doc for GraphQL. A very nice an practical one extracted from GraphQL official documentation.

View on GitHub

Todo – backend

  1. nx g @nx/node:application apps/todo-backend --framework express.
  2. pnpm add graphql-http.
  3. touch apps/todo-backend/src/global.d.ts and then copy and paste what is written in this Stackoverflow answer. I wrote a post about declaration modules.
  4. The I started with writing my API’s schema in schema.graphql.
  5. Then I moved to define their resolver bodies.
  6. Initialize Prisma + PostgreSQL:

    1. nx add @nx-tools/nx-prisma.
    2. nx g @nx-tools/nx-prisma:configuration --project todo-backend --database postgresql.

      Learn more about @nx-tools/nx-prisma.

    3. Define my tables and used docker compose to have a postgres instance.
    4. Prepared service layer, and repository layer + seeding some data.
    5. Add docker compose related scripts in apps/todo-backend/project.json.
    6. Ran nx prisma-migrate todo-backend --name init to generate the migration files.
    7. Test Driven Development approach:
      1. Wrote E2E tests.
      2. Implement queries/mutations.