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/?q=database&page=15&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 7463 results for "database"(3318ms)

Towniequeries.tsx1 match

@bipin0005β€’Updated 2 days ago
6const PRICE_MULTIPLIER = 1.5;
7
8// Eventually we'll have a user database,
9// but in the meantime, we can cache user info in memory
10const userIdCache: { [key: string]: any } = {};

Towniepurchase-credits.ts1 match

@bipin0005β€’Updated 2 days ago
1import { Hono } from "npm:hono";
2import Stripe from "npm:stripe";
3import { getUser } from "../database/queries.tsx";
4import { getEnvVarName } from "../../shared/is-prod-branch.ts";
5

Townie.cursorrules2 matches

@bipin0005β€’Updated 2 days ago
198```
199β”œβ”€β”€ backend/
200β”‚ β”œβ”€β”€ database/
201β”‚ β”‚ β”œβ”€β”€ migrations.ts # Schema definitions
202β”‚ β”‚ β”œβ”€β”€ queries.ts # DB query functions
257 ```
258
259### Database Patterns
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering

Towniecredit-balance.ts1 match

@bipin0005β€’Updated 2 days ago
1import { Hono } from "npm:hono";
2import { getUser, getCreditBalance } from "../database/queries.tsx";
3
4const app = new Hono();

TownieBRANCH-TODO.md5 matches

@bipin0005β€’Updated 2 days ago
14**Goal**: Replace limit checking with credit checking
15
16**Database Changes:**
17
18* AddedΒ credit\_additionsΒ table with indexes for performance
21
22
23**New Functions inΒ /backend/database/queries.tsx:**
24
25* getCreditBalance(userId)Β - calculates balance with 50% markup on usage
145--------------------------
146
147**Database Schema:**
148
149Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` credit_additions ( id, user_id, created_at, stripe_payment_intent_id, amount, note ) -- Indexes on user_id for both credit_additions and townie_usage `
169**Backend:**
170
171* backend/database/schema.tsxΒ - Added credit\_additions table
172
173* backend/database/queries.tsxΒ - New credit functions, removed old limits
174
175* backend/routes/send-message.tsΒ - Updated to use credit checking

untitled-9078main.tsx1 match

@navya_kβ€’Updated 2 days ago
62Frontend & ReactJS \\
63Backend & Flask (Python) \\
64Database & MongoDB / Firebase \\
65NLP API & OpenAI GPT \\
66Styling & TailwindCSS / Bootstrap \\

EEPPortalnewsArticle.tsx1 match

@solomonferedeβ€’Updated 2 days ago
513 try {
514 // **REMOVED: newId = crypto.randomUUID();**
515 // The database will auto-increment the ID.
516 const response = await fetch("/submit-news", {
517 method: "POST",

Towniequeries.tsx1 match

@valdottownβ€’Updated 3 days ago
6const PRICE_MULTIPLIER = 1.5;
7
8// Eventually we'll have a user database,
9// but in the meantime, we can cache user info in memory
10const userIdCache: { [key: string]: any } = {};

TownieTokenGeneratorTerminal.tsx15 matches

@allβ€’Updated 3 days ago
516 await animateProgress('Asset transfer protocol', 2000);
517
518 addLog('info', 'Synchronizing civic databases with Val.Town');
519 await animateProgress('Database synchronization', 1500);
520
521 // Generate massive token haul
759
760 const checks = [
761 { name: 'Database connectivity', delay: 800 },
762 { name: 'Token integrity verification', delay: 1200 },
763 { name: 'Cryptographic hash validation', delay: 1000 },
781 addLog('info', '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
782 addLog('info', `πŸ“Š Status: ${healthData.status.toUpperCase()}`);
783 addLog('info', `πŸ—„οΈ Database: ${healthData.database}`);
784 addLog('info', `🏷️ Total tokens: ${healthData.total_tokens}`);
785 addLog('info', `⏰ Timestamp: ${new Date(healthData.timestamp).toLocaleString()}`);
854 };
855
856 const resetDatabase = async () => {
857 if (state.isRunning) return;
858
859 // Confirmation dialog
860 if (!confirm('⚠️ WARNING: This will permanently delete ALL tokens from the database. This action cannot be undone. Are you sure you want to proceed?')) {
861 return;
862 }
867 addLog('info', '');
868 addLog('error', '╔══════════════════════════════════════════════════════════════╗');
869 addLog('error', 'β•‘ ⚠️ DATABASE RESET β•‘');
870 addLog('error', 'β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•');
871 addLog('info', '');
872
873 addLog('warning', '🚨 DANGER ZONE: Initiating database reset...');
874 await sleep(1000);
875
876 addLog('info', 'πŸ”’ Acquiring exclusive database lock...');
877 await animateProgress('Database lock', 1000);
878 addLog('success', 'βœ… Database locked for maintenance');
879
880 addLog('info', 'πŸ—‘οΈ Purging token records...');
888
889 if (result.success) {
890 addLog('success', 'βœ… Database reset completed');
891 addLog('info', '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
892 addLog('warning', `πŸ—‘οΈ ${result.message}`);
893 addLog('info', 'πŸ”„ Database is now in pristine state');
894 addLog('info', '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
895
897 onTokenCountUpdate(0);
898 } else {
899 addLog('error', '❌ Database reset failed');
900 }
901
1003 <button
1004 className="control-button reset"
1005 onClick={resetDatabase}
1006 disabled={state.isRunning}
1007 >

TownieTokenGeneratorindex.ts8 matches

@allβ€’Updated 3 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import {
5 createToken,
10 getRecentLogs,
11 clearAllTokens
12} from "./database/queries.ts";
13
14const app = new Hono();
19});
20
21// Initialize database on startup
22await runMigrations();
23
116});
117
118// Clear all tokens (reset database)
119app.delete("/api/tokens", async c => {
120 const deletedCount = await clearAllTokens();
121 await logTerminalEntry('warning', `Database reset: ${deletedCount} tokens cleared`, 'system');
122
123 return c.json({
124 success: true,
125 message: `Cleared ${deletedCount} tokens from database`
126 });
127});
138 heist_method: "Municipal Override Key",
139 status: "SUCCESSFUL",
140 vault_location: "Secure Civic Database",
141 warning: "Civic authorities have been notified"
142 };
164 status: 'healthy',
165 timestamp: new Date().toISOString(),
166 database: 'connected',
167 total_tokens: stats.total_tokens
168 });

bookmarksDatabase

@s3thiβ€’Updated 3 months ago

sqLiteDatabase1 file match

@ideofunkβ€’Updated 6 months ago