772 name: 'Advanced',
773 duration: '3 months',
774 topics: ['Advanced JavaScript', 'Backend basics', 'Database integration', 'Deployment'],
775 projects: ['Full-stack application', 'Dynamic website', 'Professional project']
776 }
844 name: 'Advanced',
845 duration: '3 months',
846 topics: ['Advanced algorithms', 'Software engineering', 'Database design', 'API development'],
847 projects: ['Full application', 'Database project', 'API integration']
848 }
849 ]
772 name: 'Advanced',
773 duration: '3 months',
774 topics: ['Advanced JavaScript', 'Backend basics', 'Database integration', 'Deployment'],
775 projects: ['Full-stack application', 'Dynamic website', 'Professional project']
776 }
844 name: 'Advanced',
845 duration: '3 months',
846 topics: ['Advanced algorithms', 'Software engineering', 'Database design', 'API development'],
847 projects: ['Full application', 'Database project', 'API integration']
848 }
849 ]
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { runMigrations } from "./database/migrations.ts";
3import { auth } from "./routes/auth.ts";
4import { content } from "./routes/content.ts";
13});
14
15// Run database migrations on startup
16await runMigrations();
17
6 getUserByBearerToken,
7 updateBearerTokenLastUsed
8} from "../database/queries.ts";
9import { requireAuth } from "./auth.ts";
10import type { ContentRequest } from "../../shared/types.ts";
138});
139
140// Debug endpoint to test database
141content.get('/debug', async (c) => {
142 try {
17 getBearerTokensByUserId,
18 deleteBearerToken
19} from "../database/queries.ts";
20import type {
21 RegisterStartRequest,
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 { getUserById } from "../database/queries.ts";
4import { getCookie } from "https://esm.sh/hono@3.11.7/cookie";
5
6 deleteContentItem,
7 getContentItemById
8} from "../database/queries.ts";
9import { requireAuth } from "./auth.ts";
10
16### ๐ง Management API
17- **RESTful Endpoints**: Complete CRUD operations for channels and playlists
18- **Database Storage**: SQLite with proper indexing and relationships
19- **User Management**: Admin roles and authentication
20- **Stream Monitoring**: Health checks and status tracking
41```
42โโโ backend/
43โ โโโ database/
44โ โ โโโ migrations.ts # Database schema and setup
45โ โ โโโ queries.ts # Database operations and queries
46โ โโโ routes/ # API endpoints (integrated in index.ts)
47โ โโโ index.ts # Main Hono server with all routes
108- `ADMIN_PASSWORD` - Admin access password (optional)
109
110### Database
111- **Auto-Migration**: Database schema is created automatically on startup
112- **SQLite Storage**: Persistent storage with proper indexing
113- **Default Admin**: Admin user created automatically if none exists
169### Backend Stack
170- **Hono**: Fast and lightweight web framework
171- **SQLite**: Embedded database with full SQL support
172- **TypeScript**: End-to-end type safety
173- **Val Town**: Serverless hosting and deployment
175### Performance Optimizations
176- **Server-Side Rendering**: Initial data injection for faster loading
177- **Database Indexing**: Optimized queries for large channel lists
178- **Lazy Loading**: Progressive loading of channel data
179- **Caching**: Efficient data caching and state management
2
3export async function runMigrations() {
4 console.log("Running database migrations...");
5
6 // Users table
75 await sqlite.execute(`CREATE INDEX IF NOT EXISTS idx_challenges_email ON webauthn_challenges (email)`);
76
77 console.log("Database migrations completed successfully");
78}
16```
17โโโ backend/
18โ โโโ database/
19โ โ โโโ migrations.ts # Database schema
20โ โ โโโ queries.ts # Database operations
21โ โโโ routes/
22โ โ โโโ auth.ts # WebAuthn authentication