last-login-demo-1
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.
index.ts
https://stevekrouse--e8ad097a93d811f089f80224a6c84d84.web.val.run
A fullstack React + Hono app that lets you chat with ChatGPT, with user authentication and thread history.
- 🔐 Authentication via LastLogin (Google OAuth)
- 💬 Chat with ChatGPT (GPT-4o-mini)
- 📝 Thread-based conversation history
- 🗄️ SQLite storage for persistence
- 📱 Responsive design with TailwindCSS
├── backend/
│ └── index.ts # Main Hono server with API routes
├── frontend/
│ ├── index.html # Main HTML template
│ └── index.tsx # React frontend app
└── README.md
Backend Foundation:
- ✅ Hono app with LastLogin authentication
- ✅ SQLite schema for threads and messages
- ✅ Basic API endpoints for threads CRUD
- ✅ Static file serving for React frontend
Frontend Foundation:
- ✅ React app with authentication UI
- ✅ Basic layout with sidebar for threads
- ✅ Login/logout flow with LoginWithGoogleButton
- ✅ Thread listing and creation
- ✅ Responsive design with TailwindCSS
Chat Interface:
- ✅ Chat message display with user/assistant styling
- ✅ Message input with textarea and send button
- ✅ OpenAI API integration (GPT-4o-mini)
- ✅ Real-time message updates
- ✅ Loading states and typing indicators
- ✅ Conversation history context
GET /- Main React appGET /api/threads- List user's threadsPOST /api/threads- Create new threadGET /api/threads/:id/messages- Get messages for threadPOST /api/threads/:id/messages- Send message and get AI response
Tables:
last-login-chat-threads- User chat threadslast-login-chat-messages- Individual messages in threads
- Phase 4: Thread management and auto-titles
- Phase 5: Final polish and responsive design
/debug- Check authentication status/api/test-create-thread- Create a test thread (when logged in)
