codeflash-internal/js/README.md
Kevin Turcios d7a8b8f227
perf: fix CI build + lazy-load heavy libs + parallelize DB queries (#2601)
## Summary
- **Fix CI build failure**: Auth0Client crashes during Next.js
prerendering when env vars aren't set. Returns a no-op stub (`getSession
→ null`) when domain is missing — semantically correct for static
generation
- **Lazy-load markdown libs (~260kb)**: ReactMarkdown, remarkGfm, and
react-syntax-highlighter were eagerly imported in monaco-diff-viewer but
only rendered when user expands "Generated Tests". Extracted into a
dynamic component
- **Parallelize repo detail query**: `getRepositoryById` ran the
activity count sequentially after the repo lookup. Since `repoId` is
already available, all three queries now run in parallel

## Test plan
- [ ] CI `build` check passes (was failing since #2598)
- [ ] Trace page still renders generated tests correctly when expanded
- [ ] Repository detail page loads correctly with activity status
2026-04-13 11:03:05 -05:00

97 lines
1.9 KiB
Markdown

# CodeFlash AI
## Overview
CodeFlash AI is a JavaScript/TypeScript monorepo that provides a scalable and modular architecture for web applications, focusing on efficient code sharing and robust development practices.
## Project Structure
```
js/
├── common/ # Shared code and database schema
├── cf-api/ # Backend API service
├── cf-webapp/ # Next.js web application
├── VSC-Extension/ # VS Code extension
└── pnpm-workspace.yaml
```
## Prerequisites
- Node.js (v20+)
- pnpm (v10+): `npm install -g pnpm`
- Prisma CLI (installed as devDependency)
## Setup
### 1. Clone the Repository
```bash
git clone https://github.com/your-org/codeflash-ai.git
cd codeflash-ai/js
```
### 2. Install Dependencies
```bash
# Install all workspace dependencies from js/
pnpm install
```
### 3. Database Configuration
```bash
# Generate Prisma client and run migrations
cd common
pnpm prisma generate
pnpm prisma migrate dev
```
## Development Workflow
### Start Development Servers
```bash
# From js/ workspace root:
pnpm --filter cf-api dev
pnpm --filter cf-webapp dev
```
### Build
```bash
# Build individual packages
pnpm --filter cf-webapp build
pnpm --filter cf-api build
pnpm --filter @codeflash-ai/common build
```
## Key Components
### Common Package (`@codeflash-ai/common`)
- Shared TypeScript utilities
- Prisma database schema
- Reusable functions across projects
- Referenced as `"workspace:*"` by cf-api and cf-webapp
#### Usage Example
```typescript
import { createOrUpdateUser } from "@codeflash-ai/common"
```
## Best Practices
1. Always install from the workspace root (`js/`)
2. Keep shared logic in the `common` package
3. Use TypeScript for type safety
4. Follow existing code structure
5. Never commit sensitive data or build artifacts
## Publishing common Package
```bash
cd common
pnpm build
pnpm publish
```