FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
damonb
damonbreact-hono-with-react-router
Remix of stevekrouse/react-hono-with-react-router
Unlisted
Like
react-hono-with-react-router
Home
Code
4
backend
3
frontend
3
.vtignore
README.md
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
/
internal
/
storage
/
README.md
Code
/
backend
/
internal
/
storage
/
README.md
Search
6/29/2025
Viewing readonly version of main branch: v76
View latest version
README.md

Dish Storage with SQLite

This module provides SQLite storage for the Dish type using Valtown's SQLite functionality.

Table Structure

The dishes table has the following schema:

CREATE TABLE dishes ( id TEXT PRIMARY KEY, name TEXT NOT NULL, components TEXT NOT NULL );
  • id: Unique identifier for the dish (UUID)
  • name: Name of the dish
  • components: JSON string containing an array of component objects with id and name fields

Usage

Migration

The migration runs automatically when the module is imported. It creates the table if it doesn't exist.

API Endpoints

  • POST /api/dishes - Create or update a dish
  • GET /api/dishes - Get all dishes
  • GET /api/dishes/:id - Get a specific dish by ID
  • DELETE /api/dishes/:id - Delete a dish by ID

Example Dish Object

{ id: "123e4567-e89b-12d3-a456-426614174000", name: "Caesar Salad", components: [ { id: "comp-1", name: "Romaine Lettuce" }, { id: "comp-2", name: "Parmesan Cheese" }, { id: "comp-3", name: "Croutons" } ] }

Storage Functions

  • storeDish(dish: Dish) - Store a single dish
  • storeDishes(dishes: Dish[]) - Bulk store multiple dishes
  • getDish(id: UUID) - Retrieve a dish by ID
  • getDishes(ids: UUID[]) - Bulk retrieve dishes by IDs
  • getAllDishes() - Get all stored dishes
  • deleteDish(id: UUID) - Delete a dish by ID
  • deleteDishes(ids: UUID[]) - Bulk delete dishes by IDs
  • dishesExist(ids: UUID[]) - Check if dishes exist by IDs

Components Storage

Components are stored as JSON strings in the database. This allows for flexible component structures while maintaining the relational database benefits for the main dish data.

Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesCLIAI agentsCode intelligenceSlack integrationsGTMPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.