This is a fullstack GraphQL + React setup that includes:
- A custom JWT authentication system (via HTTP-only cookies)
- A GraphQL API with filtering and sorting on products
- A React frontend with Apollo Client and Tailwind CSS
- TypeScript on both frontend and backend
- Backend: Express, Apollo Server, JWT, bcrypt
- Frontend: React, Apollo Client, Tailwind CSS
- GraphQL everywhere
- Cookies for auth (httpOnly)
Make sure you have:
- Node.js (v16 or higher)
- npm or yarn
git clone https://github.com/coderomm/goliath-assignment.git
cd goliath-assignmentcd backend
npm installMake a .env file in the root of backend:
JWT_SECRET=your_super_secret_key
NODE_ENV=development(You can also check .env.example)
npm run devGraphQL playground should be available at http://localhost:4000/graphql
cd ../frontend
npm installMake a .env file in the root of frontend:
VITE_GQL_API='http://localhost:4000/graphql'(You can also check .env.example)
npm startThe app should open at http://localhost:5173
Try these credentials:
Email: admin@example.com
Password: admin123Or:
Email: user@example.com
Password: user123- Login → backend verifies → JWT sent via cookie
- Authenticated requests auto-include the cookie
- Logout clears the cookie
- Filter by category, price range, stock
- Sort by name, category, price, stock
npm run dev # run with ts-node
npm run build # compile to dist
npm start # run compiled dist/index.jsnpm start # React dev serverapp/
├── backend/
│ ├── src/
│ │ └── index.ts
│ ├── .env
│ ├── package.json
│ └── tsconfig.json
└── frontend/
├── src/
│ ├── App.tsx
│ ├── index.tsx
│ └── index.css
├── tailwind.config.js
├── package.json
└── .env