This is a minimal GraphQL API built with Node.js, Express, Apollo Server, and TypeScript.
It stores data in a local JSON file (data.json) and supports authentication using JWT tokens.
- Register and login with hashed passwords
- Issue and verify JWT tokens
- Authenticated CRUD operations on user-linked jobs
- All data persisted to
data.jsonlocally - Clean GraphQL schema and resolver structure
- Node.js + TypeScript
- Express + Apollo Server (GraphQL)
bcryptjsfor password hashingjsonwebtokenfor authentication- Local file-based persistence (
fs)
.
├── src/
│ ├── index.ts # Entry point with Apollo + Express
│ ├── schema.ts # GraphQL schema and resolvers
│ ├── auth.ts # Token generation and verification
│ ├── types.ts # TypeScript types (User, Job)
│ ├── data.json # Local JSON data store
│ └── examples.graphql # Sample operations for testing
├── package.json
├── tsconfig.json
└── README.md
npm installnpm run devhttp://localhost:4000/graphql
Login or register returns a token. Use it in requests as:
Authorization: Bearer <your-token-here>Set this in Apollo Sandbox or your frontend headers.
See src/examples.graphql for full usage:
- Register 2 users
- Login
- Create, update, delete jobs
- Query users and jobs
You can use:
- Apollo Sandbox
- Postman (GraphQL tab)
- VS Code GraphQL extensions
MIT License