A sophisticated AI-powered code generation and review web application that provides developers with an intelligent chat interface for code-related tasks including debugging, code reviews, optimization, and documentation.
- Professional Developers: Seeking AI assistance for code reviews, debugging, and optimization
- Development Teams: Looking for collaborative code assistance and documentation generation
- Software Engineering Students: Advanced learners wanting hands-on experience with modern web technologies
- Technical Leads: Needing efficient code review and mentoring tools
- Intermediate to Advanced: This project assumes familiarity with modern web development practices
- TypeScript/JavaScript: Strong understanding of ES6+, async/await, and type systems
- React Ecosystem: Experience with hooks, context, and component lifecycle
- Backend Development: Knowledge of REST APIs, databases, and server-side architecture
- Database Management: Understanding of SQL, ORMs, and database design principles
- Frontend: React 18, TypeScript, Tailwind CSS, modern build tools (Vite)
- Backend: Node.js, Express.js, RESTful API design
- Database: PostgreSQL, SQL queries, database migrations
- Development Tools: Git, package managers (npm), environment configuration
- Comfortable with command-line interfaces
- Experience with environment variable configuration
- Basic understanding of OAuth/authentication flows
- Familiarity with API integrations (OpenAI/OpenRouter)
- AI-Powered Chat Interface: Interactive chat with advanced AI models for code assistance
- Code Syntax Highlighting: Beautiful code blocks with syntax highlighting and copy functionality
- Real-time Messaging: Instant responses with typing indicators
- Chat History: Persistent chat sessions with automatic title generation
- Dark/Light Theme: Comprehensive theming support
- Responsive Design: Works seamlessly across desktop and mobile devices
- Secure Authentication: User authentication with session management
- Database Persistence: All chats and messages are stored in PostgreSQL
- React 18 with TypeScript
- Tailwind CSS for styling
- Radix UI primitives with shadcn/ui components
- TanStack Query for server state management
- Wouter for client-side routing
- Vite for fast development and building
- Express.js with TypeScript
- Node.js with ESM modules
- Drizzle ORM for type-safe database operations
- PostgreSQL for data persistence
- OpenAI/OpenRouter API integration
- Passport.js for authentication
- Node.js 20 or higher
- PostgreSQL database
- OpenAI API key or OpenRouter API key
- Clone the repository:
git clone <repository-url>
cd codechat-ai- Install dependencies:
npm install- Set up environment variables:
cp .env.example .envEdit .env and add your configuration:
DATABASE_URL=postgresql://username:password@localhost:5432/codechat_ai
OPENAI_API_KEY=your_openai_api_key
OPENROUTER_API_KEY=your_openrouter_api_key- Set up the database:
npm run db:push- Start the development server:
npm run devThe application will be available at http://localhost:5000
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run check- Type check with TypeScriptnpm run db:push- Push database schema changes
├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utility functions
│ │ └── contexts/ # React contexts
├── server/ # Backend Express application
│ ├── services/ # Business logic and external APIs
│ ├── routes.ts # API route definitions
│ ├── storage.ts # Database layer
│ └── index.ts # Server entry point
├── shared/ # Shared code between client and server
│ └── schema.ts # Database schema and types
└── docs/ # Documentation
POST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user
GET /api/chats- Get all user chatsPOST /api/chats- Create new chatGET /api/chats/:id- Get specific chatDELETE /api/chats/:id- Delete chat
GET /api/chats/:id/messages- Get chat messagesPOST /api/chats/:id/messages- Send message and get AI response
The application uses three main entities:
- Users: User authentication and profile data
- Chats: Chat sessions with titles and timestamps
- Messages: Individual messages with role (user/assistant) and content
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | Yes |
OPENAI_API_KEY |
OpenAI API key | Optional* |
OPENROUTER_API_KEY |
OpenRouter API key | Optional* |
NODE_ENV |
Environment (development/production) | No |
*At least one AI service API key is required
The application supports multiple AI providers:
- OpenAI: Direct integration with OpenAI's GPT models
- OpenRouter: Access to various AI models through OpenRouter
The system automatically selects the best available service based on configuration and validation.
This application is optimized for Replit deployment:
- Import the project to Replit
- Set up environment variables in Replit Secrets
- The application will automatically deploy using the configured workflows
- Build the application:
npm run build
jello-
Set up production database and environment variables
-
Start the production server:
npm start- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or contact the maintainers.