How bengaudry/studyswipe works
Studyswipe is a flashcard study application. Its principal workflow is organizing collections and decks, creating or generating cards, then studying a deck. The graph separates collection/deck management, card authoring and study, AI generation, and shared identity/data services. Relationships are limited to calls or imports visible in excerpts or the source index; several page-to-API and subscription details are not sampled, so they are not asserted.
Main entry points: route.ts Generation endpoint · session.ts Session service · prisma.ts Application database · page.tsx My collections
Components 33
Collections and decks
- My collections
src/app/(layout)/(authguarded)/collections/page.tsx - Public collections
src/app/(layout)/collections/[username]/page.tsx - Discover decks
src/app/(layout)/discover/page.tsx - Collection controls
src/components/pages/collections/CollectionOptionsDropdown.tsx - New collection
src/components/pages/collections/NewCollectionModal.tsx - Deck link
src/components/pages/collections/DeckLink.tsx - Deck controls
src/components/pages/deck/DeckOptionsDropdown.tsx
Card authoring
- Deck editor
src/components/pages/deck/DeckPageBody.tsx - Card composer
src/components/pages/deck/NewCardModal.tsx - Authoring tools
src/components/pages/deck/ToolSelector.tsx - Card preview
src/components/pages/deck/CardPreview.tsx - Image upload
src/hooks/useSupabaseImageUpload.tsx
Study experience
- Study deck page
src/app/(layout)/play/[deckid]/page.tsx - Study progress
src/components/pages/play/PlayerContext.tsx
AI generation
- Generation client
src/hooks/useAiCardGeneration.ts - Generation endpoint
src/app/api/generate-flashcards/route.ts - Prompt templates
src/lib/generationPrompts.ts - Output schemas
src/lib/aiSchemas.ts - Model access rules
src/lib/aiModels.ts
Identity and data
- Account holder
- Auth hook
src/hooks/useAuth.ts - Auth endpoint
src/app/api/auth/route.ts - Session service
src/lib/session.ts - Collection API
src/app/api/collection/route.ts - Deck API
src/app/api/deck/route.ts - Card API
src/app/api/card/route.ts - Bulk card import
src/app/api/fill/route.ts - Application database
src/lib/prisma.ts - Usage counter
src/lib/redis.ts - Subscription pages
src/app/(layout)/(authguarded)/subscription/page.tsx - Stripe webhook
src/app/api/webhooks/stripe/route.ts
Other components
- Learner
- Stripe
Connections 33
- Learner → My collections: opens
README.md - Learner → Discover decks: browses
README.md - Learner → Study deck page: studies
README.md - My collections → New collection: renders
src/app/(layout)/(authguarded)/collections/page.tsx - My collections → Deck link: renders
src/app/(layout)/(authguarded)/collections/page.tsx - My collections → Collection controls: renders
src/app/(layout)/(authguarded)/collections/page.tsx - My collections → Deck controls: renders
src/app/(layout)/(authguarded)/collections/page.tsx - Deck link → Card preview: uses
src/components/pages/collections/DeckLink.tsx - Card composer → Generation client: calls
src/components/pages/deck/NewCardModal.tsx - Card composer → Authoring tools: renders
src/components/pages/deck/NewCardModal.tsx - Card composer → Image upload: uses
src/components/pages/deck/NewCardModal.tsx - Generation client → Generation endpoint: posts
src/hooks/useAiCardGeneration.ts - Generation endpoint → Session service: authenticates
src/app/api/generate-flashcards/route.ts - Generation endpoint → Output schemas: validates output
src/app/api/generate-flashcards/route.ts - Generation endpoint → Model access rules: checks access
src/app/api/generate-flashcards/route.ts - Generation endpoint → Prompt templates: uses prompts
src/app/api/generate-flashcards/route.ts - Generation endpoint → Usage counter: counts usage
src/app/api/generate-flashcards/route.ts - Generation endpoint → Application database: reads and writes
src/app/api/generate-flashcards/route.ts - Auth hook → Auth endpoint: fetches session
src/hooks/useAuth.ts - Auth endpoint → Session service: checks session
src/app/api/auth/route.ts - Session service → Application database: loads user
src/lib/session.ts - Collection API → Session service: authenticates
src/app/api/collection/route.ts - Collection API → Application database: reads and writes
src/app/api/collection/route.ts - Deck API → Session service: authenticates
src/app/api/deck/route.ts - Deck API → Application database: reads and writes
src/app/api/deck/route.ts - Card API → Session service: authenticates
src/app/api/card/route.ts - Card API → Application database: reads and writes
src/app/api/card/route.ts - Bulk card import → Session service: authenticates
src/app/api/fill/route.ts - Bulk card import → Application database: reads and writes
src/app/api/fill/route.ts - Study deck page → Study progress: provides study state
- Account holder → Subscription pages: manages plan
README.md - Stripe webhook → Application database: updates records
src/app/api/webhooks/stripe/route.ts - Stripe → Stripe webhook: sends events