{"id":22533508,"url":"https://github.com/vectormike/improved-octo-eureka","last_synced_at":"2025-10-09T10:09:27.657Z","repository":{"id":174446343,"uuid":"652244558","full_name":"Vectormike/improved-octo-eureka","owner":"Vectormike","description":"Todo API with Auth, Prisma, GraphQL, PostgreSQL and Docker","archived":false,"fork":false,"pushed_at":"2023-06-11T16:33:16.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T10:09:26.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vectormike.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-11T14:46:17.000Z","updated_at":"2023-06-11T15:01:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc5d7654-db19-42b3-825c-18aae1946b9b","html_url":"https://github.com/Vectormike/improved-octo-eureka","commit_stats":null,"previous_names":["vectormike/improved-octo-eureka"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Vectormike/improved-octo-eureka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectormike%2Fimproved-octo-eureka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectormike%2Fimproved-octo-eureka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectormike%2Fimproved-octo-eureka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectormike%2Fimproved-octo-eureka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vectormike","download_url":"https://codeload.github.com/Vectormike/improved-octo-eureka/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectormike%2Fimproved-octo-eureka/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001324,"owners_count":26083040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T09:08:31.717Z","updated_at":"2025-10-09T10:09:27.641Z","avatar_url":"https://github.com/Vectormike.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instructions\n\n## Features\n\n- GraphQL w/ [playground](https://github.com/prisma/graphql-playground)\n- [Prisma](https://www.prisma.io/) for database modelling, migration and type-safe access (Postgres)\n- Docker [Docker](www.docker.com)\n- 🔐 JWT authentication w/ [passport-jwt](https://github.com/mikenicholson/passport-jwt)\n\n## Overview\n\nImplement a Node.js based GraphQL API for a Todo List\n\n### Description\n\nYour task is to implement a GraphQL API for a simple Todo List application using Node.js and the following libraries.\n\n- Nest JS as the Node.js framework\n- Prisma for database access, querying and migrations\n- Docker Compose so all services needed to run/test your submission can be setup easily\n\nThe API should support the following operations:\n\n- Create a new Todo item\n- Get a list of all Todo items\n- Get a specific Todo item by ID\n- Search the list of Todo items by title or description\n\nEach Todo item should have the following attributes:\n\n- `id`: a unique identifier for the Todo item\n- `title`: a short title for the Todo item (required)\n- `description`: a longer description of the Todo item (optional)\n- `completed`: a boolean indicating whether the Todo item is completed (default: false )\n\n## Prisma Setup\n\n### 1. Install Dependencies\n\nInstall [Nestjs CLI](https://docs.nestjs.com/cli/usages) to start and [generate CRUD resources](https://trilon.io/blog/introducing-cli-generators-crud-api-in-1-minute)\n\n```bash\nnpm i -g @nestjs/cli\n```\n\nInstall the dependencies for the Nest application:\n\n```bash\nnpm install\n```\n\n### 2. PostgreSQL with Docker\n\nSetup a development PostgreSQL with Docker. Copy [.env.example](./.env.example) and rename to `.env` - `cp .env.example .env` - which sets the required environments for PostgreSQL such as `POSTGRES_USER`, `POSTGRES_PASSWORD` and `POSTGRES_DB`. Update the variables as you wish and select a strong password.\n\nStart the PostgreSQL database\n\n```bash\nnpm run docker:db\n```\n\n### 3. Prisma Migrate\n\n[Prisma Migrate](https://github.com/prisma/prisma2/tree/master/docs/prisma-migrate) is used to manage the schema and migration of the database. Prisma datasource requires an environment variable `DATABASE_URL` for the connection to the PostgreSQL database. Prisma reads the `DATABASE_URL` from the root [.env](./.env) file.\n\n```bash\nnpm run migrate:dev\n```\n\n### 4. Prisma: Prisma Client JS\n\n[Prisma Client JS](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/api) is a type-safe database client auto-generated based on the data model.\n\nGenerate Prisma Client JS by running\n\n\u003e **Note**: Every time you update [schema.prisma](prisma/schema.prisma) re-generate Prisma Client JS\n\n```bash\nnpm run prisma:generate\n```\n\n### 5. Seed the database data with this script\n\nExecute the script with this command:\n\n```bash\nnpm run seed\n```\n\n### 6. Start NestJS Server\n\nRun Nest Server in Development mode:\n\n```bash\nnpm run start\n\n# watch mode\nnpm run start:dev\n```\n\n### 7. Run test server\n\n```bash\nnpm run test\n\n# watch mode\nnpm run test:watch\n```\n\nGraphQL Playground for the NestJS Server is available here: http://localhost:3000/graphql\n\n## GraphQL Playground\n\nOpen up the [example GraphQL queries](graphql/auth.graphql) and copy them to the GraphQL Playground. All queries and mutations are secured by an auth guard. You have to acquire a JWT token from `signup` or `login`. Add the `accessToken`as followed to **HTTP HEADERS** in the playground and replace `YOURTOKEN` here:\n\n```json\n{\n  \"Authorization\": \"Bearer YOURTOKEN\"\n}\n```\n\n## Rest Api\n\n[RESTful API](http://localhost:3000/api) documentation available with Swagger.\n\n## Docker\n\nNow to build a Docker image of the Nest server, simply run:\n\n```bash\ndocker build -t earnipay .\n```\n\nAfter Docker build your docker image you are ready to start up a docker container running the nest server:\n\n```bash\ndocker run -d -t -p 3000:3000 --env-file .env earnipay\n```\n\nNow open up [localhost:3000](http://localhost:3000) to verify that your nest server is running.\n\nWhen you run your NestJS application in a Docker container update your [.env](.env) file\n\n```diff\n- DB_HOST=localhost\n# replace with name of the database container\n+ DB_HOST=postgres\n\n# Prisma database connection\n+ DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}?schema=${DB_SCHEMA}\u0026sslmode=prefer\n```\n\n### Docker Compose\n\nYou can also setup a the database and Nest application with the docker-compose\n\n```bash\n# building new NestJS docker image\nnpm run docker:build\n\n# start docker-compose\nnpm run docker\n```\n\n## Schema Development\n\nUpdate the Prisma schema `prisma/schema.prisma` and after that run the following two commands:\n\n```bash\nnpx prisma generate\n# or in watch mode\nnpx prisma generate --watch\n# or\nnpm run prisma:generate\nnpm run prisma:generate:watch\n```\n\n**[⬆ back to top](#overview)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvectormike%2Fimproved-octo-eureka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvectormike%2Fimproved-octo-eureka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvectormike%2Fimproved-octo-eureka/lists"}