demo
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.
https://yuxiaoy--4009929a34cc11f092d69e149126039e.web.val.run
A modern AI chat application built on Val Town using:
- Next.js 15-inspired structure
- TailwindCSS for styling
- Google's Gemini 2.0 model for AI responses
├── app/
│ ├── api/
│ │ └── chat/
│ │ └── route.ts # API endpoint for chat
│ ├── layout.tsx # Root layout component
│ └── page.tsx # Main page component
├── components/
│ ├── chat-input.tsx # Chat input component
│ ├── chat-message.tsx # Message component
│ ├── chat.tsx # Main chat component
│ └── providers.tsx # Context providers
├── lib/
│ ├── gemini.ts # Gemini API utilities
│ ├── storage.ts # Storage utilities
│ └── types.ts # TypeScript types
└── public/
└── favicon.svg # Favicon
- Create a Google AI Studio API key at https://aistudio.google.com/
- Add your API key as an environment variable in Val Town named
GEMINI_API_KEY
- Real-time chat interface
- Message history persistence
- Markdown rendering for code blocks and formatting
- Responsive design with TailwindCSS
- Next.js 15 App Router-inspired structure
Access the application through the HTTP endpoint URL.