44}
45
46// Delete the app from the database
47const deleted = await deleteApp(appId);
48
39const apiKey = generateApiKey();
40
41// Create the app in the database
42const app = await createApp({
43name: validation.data.name!,
50
51/**
52* Create the feedback in the database with the following fields:
53*
54* Basic fields:
productpanelmigrations.ts2 matches
1/**
2* Database migrations for productpanel
3* Handles schema updates and migrations
4*/
6364/**
65* Check if a table exists in the database
66*/
67async function checkTableExists(tableName: string): Promise<boolean> {
productpanelinit.ts8 matches
1/**
2* Database initialization for productpanel
3* Creates required tables if they don't exist
4*/
89/**
10* Initialize the database by creating required tables
11* Only needs to be run once when the app starts
12*/
13export async function initializeDatabase() {
14try {
15// Create apps table
23return { success: true };
24} catch (error) {
25console.error("Error initializing database:", error);
26return {
27success: false,
3233/**
34* Reset database (for development use only)
35* Drops existing tables and recreates them
36*/
37export async function resetDatabase() {
38try {
39// Drop tables if they exist (reverse order due to foreign key)
42
43// Recreate tables
44return await initializeDatabase();
45} catch (error) {
46console.error("Error resetting database:", error);
47return {
48success: false,
productpanelschema.ts1 match
1/**
2* Database schema for productpanel
3* Contains table definitions for apps and feedback
4*/
productpanelapiKey.ts2 matches
2728/**
29* Validate an API key against the database
30* @param apiKey The API key to validate
31* @returns The app object if valid, null if invalid
36}
37
38// Check if the API key exists in the database
39const app = await getAppByApiKey(apiKey);
40return app;
productpanelvalidation.ts1 match
176}
177
178// Return cleaned data mapped to our database field names
179return {
180valid: true,
productpanelDESIGN_BRIEF.md5 matches
3## 1. Project Overview
45**AppFeedback.val** is a personal service for collecting, storing, and viewing user feedback from your apps. Built exclusively on Val Town, the service will leverage TypeScript with Deno runtime and Val Town's built-in SQLite database for data storage. This project is designed for personal use, allowing you to collect feedback from one or more of your applications and view it in a consolidated dashboard.
67## 2. Technical Requirements
10- **Runtime:** Deno (Val Town's native runtime)
11- **Programming Language:** TypeScript
12- **Database:** Val Town's built-in SQLite database (limit: 10MB free, 1GB paid)
13- **Authentication:** Simple API key authentication for your apps to send feedback
14- **Frontend:** HTML/CSS/JS served directly from Val Town HTTP vals
61โโโ index.ts # Main entry point for the project
62โโโ db/
63โ โโโ schema.ts # Database schema definitions
64โ โโโ init.ts # Database initialization
65โ โโโ queries.ts # Database query functions
66โโโ api/
67โ โโโ submitFeedback.ts # HTTP val for feedback submission
productpanelPROJECT_PLAN.md11 matches
3## ๐ Project Overview
45**AppFeedback.val** is a personal service built on Val Town for collecting and managing app feedback in a SQLite database. This service will be single-user (for personal use only) and implemented as a Val Town Project using TypeScript with the Deno runtime.
67> **Note:** The project has been created in Val Town with the name **"productpanel"**. Updates can be pushed to Val Town using the `vt` command line tool.
20- [ ] Push updates to Val Town using the `vt` command
21222. **Database Schema Design**
23- [x] Create `db/schema.ts` with table definitions
24- [x] Create `db/init.ts` for database initialization
25- [x] Create `db/queries.ts` for database operation functions
26- [x] Create `db/migrations.ts` for handling schema changes
2735- [x] Create `api/submitFeedback.ts` as an HTTP val for receiving feedback
36- [x] Implement request validation in `utils/validation.ts`
37- [x] Create database query functions in `db/queries.ts`
38393. **App Management API**
81- [ ] Test API endpoints with Deno's testing framework
82- [ ] Test email notification delivery
83- [ ] Verify database performance
8485---
94โโโ db/
95โ โโโ schema.ts # Table definitions
96โ โโโ init.ts # Database initialization
97โ โโโ queries.ts # Query functions
98โโโ api/
1231242. **SQLite via Val Town**
125- Use `std/sqlite` for database operations
126- Implement parameterized queries for security
127- Structure queries in `db/queries.ts` for reusability
1411. **Feedback Collection Flow**
142- App sends POST request with feedback data + API key to submitFeedback endpoint
143- Authentication middleware validates API key against database
144- Validation middleware checks input data
145- Database module stores feedback in SQLite
146- Email module sends notification
147- Response sent back to app
162163- Set up Val Town Project structure
164- Design and implement database schema and operations
165- Test Deno runtime features and Val Town integration
166- Create API key generation and authentication utilities