Not availible from now
# Clone the repository
git clone https://github.com/DavFilsDev/zenithAI_react-typescript-frontend.git
cd zenithAI_react-typescript-frontend
# Install dependencies
npm install
# or
yarn install
# or
pnpm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your backend URL
# Start development server
npm run dev
# or
yarn dev
# or
pnpm dev- Node.js 18+ or 20+
- npm, yarn, or pnpm
- Backend API running (see backend repository)
zenithAI_react-typescript-frontend/
βββ public/ # Static files
βββ src/
β βββ components/ # Reusable components
β β βββ ui/ # UI components (Button, Input, etc.)
β β βββ chat/ # Chat-specific components
β β βββ layout/ # Layout components
β βββ contexts/ # React contexts (Auth, Theme, etc.)
β βββ hooks/ # Custom React hooks
β βββ services/ # API services
β βββ types/ # TypeScript types
β βββ utils/ # Utility functions
β βββ pages/ # Page components
β βββ styles/ # Global styles
β βββ App.tsx # Main App component
βββ .env.example # Environment variables template
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
- Environment Variables (
/.env.local):
VITE_API_URL=http://localhost:8000/api
VITE_WS_URL=ws://localhost:8000/ws
VITE_APP_NAME=ChatGPT Clone
VITE_DEFAULT_THEME=dark# Using npm
npm install
# Using yarn
yarn install
# Using pnpm
pnpm installnpm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLintnpm run type-check- Check TypeScript typesnpm run format- Format code with Prettier
- Modern UI/UX: Clean, responsive interface
- Real-time Chat: WebSocket support
- Dark/Light Mode: Theme switching
- JWT Authentication: Secure login system
- Markdown Support: Render code and formatted text
- Conversation History: Save and load previous chats
- Responsive Design: Mobile-first approach
- Type Safety: Full TypeScript support
- Framework: React 18
- Language: TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS + CSS Modules
- State Management: React Context + Zustand
- HTTP Client: Axios
- Routing: React Router DOM
- Forms: React Hook Form
- Notifications: React Hot Toast
- Icons: React Icons
- Markdown: React Markdown
- Code Highlighting: Prism.js
- WebSocket: Native WebSocket API
- Login/Register - Authentication pages
- Chat Dashboard - Main chat interface
- Conversation List - History sidebar
- Settings - User preferences
- Profile - User profile management
# Run unit tests
npm run test
# Run tests with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2e-
Vercel (Recommended)
# Install Vercel CLI npm i -g vercel # Deploy vercel
-
Netlify
# Install Netlify CLI npm i -g netlify-cli # Deploy netlify deploy --prod
-
GitHub Pages
# Build and deploy npm run build npm run deploy
VITE_API_URL=https://your-backend.railway.app/api
VITE_WS_URL=wss://your-backend.railway.app/ws# Create production build
npm run build
# The build output will be in /dist folder
# You can serve it with:
npx serve dist-
Code Style:
- Use TypeScript strict mode
- Follow ESLint rules
- Use Prettier formatting
-
Component Structure:
- One component per file
- Use functional components with hooks
- Prop types with TypeScript interfaces
-
State Management:
- Local state:
useState,useReducer - Global state: Context API
- Server state: React Query
- Local state:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- CORS Errors: Ensure backend CORS settings allow your frontend URL
- WebSocket Issues: Check WebSocket URL and backend WebSocket server
- Build Errors: Clear node_modules and reinstall:
rm -rf node_modules && npm install
MIT License - see LICENSE file for details
- Issues: GitHub Issues
- Documentation: Check the Wiki
- Email: miharisoadavidfils.com
- OpenAI for inspiration
- React and TypeScript communities
- Vite team for excellent tooling
- All contributors and users
Author: Fanampinirina Miharisoa David Fils RATIANDRAIBE
- Start backend:
cd zenithAI_django-backend && docker-compose up - Start frontend:
cd zenithAI_react-typescript-frontend && npm run dev - Access frontend: http://localhost:5173
- API running at: http://localhost:8000/api
# Backend (.env)
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
# Frontend (.env.local)
VITE_API_URL=http://localhost:8000/api