saast
v0.0.1
Published
Modern AI Chat SaaS Template - Build amazing chat applications
Maintainers
Readme
ChatSaaS - Enterprise AI Chat Application Template
A production-ready, enterprise-grade SaaS template for building AI chat applications
Live Demo • Documentation • Contributing
🚀 Features
💬 Advanced Chat Experience
- OpenAI-style interface with real-time messaging
- Conversation management with history and search
- Mobile-optimized responsive design
- Keyboard shortcuts and accessibility features
- Message actions (edit, copy, delete, share)
🎨 Modern UI/UX
- 4 beautiful themes (Light, Dark, Ocean Blue, Purple Rain)
- Glassmorphism effects and smooth animations
- Mobile-first responsive design
- Touch-friendly interactions
- Progressive Web App ready
🎯 Rich Content Rendering
- Markdown with GitHub Flavored Markdown
- Mermaid diagrams for flowcharts and visualizations
- Syntax highlighting for 100+ programming languages
- Code blocks with copy functionality
- Tables, lists, blockquotes and more
- Extensible renderer architecture
🔐 Enterprise Authentication
- JWT-based security with refresh tokens
- Form validation with Zod schemas
- Protected routes and role-based access
- Password strength validation
- Social login ready (extendable)
🏗️ Production Architecture
- TypeScript throughout for type safety
- Error boundaries and comprehensive error handling
- Performance optimized with code splitting
- SEO friendly with meta tags and structured data
- Analytics ready with event tracking
- Monitoring integration (Sentry ready)
📱 Mobile Excellence
- Touch gestures and mobile interactions
- Offline support with service worker
- App-like experience with PWA features
- Optimized for slow networks
- Native sharing support
🛠️ Quick Start
Prerequisites
- Node.js 18+ and npm 9+
- Git for version control
Installation
# Clone and navigate to project
cd C:\Projects\saast\client
# Install dependencies
npm install
# Copy environment configuration
cp .env.example .env.local
# Start development server
npm run devDemo Account
- Email:
[email protected] - Password:
password123
📦 Scripts
# Development
npm run dev # Start dev server with hot reload
npm run type-check:watch # Watch TypeScript errors
# Building
npm run build # Production build with optimizations
npm run build:dev # Development build
npm run preview # Preview production build locally
# Code Quality
npm run lint # Check code quality
npm run lint:fix # Fix linting issues
npm run format # Format code with Prettier
npm run type-check # Check TypeScript types
# Analysis
npm run analyze # Bundle analyzer
npm run clean # Clean build artifacts🏗️ Architecture
Project Structure
src/
├── components/ # Reusable UI components
│ ├── ui/ # Base design system components
│ ├── auth/ # Authentication components
│ ├── chat/ # Chat-specific components
│ └── layout/ # Layout and navigation
├── pages/ # Route-based page components
├── store/ # Global state management (Zustand)
├── services/ # API services and external integrations
├── hooks/ # Custom React hooks
├── utils/ # Utility functions and helpers
├── types/ # TypeScript type definitions
├── config/ # Environment and app configuration
└── styles/ # Global styles and themesKey Technologies
- React 19 - Modern React with concurrent features
- TypeScript 5.8 - Full type safety
- Tailwind CSS 3.4 - Utility-first styling
- Zustand 5 - Lightweight state management
- React Router 6 - Client-side routing
- React Hook Form + Zod - Form handling with validation
- Vite 6 - Fast build tool and dev server
🎨 Theming System
Built-in Themes
- Light Theme - Clean and professional
- Dark Theme - Easy on the eyes
- Ocean Blue - Cool blue tones
- Purple Rain - Vibrant gradients
Custom Themes
// Add new theme in src/store/settingsStore.ts
const customTheme: Theme = {
id: 'custom',
name: 'Custom Theme',
mode: 'dark',
colors: {
primary: '#your-color',
secondary: '#your-color',
// ... other colors
},
};🔧 Configuration
Environment Variables
# API Configuration
VITE_API_BASE_URL=https://api.yourdomain.com
VITE_ENABLE_MOCK_API=false
# Features
VITE_ENABLE_ANALYTICS=true
VITE_ENABLE_ERROR_REPORTING=true
# Analytics
VITE_GOOGLE_ANALYTICS_ID=GA_MEASUREMENT_ID
VITE_SENTRY_DSN=YOUR_SENTRY_DSNFeature Flags
Control features via environment variables:
VITE_ENABLE_VOICE_RECORDING- Voice inputVITE_ENABLE_FILE_UPLOAD- File attachmentsVITE_ENABLE_ANALYTICS- User analyticsVITE_ENABLE_ERROR_REPORTING- Error tracking
🚀 Deployment
Build for Production
npm run buildDeploy to Vercel
npm install -g vercel
vercel --prodDeploy to Netlify
npm run build
# Deploy dist/ folder to NetlifyDocker Deployment
FROM node:18-alpine as builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]🔌 API Integration
Replace Mock API
- Update
VITE_API_BASE_URLin.env.local - Set
VITE_ENABLE_MOCK_API=false - Implement backend endpoints:
POST /auth/login- User authenticationPOST /auth/register- User registrationPOST /chat/message- Send message to AI
Backend Requirements
// Expected API responses
interface LoginResponse {
user: User;
token: string;
}
interface ChatResponse {
message: {
id: string;
content: string;
role: 'assistant';
timestamp: string;
};
}📊 Performance
Optimization Features
- Code splitting - Lazy loaded routes and components
- Bundle analysis - Visualize bundle size
- Tree shaking - Remove unused code
- Image optimization - WebP and lazy loading
- Caching strategy - Service worker and HTTP caching
Performance Monitoring
# Analyze bundle size
npm run analyze
# Check build performance
npm run build -- --stats🧪 Testing (Coming Soon)
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Coverage report
npm run test:coverage🔒 Security
Security Features
- Content Security Policy (CSP) headers
- XSS protection with sanitized HTML
- CSRF protection with token validation
- Secure authentication with JWT
- Input validation with Zod schemas
Security Best Practices
- Environment variables for secrets
- Sanitized user inputs
- Secure HTTP headers
- Regular dependency updates
📱 PWA Features
The app is Progressive Web App ready:
- Offline support - Works without internet
- App-like experience - Install on device
- Push notifications - Engage users
- Background sync - Sync when online
🌐 Internationalization (Coming Soon)
// i18n ready structure
const messages = {
en: { welcome: 'Welcome to ChatSaaS' },
es: { welcome: 'Bienvenido a ChatSaaS' },
fr: { welcome: 'Bienvenue à ChatSaaS' },
};🤝 Contributing
We welcome contributions! See our Contributing Guide for details.
Development Workflow
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Make changes with tests
- Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Submit Pull Request
Code Standards
- TypeScript for all new code
- ESLint + Prettier for formatting
- Conventional commits for messages
- Component documentation required
- Mobile-first responsive design
📈 Roadmap
Version 1.1 (Q2 2024)
- [ ] Voice input/output
- [ ] File upload support
- [ ] Advanced admin dashboard
- [ ] Multi-language support
Version 1.2 (Q3 2024)
- [ ] Real-time collaboration
- [ ] Plugin system
- [ ] Advanced analytics
- [ ] White-label solution
Version 2.0 (Q4 2024)
- [ ] AI model marketplace
- [ ] Custom model training
- [ ] Enterprise SSO
- [ ] Advanced integrations
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- React - UI framework
- Tailwind CSS - Styling framework
- Mermaid - Diagram generation
- Lucide React - Beautiful icons
- Zustand - State management
📞 Support
- 📧 Email: [email protected]
- 💬 Discord: Join our community
- 📖 Documentation: Developer Guide
- 🐛 Bug Reports: GitHub Issues
Built with ❤️ for the developer community
