• Blog
  • Docs
  • Pricing
  • Weโ€™re hiring!
Log inSign up
Satheesh_25

Satheesh_25

untitled-3483

Public
Like
untitled-3483
Home
Code
5
backend
3
frontend
3
shared
2
README.md
new-file-9444.tsx
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
/
database
/
README.md
Code
/
backend
/
database
/
README.md
Search
5/16/2025
README.md

Toy Store Database

This directory contains the database setup, migrations, and queries for the Toy Store website.

Files

  • migrations.ts - Database schema setup and seed data
  • queries.ts - Functions for querying the database

Database Schema

Categories Table

CREATE TABLE IF NOT EXISTS toy_store_categories ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, slug TEXT NOT NULL UNIQUE, description TEXT )

Products Table

CREATE TABLE IF NOT EXISTS toy_store_products ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, slug TEXT NOT NULL UNIQUE, description TEXT, price REAL NOT NULL, image_url TEXT, category_id INTEGER, featured BOOLEAN DEFAULT 0, stock INTEGER DEFAULT 0, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (category_id) REFERENCES toy_store_categories(id) )

Query Functions

  • getCategories() - Get all product categories
  • getCategoryBySlug(slug) - Get a category by slug
  • getProducts(options) - Get products with optional filtering
  • getProductBySlug(slug) - Get a product by slug
  • getFeaturedProducts(limit) - Get featured products
  • searchProducts(query) - Search products by name or description
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.