• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
jonmaim

jonmaim

flashcard

anki-style flash cards
Public
Like
flashcard
Home
Code
10
backend
4
frontend
3
shared
2
.vtignore
AGENTS.md
ARCHITECTURE.md
GETTING_STARTED.md
README.md
deno.json
main.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
backend
/
README.md
Code
/
backend
/
README.md
Search
11/11/2025
Viewing readonly version of main branch: v32
View latest version
README.md

Backend

This directory contains the server-side code for the Flashcard Learning App.

Structure

  • index.ts - Main Hono app setup, route mounting, and static file serving
  • storage.ts - Blob storage utilities for user data persistence
  • routes/ - API endpoint implementations

Routes

auth.ts

  • Handles user login and initialization
  • Creates new user data if doesn't exist

decks.ts

  • CRUD operations for flashcard decks
  • Cascade deletion of cards when deck is deleted

cards.ts

  • CRUD operations for flashcards
  • Validates deck existence before card creation

study.ts

  • Fetches due cards based on spaced repetition
  • Processes card reviews and updates SM-2 parameters

stats.ts

  • Retrieves user statistics
  • Saves completed study sessions

backup.ts

  • Exports user data as JSON
  • Imports user data from JSON backup

Key Patterns

Authentication

All routes (except login) require X-Username header for user identification.

Error Handling

Hono's onError is configured to throw errors for full stack traces.

Data Flow

  1. Load user data from blob storage
  2. Perform in-memory operations
  3. Save back to blob storage

Adding New Routes

  1. Create new file in routes/
  2. Export a Hono instance
  3. Mount in index.ts with app.route()
  4. Add X-Username header check if needed
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.