- Expand README.md with detailed architecture overview, configuration guide, and usage instructions - Add CLAUDE.md with development commands and implementation details for Claude Code assistance - Document authentication flow, API integration, and security considerations - Include setup instructions for Firebase, Filevine API, and local development environment - Add project structure documentation and future enhancement roadmap 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.7 KiB
3.7 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
# Environment setup
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Development server (runs on http://localhost:5000)
python app.py
# Generate sample Filevine API responses for development/testing
python generate_sample.py
Architecture Overview
This is a Flask-based client portal for Rothbard Law Group that provides secure access to Filevine case management data. The application uses a server-side rendered architecture with Firebase Authentication and integrates with the Filevine API.
Core Authentication Flow
- Client-side: Firebase Authentication (email/password) in login.html
- Server-side: ID token verification and session creation in
/session_login - Session Management: Flask sessions with 8-hour expiration
- Access Control: User profiles in Firestore (
users/{uid}) control access viaenabledandcaseEmailfields
Key Architecture Components
Flask Application (app.py)
- Main application server with authentication, session management, and Filevine API integration
- Implements role-based access control through Firestore user profiles
- Contains all Filevine API integration functions with OAuth 2.0 authentication
Template System
- Jinja2 templates with Tailwind CSS for styling
base.html: Navigation and layout foundationlogin.html: Firebase authentication interfacedashboard.html: Main case data display tablewelcome.html: Onboarding for non-enabled users
Filevine API Integration
- OAuth 2.0 using Personal Access Token for authentication
- Key functions:
get_filevine_bearer(),list_all_projects(),fetch_project_detail(),fetch_client(),fetch_contacts() - Projects filtered by user's assigned
caseEmailfrom Firestore profile
User Management
- User profiles stored in Firestore at
users/{uid}with fields:enabled: Boolean for access controlcaseEmail: Determines which Filevine projects user can access
- Users see welcome page until enabled by administrator
Configuration Requirements
Environment Variables (.env)
- Flask:
FLASK_SECRET_KEY - Firebase:
FIREBASE_API_KEY,FIREBASE_AUTH_DOMAIN,FIREBASE_PROJECT_ID,FIREBASE_APP_ID - Firebase Admin:
FIREBASE_SERVICE_ACCOUNT_JSONorGOOGLE_APPLICATION_CREDENTIALS - Filevine API:
FILEVINE_CLIENT_ID,FILEVINE_CLIENT_SECRET,FILEVINE_PERSONAL_ACCESS_TOKEN,FILEVINE_ORG_ID,FILEVINE_USER_ID
Firebase Setup
- Service account credentials file:
rothbard-service-account.json - Firestore database for user profiles
- Firebase Authentication with email/password provider
Development Tools
Sample Data Generation
generate_sample.pycreates sample Filevine API responses inexamples/directory- Useful for development without hitting live API
- Generates project lists, contacts, and client information samples
Key Implementation Details
Session Management
- Sessions include
uidandexpires_at - Automatic redirects based on user enablement status
login_requireddecorator protects authenticated routes
API Data Flow
- Dashboard fetches Filevine bearer token using OAuth 2.0
- Lists all projects with pagination support
- Filters projects by user's
caseEmail - Fetches detailed data for each project (client info, contacts)
- Renders data in responsive table format
Security Implementation
- Firebase ID tokens verified server-side
- All API communications use HTTPS
- Sensitive credentials stored in environment variables
- User access controlled through Firestore profiles
- Filevine API tokens properly scoped and managed