Full-stack application combining LlamaIndex vector search with Neo4j knowledge graph (GraphRAG) for answering queries about Netflix marketing materials. Flask/Hypercorn backend with custom ReAct agent, React frontend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.4 KiB
Netflix GraphRAG Development Guide
Authentication Bypass for Local Development
The application has been configured to bypass Microsoft authentication (MSAL) when running in development mode. This makes local development easier by:
- Skipping the Microsoft login screen entirely
- Automatically using a development user (
dev_user@local) - Allowing backend API requests without MSAL tokens
- Providing mock responses when the backend is unavailable
How to Run in Development Mode
Frontend
To run the frontend in development mode with auth bypass:
cd chat-interface
./dev.sh
Or manually:
cd chat-interface
npm run dev
Make sure the .env.development file exists with:
VITE_NODE_ENV=development
VITE_MODE=development
Backend
The backend automatically detects development mode and accepts requests with the username dev_user@local when the PRODUCTION flag is set to False.
For example:
# In routes.py
if not PRODUCTION and (not username or username == ""):
username = "dev_user@local"
How Authentication Bypass Works
Frontend
-
In
main.jsx:- The application checks for development mode using
import.meta.env - In development mode, MSAL initialization is skipped
- The application renders immediately without showing the login screen
- The application checks for development mode using
-
In
auth.js:- The
getCurrentUser()function returnsdev_user@localin development mode - The
isAuthenticated()function always returnstruein development mode - The
initializeMSAL()function skips MSAL initialization in development mode
- The
-
In
App.jsx:- All API requests include the
X-MS-USERNAMEheader withdev_user@local - In development mode, the application can work without a backend connection
- It provides mock responses for chat messages and mock conversations
- JSON parsing errors are caught and handled gracefully
- All API requests include the
Development-Only Features
The frontend includes several development-specific features:
-
Mock Chat Interface:
- In development mode, the chat interface works without needing a backend
- User messages get mock responses based on their content
- Sources and reasoning information are simulated
-
Mock Conversations:
- Development mode creates sample conversations automatically
- No need to set up a database or backend service
-
Error Resilience:
- All backend API calls are wrapped with development fallbacks
- Even if API requests fail or return invalid JSON, the UI continues working
- Clear console logging shows when development mode is active
Backend Development
The backend automatically detects development mode and accepts requests with the username dev_user@local.
-
In
routes.py:- API endpoints check for the
PRODUCTIONflag - In development mode, if no username is provided,
dev_user@localis used - Authentication validation is bypassed for this development user
- API endpoints check for the
-
In environment configuration:
- The
.envfile contains API keys and other sensitive information - These are loaded using
dotenvinconfig.py
- The
Troubleshooting
If you're still seeing the login screen in development mode:
- Check that the
.env.developmentfile exists in thechat-interfacedirectory - Verify that you're running with
npm run devor the provideddev.shscript - Look at the browser console for any errors or authentication messages
- If needed, clear browser cache and localStorage
If the chat interface shows errors connecting to the backend:
- The application should still work in development mode without a backend
- Check console logs for "Development mode" messages to confirm it's running in dev mode
- If needed, restart the development server
API Testing
When testing backend APIs directly, include the development username in requests:
curl -X POST http://localhost:5000/chat \
-H "Content-Type: application/json" \
-H "X-MS-USERNAME: dev_user@local" \
-d '{"message": "Hello", "sessionId": "your_session_id"}'
Running Without Backend
The frontend is now configured to run independently in development mode, even if the backend is not available. This is useful for:
- UI development without setting up the full backend stack
- Testing the chat interface flow without a working backend API
- Demonstrating the UI to stakeholders without backend dependencies
In this mode, all chat messages will receive simulated responses, and the conversation history will be populated with mock data.