A modern, professional React application featuring a corporate login system and AI-powered financial agent interface. Built with reusable components and a comprehensive design system.
- Node.js 16.x or higher
- npm 8.x or higher
-
Clone the repository:
git clone <repository-url> cd AiFrontend
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open your browser:
http://localhost:3000
That's it! π The application will be running with hot reload enabled.
The application requires API keys to communicate with the AI backend. Follow these steps:
-
Create a
.envfile in the project root:touch .env
-
Add your API configuration to the
.envfile:# AI Agent API Configuration REACT_APP_AI_API_URL=https://your-api-gateway-url.amazonaws.com/prod/ REACT_APP_AI_API_KEY=your-api-key-here -
Restart the development server after updating environment variables:
npm start
Current Implementation: Due to CORS restrictions from the API Gateway, the application uses a proxy configuration in package.json:
{
"proxy": "https://fqmsebyf3j.execute-api.us-east-1.amazonaws.com"
}How it works:
- In development, API calls go to
/prod/(proxied to the actual endpoint) - In production, the app uses the full URL from
REACT_APP_AI_API_URL - The
aiApiService.jsautomatically switches between proxy and direct calls
- Never commit real API keys to version control
- Use different API keys for development and production
- Consider using AWS IAM roles for production deployments
| Route | Description | Direct Access |
|---|---|---|
/ or /login |
Corporate login page with validation | β |
/ai-agent |
AI Financial Agent Dashboard | β |
/demo |
Component library demonstration | β |
Option 1: Direct Access (Recommended)
- Navigate to:
http://localhost:3000/ai-agent - Ensure your API keys are configured (see API Configuration above)
Option 2: Through Login Form
- Use any email (e.g.,
demo@company.com) - Use any password (6+ characters, e.g.,
password123) - Currently shows mock authentication (no actual redirect)
- Professional corporate branding with dark header/footer
- Real-time form validation with visual feedback
- Responsive design optimized for all devices
- FontAwesome icons and security indicators
- Subtle corporate design patterns
- Three-panel dashboard with professional layout
- Interactive chat interface with AI avatar and real API integration
- Error handling with visual feedback for API failures
- Loading states with professional animations during API calls
- Financial data visualization with extensible message formats
- Quick actions panel for common financial queries
- Live API connectivity via AWS Lambda backend (requires API key)
- Responsive design that collapses gracefully on mobile
- 20+ modular components ready for reuse
- Design system with consistent colors, typography, and spacing
- Multiple button variants (primary, secondary, action)
- Rich message components for financial data
- Form inputs with validation states
src/
βββ components/
β βββ chat/ # Chat interface components
β β βββ AIAvatar.js # AI avatar with status
β β βββ Message.js # Client/AI message bubbles
β β βββ ChatInput.js # Professional chat input
β βββ forms/
β β βββ FormInput.js # Validated form inputs
β βββ layout/
β β βββ CorporateHeader.js # Corporate header
β β βββ CorporateFooter.js # Compliance footer
β βββ login/
β β βββ LoginCard.js # Complete login form
β βββ panels/
β β βββ LeftPanel.js # Actions & history
β β βββ CenterPanel.js # Main chat area
β β βββ RightPanel.js # Data feeds & tools
β βββ ui/
β β βββ Button.js # Multi-variant buttons
β βββ demo/
β βββ ComponentDemo.js # Reusability showcase
βββ pages/
β βββ LoginPage.js # Complete login experience
β βββ AIAgentPage.js # Three-panel dashboard
βββ data/
β βββ mockData.js # Structured mock data
βββ styles/
βββ index.css # Design system & global styles
Colors:
- Brand Red:
#9A0718- Primary actions, highlights - Tamarillo:
#96151d- Hover states, secondary actions - Brand Brown:
#8d4900- Supporting elements - Corporate Grays: Complete scale from
#f9fafbto#111827
Typography:
- Font Family: "ff-primary", Helvetica, Arial, sans-serif
- Weights: 400 (regular), 700 (bold), 800 (heavy)
- Scale: 10px root, 12px body, up to 24px+ headings
Responsive Breakpoints:
- Mobile: β€768px
- Tablet: 769px-1024px
- Desktop: 1025px-1600px
- Large Desktop: β₯1601px
import Button from './components/ui/Button';
// Primary action button
<Button variant="primary" size="large">
Sign In
</Button>
// Secondary button with icon
<Button variant="secondary" icon="fas fa-download">
Export Report
</Button>
// Action button for panels
<Button variant="action">
Market Analysis
</Button>import Message from './components/chat/Message';
// Client message
<Message
type="client"
content="Analyze my portfolio performance"
timestamp="2:30 PM"
/>
// AI response with financial data
<Message
type="ai"
content={{
header: { title: "Portfolio Analysis", type: "Market Review" },
financialData: { totalReturn: "+12.4%", riskScore: "7.2/10" },
insights: ["Tech exposure above optimal", "Consider rebalancing"],
recommendations: [{ priority: "high", action: "Reduce tech allocation" }]
}}
timestamp="2:34 PM"
/>import CorporateHeader from './components/layout/CorporateHeader';
<CorporateHeader
brandName="Corporate Portal"
statusItems={[
{ icon: "fas fa-shield-alt", text: "Secure Login" },
{ icon: "fas fa-certificate", text: "Verified" }
]}
/>npm start # Start development server
npm build # Build for production
npm test # Run test suite
npm eject # Eject from Create React AppVisit /demo to see all components in action with different configurations:
- Interactive showcase of all components
- Multiple variants and states demonstrated
- Real-time examples of reusability
- Copy-paste code examples
The application is optimized for:
- Mobile devices (320px+)
- Tablets (768px+)
- Desktop screens (1024px+)
- Large displays (1600px+)
Modify CSS variables in src/styles/index.css:
:root {
--color-brand-red: #9A0718; /* Change primary brand color */
--color-tamarillo: #96151d; /* Change hover/accent color */
--color-brand-brown: #8d4900; /* Change supporting color */
}- Create component in appropriate
src/components/subfolder - Follow existing patterns for props and styling
- Add to
ComponentDemo.jsfor showcase - Update this README with examples
- Three-panel layout: Edit
AIAgentPage.jsand panel components - Login layout: Edit
LoginPage.jsandLoginCard.js - Global layout: Edit
CorporateHeader.jsandCorporateFooter.js
The application is designed for easy backend integration:
Current mock data in src/data/mockData.js includes:
- User authentication flows
- Financial market data
- Chat conversation history
- Corporate compliance information
Replace mock functions in:
LoginCard.js- Authentication endpointChatInput.js- AI chat APIRightPanel.js- Live market data feedsLeftPanel.js- User history/preferences
// Replace this in LoginCard.js:
const mockLogin = async (credentials) => {
return new Promise(resolve => setTimeout(resolve, 2000));
};
// With actual API call:
const login = async (credentials) => {
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(credentials)
});
return response.json();
};npm run buildNetlify:
npm run build
# Drag and drop the `build` folder to NetlifyVercel:
npm install -g vercel
vercelAWS S3 + CloudFront:
aws s3 sync build/ s3://your-bucket-name- Fork the repository
- Create a feature branch:
git checkout -b feature/new-component - Commit changes:
git commit -m 'Add new component' - Push to branch:
git push origin feature/new-component - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Components not loading:
- Ensure all dependencies are installed:
npm install - Clear node_modules and reinstall:
rm -rf node_modules && npm install
Styles not applying:
- Check that
src/styles/index.cssis imported insrc/index.js - Verify CSS variable names match between components and stylesheets
Build errors:
- Run
npm run buildto check for production build issues - Update Node.js to version 16+ if encountering compatibility issues
"CORS or Network error":
- Check if your API Gateway has CORS properly configured
- Verify the proxy setting in
package.jsonmatches your API endpoint - In production, ensure
REACT_APP_AI_API_URLis correctly set
"AI API key missing":
- Ensure your
.envfile exists and containsREACT_APP_AI_API_KEY - Restart the development server after adding environment variables
- Check that the API key is valid and has the correct permissions
API Timeout errors:
- The service has a 30-second timeout limit
- Check if your API Gateway/Lambda function is responding within this timeframe
- Monitor AWS CloudWatch logs for backend issues
- π§ Create an issue in the repository
- π¬ Check existing issues for similar problems
- π Review component examples in
/demoroute
CORS Workaround (Tracking Issue: #4)
Current State: The application uses a development proxy to work around CORS restrictions from the API Gateway.
Files involved:
package.json- Contains proxy configurationsrc/services/aiApiService.js- Handles environment-based URL switching.env- Contains production API configuration
Required API Gateway Changes:
{
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,x-api-key",
"Access-Control-Allow-Methods": "GET,POST,OPTIONS"
}Once CORS is fixed:
- Remove proxy configuration from
package.json - Update
aiApiService.jsto use direct API calls in all environments - Test production builds to ensure direct API connectivity
- Update documentation to remove CORS workaround instructions
Built with β€οΈ using React and modern web technologies
This application demonstrates professional-grade component architecture while maintaining pixel-perfect design fidelity from HTML mockups.