Chat Application DocumentationΒΆ
Welcome to the comprehensive documentation for our production-grade AI chat application.
π Quick LinksΒΆ
- Quick Start
Get up and running in 5 minutes
- Development Guide
Complete development setup and workflows
- API Reference
HTTP and streaming endpoints
- Deployment
Deploy to Google Cloud Run
π About This ProjectΒΆ
This is a production-grade AI chat application built with:
- Next.js 15 with App Router and Turbopack
- React 19 with Server Components
- TypeScript 5 in strict mode
- Google Vertex AI (Gemini 2.5 models)
- Tailwind CSS 4 with shadcn/ui v4
- NextAuth.js for authentication
Key FeaturesΒΆ
β Real-time AI Chat - Streaming responses with multimodal support (text + images) β Server-First Architecture - React Server Components by default β Type-Safe - TypeScript strict mode + Zod runtime validation β Secure - OAuth, rate limiting, input validation, security headers β Production-Ready - Deployed on Google Cloud Run with CI/CD β Well-Documented - Comprehensive docs, JSDoc, and code patterns
ποΈ Architecture OverviewΒΆ
graph TB
Browser[Browser] --> NextJS[Next.js 15 App]
NextJS --> Middleware[Middleware Layer]
Middleware --> Auth[Authentication]
Middleware --> RateLimit[Rate Limiting]
Middleware --> Security[Security Headers]
NextJS --> API[API Routes]
API --> Services[Service Layer]
Services --> VertexAI[Google Vertex AI]
NextJS --> Components[React Components]
Components --> UI[shadcn/ui]
style VertexAI fill:#4285f4,color:#fff
style NextJS fill:#000,color:#fff
style Components fill:#61dafb,color:#000
π― Getting Started PathsΒΆ
For New DevelopersΒΆ
- Quick Start - 5-minute setup guide
- Development Guide - Comprehensive setup
- Editor Setup - VS Code/Zed configuration
- Project Navigation - Find your way around
For ContributorsΒΆ
- Contributing Guidelines - How to contribute
- Code Patterns - Coding standards
- Common Mistakes - Avoid pitfalls
- Testing Guide - Test structure
For DevOps/DeploymentΒΆ
- Deployment Overview - Getting started
- Cloud Run Deployment - Step-by-step
- GitHub Actions - CI/CD setup
- Security - Security practices
π Documentation StructureΒΆ
docs/
βββ guides/ # How-to guides and tutorials
βββ adr/ # Architecture Decision Records
βββ deployment/ # Deployment guides
βββ security/ # Security documentation
βββ features/ # Feature-specific docs
βββ .github/patterns/ # Code patterns and examples
π Key ConceptsΒΆ
Server Components vs Client ComponentsΒΆ
This app uses React Server Components (RSC) by default:
- β
Server Components - Default, no
"use client"needed - π΅ Client Components - Add
"use client"when you need interactivity
Service Layer PatternΒΆ
Business logic lives in dedicated service classes:
export class ChatService {
async streamChat(messages: Message[]): Promise<ReadableStream> {
// Business logic here
}
}
Input ValidationΒΆ
All external data is validated with Zod schemas:
const schema = z.object({
messages: z.array(messageSchema),
model: z.string().optional(),
});
const validated = schema.parse(body);
π‘οΈ SecurityΒΆ
Security is built-in with multiple layers:
- Security Headers - CSP, HSTS, X-Frame-Options
- Rate Limiting - 5 requests / 10 seconds per IP
- Authentication - Google OAuth + email allowlist
- Input Validation - Zod schemas for all inputs
- Secure Secrets - Google Secret Manager
π Tech StackΒΆ
| Category | Technology | Version |
|---|---|---|
| Framework | Next.js | 15.5.4 |
| UI Library | React | 19.1.0 |
| Language | TypeScript | 5.x |
| Styling | Tailwind CSS | 4.x |
| Components | shadcn/ui | v4 |
| AI | Google Vertex AI | Gemini 2.5 |
| Auth | NextAuth.js | 4.24.11 |
| Validation | Zod | 4.1.12 |
| Testing | Vitest | 3.2.4 |
| Platform | Google Cloud Run | - |
π Project StatusΒΆ
- Production: chat.daza.ar
- Repository: github.com/roofsonfire/chat
- Status: β Active development
- License: MIT
π€ ContributingΒΆ
We welcome contributions! Please see our Contributing Guidelines.
Quick Contribution StepsΒΆ
- Fork the repository
- Create a feature branch
- Make your changes
- Write tests
- Submit a pull request
π Documentation StandardsΒΆ
This documentation follows these principles:
- Searchable - Full-text search enabled
- Visual - Diagrams and screenshots where helpful
- Practical - Real code examples
- Up-to-date - Maintained with the codebase
- AI-friendly - Optimized for GitHub Copilot context
π External ResourcesΒΆ
- Next.js 15 Documentation
- React 19 Documentation
- shadcn/ui Components
- Google Vertex AI Documentation
- Tailwind CSS Documentation
Last Updated: November 2025 Maintained by: Core Development Team Questions? Open an issue on GitHub