A collaborative code editor and project management platform with AI assistance, designed for modern development workflows
- GitHub Integration: Seamless OAuth authentication and repository management
- AI-Powered Chat: Contextual AI assistance for coding queries and debugging
- Project Management: Full-stack project organization with file versioning
- Real-time Collaboration: Multi-user editor states and session management
- File Snapshots: Version control with automatic snapshots and undo functionality
- Web Container Sessions: Browser-based code execution environments
- Smart Editor State: Persistent cursor position, open files, and layout preferences
- AI Usage Tracking: Monitor AI model usage and costs across projects
- Node.js 18+
- PostgreSQL database
- GitHub OAuth App (for authentication)
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd Codexa
-
Set up the database
# Create a PostgreSQL database createdb codexa_dev -
Configure environment variables
# Create .env file in backend directory cd backend cp .env.example .env
Update the
.envfile with:DATABASE_URL="postgresql://username:password@localhost:5432/codexa_dev" GITHUB_CLIENT_ID="your_github_client_id" GITHUB_CLIENT_SECRET="your_github_client_secret" GITHUB_CALLBACK_URL="http://localhost:3000/api/auth/github/callback" PORT=3000
-
Install dependencies
# Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install
-
Set up the database schema
cd backend npx prisma migrate dev npx prisma generate -
Start the development servers
# Start the backend server (Terminal 1) cd backend npm run dev # Start the frontend server (Terminal 2) cd frontend npm run dev
-
Access the application
- Backend API:
http://localhost:3000 - Frontend:
http://localhost:5173(Vite default)
- Backend API:
Codexa/
โโโ README.md
โโโ package.json # Root package.json (if using monorepo)
โโโ backend/ # Express.js API server
โ โโโ index.ts # Main server entry point
โ โโโ package.json # Backend dependencies
โ โโโ package-lock.json
โ โโโ prisma.config.ts # Prisma configuration
โ โโโ tsconfig.json # TypeScript configuration
โ โโโ config/
โ โ โโโ env.ts # Environment configuration
โ โโโ controllers/ # Request handlers
โ โ โโโ auth.controller.ts
โ โ โโโ ai.controller.ts
โ โ โโโ file.controller.ts
โ โ โโโ github.controller.ts
โ โ โโโ project.controller.ts
โ โโโ generated/ # Generated Prisma client
โ โ โโโ prisma/ # Prisma client types and models
โ โโโ lib/
โ โ โโโ prisma.ts # Prisma client instance
โ โโโ middleware/ # Express middleware
โ โ โโโ auth.middleware.ts
โ โโโ prisma/ # Database schema and migrations
โ โ โโโ schema.prisma # Database schema definition
โ โ โโโ migrations/ # Database migration files
โ โโโ routes/ # API endpoints
โ โ โโโ auth.routes.ts
โ โ โโโ ai.routes.ts
โ โ โโโ file.routes.ts
โ โ โโโ github.routes.ts
โ โ โโโ project.routes.ts
โ โโโ services/ # Business logic
โ โ โโโ auth.service.ts
โ โ โโโ ai.service.ts # AI integration service
โ โ โโโ file.service.ts # File management service
โ โ โโโ project.service.ts # Project management service
โ โ โโโ github.service.ts # GitHub API integration
โ โโโ types/ # TypeScript type definitions
โ โ โโโ express.d.ts
โ โโโ utils/ # Utility functions
โ โโโ jwt.ts
โโโ frontend/ # React application
โโโ package.json # Frontend dependencies
โโโ package-lock.json # Dependency lock file
โโโ vite.config.ts # Vite configuration
โโโ tsconfig.json # TypeScript configuration
โโโ tsconfig.app.json # App TypeScript configuration
โโโ tsconfig.node.json # Node TypeScript configuration
โโโ eslint.config.js # ESLint configuration
โโโ index.html # HTML entry point
โโโ public/ # Static assets
โโโ src/
โโโ App.tsx # Main React component
โโโ main.tsx # React app entry point
โโโ App.css # Global styles
โโโ index.css # Base styles
โโโ api/ # API client services
โ โโโ ai.ts
โ โโโ auth.ts
โ โโโ client.ts
โ โโโ files.ts
โ โโโ github.ts
โ โโโ projects.ts
โโโ assets/ # Static assets
โโโ components/ # Reusable React components
โ โโโ editor/
โ โ โโโ CodeEditor.tsx
โ โ โโโ EditorTabs.tsx
โ โโโ layout/
โ โ โโโ Sidebar.tsx
โ โ โโโ StatusBar.tsx
โ โ โโโ Topbar.tsx
โ โโโ modals/
โ โ โโโ LoginModal.tsx
โ โ โโโ NewFileModal.tsx
โ โ โโโ NewProjectModal.tsx
โ โโโ panels/
โ โโโ AIChat.tsx
โ โโโ FileExplorer.tsx
โ โโโ GitPanel.tsx
โ โโโ SearchPanel.tsx
โ โโโ Terminal.tsx
โโโ pages/ # Page components
โ โโโ AuthCallback.tsx
โ โโโ IDEPage.tsx
โโโ stores/ # State management
โ โโโ authStore.ts
โ โโโ editorStore.ts
โ โโโ projectStore.ts
โ โโโ uiStore.ts
โโโ utils/ # Utility functions
โโโ fileIcons.ts
โโโ languages.ts
The backend is built with TypeScript, Express.js, and Prisma:
cd backend
npm run dev # Start development server with hot reload
npm run build # Build TypeScript for production
npm start # Start production serverThe frontend is built with React, TypeScript, and Vite:
cd frontend
npm run dev # Start Vite development server
npm run build # Build for production
npm run preview # Preview production build locally
npm run lint # Run ESLintcd backend
# Generate Prisma client after schema changes
npx prisma generate
# Create and apply new migration
npx prisma migrate dev --name migration_name
# Reset database (development only)
npx prisma migrate reset
# View data in Prisma Studio
npx prisma studioThe application uses PostgreSQL with Prisma ORM. Key entities include:
- Users: GitHub OAuth integration with session management
- Projects: Code project organization with repository linking
- Files: File management with versioning and snapshots
- Chat Sessions: AI-powered coding assistance conversations
- Editor States: Persistent editor preferences and configurations
- AI Usage: Tracking of AI model consumption and costs
- Web Container Sessions: Browser-based development environments
- OAuth authentication flow
- Repository synchronization
- Commit tracking and version management
- User profile and avatar integration
- Chat Interface: Context-aware AI coding assistant
- Usage Tracking: Monitor AI model consumption and costs
- Referenced Files: AI responses with file context
- Multi-role Conversations: User, assistant, and system messages
- Browser Environments: Run code directly in browser containers
- Session Management: Persistent development environments per project
- Multi-language Support: Execute various programming languages
- User initiates login via GitHub
- OAuth redirect to GitHub authorization
- Callback with authorization code
- Token exchange and user profile retrieval
- JWT token generation for session management
- Encrypted access and refresh tokens
- Session-based authentication with expiration
- IP address and user agent tracking
- Cascade deletion for data consistency
- Runtime: Node.js with TypeScript
- Framework: Express.js
- Database: PostgreSQL with Prisma ORM
- Authentication: GitHub OAuth + JWT
- Environment: dotenv for configuration
- Framework: React 19 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS v4
- Linting: ESLint with React plugins
- ORM: Prisma with automatic client generation
- Hot Reload: nodemon for backend, Vite HMR for frontend
- Type Safety: Full TypeScript coverage
- Database Migrations: Prisma migrate
POST /api/auth/github- Initiate GitHub OAuth flowGET /api/auth/github/callback- Handle OAuth callbackPOST /api/auth/logout- End user session
GET /api/projects- List user projectsPOST /api/projects- Create new projectGET /api/projects/:id- Get project detailsPUT /api/projects/:id- Update projectDELETE /api/projects/:id- Delete project
GET /api/projects/:id/files- List project filesPOST /api/projects/:id/files- Create/upload filePUT /api/files/:id- Update file contentGET /api/files/:id/snapshots- Get file version history
POST /api/projects/:id/chat- Start chat sessionPOST /api/chat/:id/messages- Send chat messageGET /api/chat/:id/history- Get chat history
GET /api/ai/models- List available AI modelsPOST /api/ai/usage- Track AI model usage
- Real-time collaborative editing with WebSockets
- Advanced AI code completion and suggestions
- Plugin system for custom extensions
- Integrated debugging tools
- Multi-language syntax highlighting
- Code review and commenting system
- Project templates and scaffolding
- Advanced search and navigation
- Performance analytics and monitoring
- Mobile companion app
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by modern code editors like Cursor and VSCode
- Built with the amazing React and Express.js ecosystems
- Powered by Prisma for type-safe database operations
- GitHub's OAuth platform for seamless authentication
Note: This project is currently in active development. Features and API endpoints may change as the platform evolves.