Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7BsvgDataUrl%7D?q=database&page=5&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=database

Returns an array of strings in format "username" or "username/projectName"

Found 7780 results for "database"(5833ms)

personalShopperindex.ts3 matches

@bgschillerUpdated 1 day ago
25 updateUserLocation,
26 updateUserTokens,
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();
35
36// Initialize database on startup
37await runMigrations();
38

reactHonoStarterREADME.md1 match

@anup_d911Updated 1 day ago
21## Further resources
22
23- [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

@mccailsUpdated 1 day ago
802import { email } from "https://esm.town/v/std/email";
803
804// Database setup
805const TABLE_NAME = 'archetype_quiz_results_v1';
806
807async function initDatabase() {
808 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
809 id INTEGER PRIMARY KEY AUTOINCREMENT,
818
819async function saveQuizResult(userEmail: string, calculatedArchetype: string, chosenArchetype: string, scores: any, answers: any) {
820 await initDatabase();
821 await sqlite.execute(
822 `INSERT INTO ${TABLE_NAME} (email, calculated_archetype, chosen_archetype, scores, answers) VALUES (?, ?, ?, ?, ?)`,
826
827async function getQuizResults(limit = 50, offset = 0) {
828 await initDatabase();
829 try {
830 const results = await sqlite.execute(
849
850async function getQuizStats() {
851 await initDatabase();
852
853 try {
1015 const { email, calculatedArchetype, chosenArchetype, scores, answers } = await req.json();
1016
1017 // Save to database
1018 await saveQuizResult(email, calculatedArchetype, chosenArchetype, scores, answers);
1019

SocialArchetypeQuizREADME.md3 matches

@mccailsUpdated 1 day ago
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
92
93Database table: `archetype_quiz_results_v1`
94
95## 🛠 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

@allUpdated 1 day ago
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() {
16 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
17 id 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 => {
208 try {
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>

ssscQuizREADME.md9 matches

@allUpdated 1 day ago
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

@allUpdated 1 day ago
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() {
20 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
21 id INTEGER PRIMARY KEY AUTOINCREMENT,
37}
38
39// Initialize database on startup
40await initDatabase();
41
42// Serve static files
86 const ipHash = forwarded ? await hashIP(forwarded.split(',')[0].trim()) : '';
87
88 console.log("Storing in database...");
89 console.log("Table name:", TABLE_NAME);
90 console.log("Data to insert:", {
96 });
97
98 // Store in database following Val Town patterns
99 const insertResult = await sqlite.execute(
100 `INSERT INTO ${TABLE_NAME} (
113 ]
114 );
115 console.log("Database insert successful, result:", insertResult);
116
117 // Verify the insert worked
200app.get("/api/test-insert", async c => {
201 try {
202 console.log("Testing database insert...");
203
204 const testEmail = `test${Date.now()}@example.com`;

ssscQuizconfig.ts2 matches

@allUpdated 1 day ago
37 },
38
39 // Database configuration
40 database: {
41 tableName: "sssc_quiz_submissions_v1",
42 enableIndexes: true
11});
12
13app.get("/clear-databases", async (c) => {
14 return c.html(`
15 <h1>Clear Databases</h1>
16 <p>This will clear the databases for the bot.</p>
17 <form method="post" action="/clear-databases">
18 <input type="text" name="token" placeholder="Token" />
19 <button type="submit">Clear Databases</button>
20 </form>
21 <p>The password is ${Deno.env.get("ADMIN_TOKEN")}</p>
23});
24
25// Clear databases endpoint
26app.post("/clear-databases", async (c) => {
27 const body = await c.req.parseBody();
28 const token = body["token"];
32 }
33
34 // clear the databases
35 await sqlite.execute(`DELETE FROM ${LangChainTables.checkpoints}`);
36 await sqlite.execute(`DELETE FROM ${LangChainTables.checkpoint_writes}`);
37
38 return c.json({ message: "Databases cleared" });
39});
40
40 await ctx.reply(`✅ Successfully joined room with secret: ${roomSecret}`);
41 } catch (dbError) {
42 console.error("Database error in join command:", dbError);
43 await ctx.reply("❌ Error joining room. Please try again.");
44 }
74 await ctx.reply(`✅ Successfully left room with secret: ${roomSecret}`);
75 } catch (dbError) {
76 console.error("Database error in leave command:", dbError);
77 await ctx.reply("❌ Error leaving room. Please try again.");
78 }

bookmarksDatabase

@s3thiUpdated 4 months ago

sqLiteDatabase1 file match

@ideofunkUpdated 7 months ago