stevensDemogenerateFunFacts.ts2 matches
89/**
10* Retrieves previously generated fun facts from the memories database
11* @returns Array of previous fun facts
12*/
4748/**
49* Inserts a fun fact into the memories database
50* @param date Date for the fun fact in ISO format
51* @param factText The fun fact text
stevensDemo.cursorrules2 matches
208```
209โโโ backend/
210โ โโโ database/
211โ โ โโโ migrations.ts # Schema definitions
212โ โ โโโ queries.ts # DB query functions
270- Handle API calls properly with proper error catching
271272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering
personalShopperindex.ts3 matches
25updateUserLocation,
26updateUserTokens,
27} from "./database/krogerQueries.ts";
28import { runMigrations } from "./database/migrations.ts";
29// import { KrogerAuthService } from "./services/krogerAuth.ts";
30import { MockKrogerAuthService } from "./services/fakeKrogerAuth.ts";
34const app = new Hono();
3536// Initialize database on startup
37await runMigrations();
38
reactHonoStarterREADME.md1 match
21## Further resources
2223- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.
SocialArchetypeQuizindex.ts6 matches
802import { email } from "https://esm.town/v/std/email";
803804// Database setup
805const TABLE_NAME = 'archetype_quiz_results_v1';
806807async function initDatabase() {
808await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
809id INTEGER PRIMARY KEY AUTOINCREMENT,
818819async function saveQuizResult(userEmail: string, calculatedArchetype: string, chosenArchetype: string, scores: any, answers: any) {
820await initDatabase();
821await sqlite.execute(
822`INSERT INTO ${TABLE_NAME} (email, calculated_archetype, chosen_archetype, scores, answers) VALUES (?, ?, ?, ?, ?)`,
826827async function getQuizResults(limit = 50, offset = 0) {
828await initDatabase();
829try {
830const results = await sqlite.execute(
849850async function getQuizStats() {
851await initDatabase();
852
853try {
1015const { email, calculatedArchetype, chosenArchetype, scores, answers } = await req.json();
1016
1017// Save to database
1018await saveQuizResult(email, calculatedArchetype, chosenArchetype, scores, answers);
1019
SocialArchetypeQuizREADME.md3 matches
9- **Confetti Animations**: Celebratory confetti on every button click
10- **Iridescent Design**: Purple, blue, and pink gradient theme with glassmorphism effects
11- **Backend Storage**: SQLite database stores quiz results and user choices
12- **User Choice**: Users can choose their preferred archetype after seeing results
13- **Mobile Responsive**: Works perfectly on all device sizes
91- Timestamp of completion
9293Database table: `archetype_quiz_results_v1`
9495## ๐ Technical Stack
99- **Animations**: Canvas Confetti library
100- **Icons**: Font Awesome 6.4.0
101- **Backend**: Val Town SQLite database
102- **Platform**: Val Town serverless
103
ssscQuizadmin.http.ts8 matches
12const TABLE_NAME = 'sssc_quiz_submissions_v1'; // Must match the table name in index.http.ts
13
14// Database initialization - ensure table exists
15async function initDatabase() {
16await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
17id INTEGER PRIMARY KEY AUTOINCREMENT,
33}
34
35// Initialize database on startup
36await initDatabase();
37
38// Main admin dashboard route
94<body>
95<div style="padding: 2rem; text-align: center;">
96<h1>โ ๏ธ Database Error</h1>
97<p>Unable to load dashboard data. Please check if the database is initialized.</p>
98<a href="/" style="color: #4361ee;">โ Back to Quiz</a>
99</div>
204});
205
206// Debug endpoint to check database contents
207app.get("/api/debug", async c => {
208try {
527<p>Total Submissions: <strong>${total}</strong></p>
528<p style="font-size: 0.9rem; opacity: 0.8;">
529<a href="/api/debug" style="color: rgba(255,255,255,0.8); text-decoration: none;">๐ Debug Database</a>
530</p>
531</div>
10- **Personality Analysis**: Advanced algorithm determining primary social archetype
11- **Email Delivery**: Automated email with detailed results and insights
12- **Data Persistence**: All submissions stored in SQLite database
13
14### Enhanced Features
61- **Backend**: Hono web framework on Deno
62- **Frontend**: React 18 with TypeScript
63- **Database**: Val Town SQLite
64- **Email**: Val Town email service
65- **Styling**: CSS with custom properties and responsive design
91- Primary HTTP val that users visit
92- Hono web server with comprehensive error handling
93- SQLite database with optimized schema and indexing
94- Enhanced email system with HTML/text templates
95- API endpoints for quiz submission and analytics
107### Backend (Hono)
108- RESTful API with proper error handling
109- SQLite database with structured schema and indexes
110- Email automation with professional HTML templates
111- Admin analytics with real-time data
120- Progressive enhancement
121
122### Database Schema
123```sql
124CREATE TABLE sssc_quiz_submissions (
180
181- **Email Validation**: Client and server-side validation
182- **Data Sanitization**: All inputs sanitized before database storage
183- **Privacy Focused**: No tracking beyond essential quiz functionality
184- **Secure Storage**: Encrypted database storage through Val Town
185
186## ๐ Deployment
1901. **Main Application**: `index.http.ts` - Primary entry point users visit
1912. **Admin Dashboard**: `admin.http.ts` - Analytics and data management
1923. **Database**: Automatic SQLite initialization with proper indexing
1934. **Email**: Enhanced email service with HTML templates following Val Town standards
1945. **Frontend**: Served as static files with mobile-responsive design
254- **Efficient Rendering**: Optimized React components
255- **CSS Optimization**: Custom properties and efficient selectors
256- **Database Queries**: Indexed and optimized queries
257
258
ssscQuizindex.http.ts9 matches
13});
14
15// Database setup following Val Town standards
16const TABLE_NAME = 'sssc_quiz_submissions_v1'; // Must match admin.http.ts table name
17
18// Initialize database with Val Town best practices
19async function initDatabase() {
20await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
21id INTEGER PRIMARY KEY AUTOINCREMENT,
37}
38
39// Initialize database on startup
40await initDatabase();
41
42// Serve static files
86const ipHash = forwarded ? await hashIP(forwarded.split(',')[0].trim()) : '';
87
88console.log("Storing in database...");
89console.log("Table name:", TABLE_NAME);
90console.log("Data to insert:", {
96});
97
98// Store in database following Val Town patterns
99const insertResult = await sqlite.execute(
100`INSERT INTO ${TABLE_NAME} (
113]
114);
115console.log("Database insert successful, result:", insertResult);
116
117// Verify the insert worked
200app.get("/api/test-insert", async c => {
201try {
202console.log("Testing database insert...");
203
204const testEmail = `test${Date.now()}@example.com`;