Documentation Index
Fetch the complete documentation index at: https://docs.pyqdeck.in/llms.txt
Use this file to discover all available pages before exploring further.
Overview
PyqDeck uses an API-first approach where the backend defines the contract, and the frontend consumes it through a generated, type-safe SDK. This eliminates manualfetch calls, ensures type safety, and prevents API drift.
How It Works
1. OpenAPI Spec Generation
Backend routes are documented with JSDoc@swagger annotations. The openapi:export script processes these annotations and outputs backend/openapi.json.
2. SDK Generation
The frontend’sgen:api script orchestrates the full pipeline:
- Runs
openapi:exportin the backend to regenerate the spec - Uses
swagger-typescript-apito generate a TypeScript client - Outputs to
frontend/src/lib/api-generated.ts
api-generated.ts - it will be overwritten on the next run.
3. Using the SDK in React
The generated client is wrapped in a React hook that handles authentication:4. Example Usage in Components
API Contract Enforcement
The CI pipeline ensures the OpenAPI spec stays in sync:- Backend tests run
- CI verifies
openapi.jsonhasn’t drifted - Frontend build runs
gen:apito validate SDK generation - If any step fails, the PR is blocked
- Backend changes are always reflected in the API spec
- Frontend always has an up-to-date SDK
- No manual API client bugs or type mismatches
Available Endpoints
The generated SDK includes all backend endpoints. Here are the main groups:| Group | Base Path | Description |
|---|---|---|
| Health | /health | API health checks |
| Universities | /universities | University management |
| Branches | /branches | Branch/semester management |
| Subjects | /subjects | Subject catalog |
| Papers | /papers | Exam papers |
| Questions | /questions | Individual questions |
| Solutions | /solutions | Question solutions |
| Bookmarks | /bookmarks | User bookmarks |
| Search | /search | Full-text search |
| Upload | /uploadthing | File uploads |
Adding New Endpoints
When adding a new backend endpoint:- Add JSDoc annotations to the route file
- Run
openapi:exportto update the spec - Run
gen:apiin the frontend to regenerate the SDK - Use the new method via
useApi()in your components
Next Steps
- Learn about our testing standards
- Explore the monorepo architecture
- Dive into the auth flow

