untitled-1522
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v15View latest version
Hono-based API server with LastLogin authentication and SQLite database.
index.ts
- Main HTTP handler with LastLogin wrapperdatabase/
- Database migrations and query functionsroutes/
- API route handlers
- All API routes require authentication via LastLogin
- User email is extracted from
X-LastLogin-Email
header
GET /api/conversations
- Get user's conversationsGET /api/conversations/:id
- Get specific conversation with messagesPOST /api/conversations
- Create new conversationDELETE /api/conversations/:id
- Delete conversation
POST /api/chat
- Send message and get ChatGPT response
chat_users_v1
- User accountschat_conversations_v1
- Conversation metadatachat_messages_v1
- Individual messages
- Automatic user creation on first login
- Conversation history storage
- ChatGPT integration via OpenAI API
- Secure user isolation (users can only access their own data)