notUberFoldermain.tsx1 match
20<h1>notUber -- Its kinda like Lyft</h1>
21<p>I built this as part of a larger project, as well a demo.</p>
22<p>The stack consists of <a href="https://www.clerk.com">Clerk</a> for Auth, <a href="https://www.instantdb.com">InstantDB</a> for my database, and the <a href="https://developers.google.com/maps">Google maps api</a> for maps and routing etc.</p>
23<p>All the vals are located <a href="https://vawogbemi-notuberfolder.web.val.run">here</a>.</p>
24<h3>Getting Started</h3>
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
notUber_migratedREADME.md1 match
3I built this as part of a larger project, as well a demo.
45The stack consists of [Clerk](https://www.clerk.com) for Auth, [InstantDB](https://www.instantdb.com) for my database, and the [Google maps api](https://developers.google.com/maps) for maps and routing etc.
67All the vals are located [here](https://vawogbemi-notuberfolder.web.val.run).
2import { DB } from 'https://esm.town/v/@std/sqlite';
34// Initialize SQLite database
5const db = new DB();
6db.execute(`
5/**
6* Every Val Town account comes with its own private
7* [SQLite database](https://www.sqlite.org/) that
8* is accessible from any of your vals.
9* ([Docs ↗](https://docs.val.town/std/sqlite))
115116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119sqlRow: Array<unknown>,
1# SQLite - [Docs ↗](https://docs.val.town/std/sqlite)
23[SQLite](https://www.sqlite.org/) is a lightweight, standard database. Every Val Town account comes with its own private SQLite database that is accessible from any of your vals via [`std/sqlite`](https://www.val.town/v/std/sqlite).
45Val Town SQLite is powered by [Turso](https://turso.tech/).
9* [ORMs](https://docs.val.town/std/sqlite/orms)
1011We recommend these admin data viewers for managing your database – viewing or editing data or your database table schema:
1213* [Outerbase Studio](https://libsqlstudio.com/) **(recommended)** - formely known as LibSQL Studio – see instructions [here](https://libsqlstudio.com/docs/connect-valtown)
5/**
6* Every Val Town account comes with its own private
7* [SQLite database](https://www.sqlite.org/) that
8* is accessible from any of your vals.
9* ([Docs ↗](https://docs.val.town/std/sqlite))
sqlite_adminREADME.md1 match
7It's currently super limited (no pagination, editing data, data-type specific viewers), and is just a couple dozens lines of code over a couple different vals. Forks encouraged! Just comment on the val if you add any features that you want to share.
89To use it on your own Val Town SQLite database, [fork it](https://www.val.town/v/stevekrouse/sqlite_admin/fork) to your account.
1011It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
userManagementmain.tsx1 match
44// 2. Check password strength
45// 3. Hash password
46// 4. Store in database
4748return {
sqLiteDatabasemain.tsx27 matches
23/**
4* Initialize database tables for authentication system
5* Includes users, login attempts, and verification tokens
6*/
7export async function initializeDatabase() {
8// Use the val's unique identifier as a prefix for tables
9const KEY = "sqLiteDatabase";
10const SCHEMA_VERSION = 3; // Increment when schema changes
1154`);
5556console.log(`Database tables initialized for authentication system (Schema v${SCHEMA_VERSION})`);
57return { success: true, message: 'Database setup complete' };
58} catch (error) {
59console.error('Database initialization error:', error);
60return {
61success: false,
62message: 'Failed to initialize database',
63error: error.message
64};
6768/**
69* Utility function to reset or clean up database
70* Use with caution in production
71*/
72export async function resetDatabase() {
73const KEY = "sqLiteDatabase";
74const SCHEMA_VERSION = 3;
7579await sqlite.execute(`DROP TABLE IF EXISTS ${KEY}_verification_tokens_${SCHEMA_VERSION}`);
80
81await initializeDatabase();
82
83console.log('Database reset completed successfully');
84return { success: true, message: 'Database reset complete' };
85} catch (error) {
86console.error('Database reset error:', error);
87return {
88success: false,
89message: 'Failed to reset database',
90error: error.message
91};
9495/**
96* Utility function to perform database migrations
97* Call this when schema changes are needed
98*/
99export async function migrateDatabase() {
100const KEY = "sqLiteDatabase";
101const SCHEMA_VERSION = 3;
102108`);
109110console.log('Database migration completed successfully');
111return { success: true, message: 'Database migration complete' };
112} catch (error) {
113console.error('Database migration error:', error);
114return {
115success: false,
116message: 'Failed to migrate database',
117error: error.message
118};
120}
121122// Initialize database on module import
123initializeDatabase();
124125export default {
126initializeDatabase,
127resetDatabase,
128migrateDatabase
129};