Big OMG is a React application that analyzes the time complexity of user-inputted code. It helps developers optimize their algorithms by providing insights into the performance of their code using AI models.
- Code Analysis: Input your code and get instant time complexity analysis
- Multiple AI Models: Choose from Claude Opus 4 and GPT-4.1 for analysis
- Markdown Rendering: Explanations are rendered in beautiful markdown format
- Responsive Design: Works on desktop and mobile devices
- Real-time Analysis: Get results instantly after submitting your code
Before running this application, make sure you have:
- Node.js (version 16 or higher)
- npm (comes with Node.js)
- Backend API running (see Backend Repository)
git clone <repository-url>
cd big-omg-react
npm install
Make sure your backend API is running and update the API endpoint in your configuration if needed. The application expects the backend to be available at the URL specified in your API configuration.
npm start
The application will open in your browser at http://localhost:3000
.
src/
├── components/
│ ├── AppContainer.jsx # Main layout container
│ ├── Form.jsx # Code input and model selection
│ ├── AnswerArea.jsx # Results display
│ └── Logo.jsx # Application logo
├── hooks/
│ └── useFetchBigO.js # Custom hook for API calls
├── helpers/
│ └── appContext.js # React context for state management
├── api/
│ ├── queryClient.js # React Query configuration
│ └── axiosInstance.js # Axios HTTP client setup
└── App.jsx # Root component
- Purpose: Main layout container that divides the screen into two columns
- Layout: Uses flexbox to create a responsive two-column layout
- Structure:
- Header with logo
- Left column: Form (code input + model selection)
- Right column: Answer area (results display)
- Purpose: Handles user input and form submission
- Features:
- Model selector dropdown (Claude Opus 4, GPT-4.1)
- Code textarea for algorithm input
- Analyze button for submission
- State Management: Uses React hooks for form state and API calls
- Purpose: Displays analysis results
- Features:
- Time complexity display
- Explanation with markdown rendering
- Scrollable content area
- Markdown Support: Uses
react-markdown
for rich text formatting
The application uses React Context (AppContext
) to manage global state:
// Context provides:
- bigOData: Analysis results from the API
- setBigOData: Function to update results
- isLoading: Loading state for UI feedback
- setIsLoading: Function to update loading state
- Purpose: Custom hook for making API calls to the backend
- Features:
- Sends code and selected model to backend
- Handles loading states
- Manages error handling
- Updates global state with results
- User selects a model and enters code
- Form submission triggers API call via
useFetchBigO
- Backend processes the code and returns analysis
- Results are displayed in the AnswerArea with markdown formatting
The application uses styled-components for CSS-in-JS styling:
- Dark Theme: Consistent dark background (#02000f)
- Responsive Design: Flexbox layouts that adapt to screen size
- Custom Components: Styled form elements, buttons, and containers
- Markdown Styling: Custom styles for code blocks, headers, lists, etc.
- Select a Model: Choose between Claude Opus 4 or GPT-4.1 from the dropdown
- Enter Your Code: Paste or type your algorithm in the code textarea
- Analyze: Click the "Analyze" button to submit your code
- View Results: See the time complexity and detailed explanation
def twoSum(self, nums: List[int], target: int) -> List[int]:
numsDict = {}
for i, num in enumerate(nums):
complement = target - num
foundIndex = numsDict.get(complement, None)
if foundIndex is not None:
return [foundIndex, i]
else:
numsDict[num] = i
- Time Complexity: O(n)
- Explanation: Detailed markdown-formatted explanation of the algorithm's performance characteristics
The application is deployed at: https://big-omg-react.uw.r.appspot.com/
npm run build
This creates an optimized production build in the build/
directory.
This frontend requires the backend API to be running. The backend should:
- Accept POST requests with code and model parameters
- Return JSON with
big_o
(time complexity) andexplanation
fields - Support the models:
claude-opus-4-20250514
andgpt-4.1
Backend repository: https://github.com/Qlwentt/big-omg-api
- API Connection Errors: Ensure the backend is running and accessible
- Model Selection Issues: Verify the backend supports the selected model
- Styling Issues: Check that all dependencies are properly installed
- Use browser developer tools to inspect the layout and debug styling issues
- Check the Network tab to monitor API calls
- Use React Developer Tools to inspect component state
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request