- 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>
7.2 KiB
Rothbard Client Portal
A secure, server-side rendered client portal for Rothbard Law Group that enables authenticated users to view and manage their legal cases from the Filevine case management platform.
Overview
This web application provides a customized interface for law firm clients to:
- Authenticate securely using Firebase Authentication
- View their assigned legal cases and matters
- Access case details including client information, matter descriptions, and contacts
- Interact with Filevine API data in a user-friendly dashboard format
Architecture
The application is built with:
- Backend: Flask (Python) web server
- Frontend: Server-side rendered HTML with Tailwind CSS
- Authentication: Firebase Authentication with session management
- Database: Firestore for user profiles and preferences
- External API: Filevine API for case management data
Project Structure
rothbard/
├── app.py # Main Flask application with routes and API integrations
├── generate_sample.py # Utility to generate sample Filevine API responses
├── requirements.txt # Python dependencies
├── rothbard-service-account.json # Firebase service account credentials
├── static/
│ └── auth.js # Client-side authentication handling
├── templates/ # Jinja2 HTML templates
│ ├── base.html # Base template with navigation
│ ├── login.html # Firebase login page
│ ├── welcome.html # User welcome/onboarding page
│ └── dashboard.html # Main case dashboard
├── examples/ # Sample Filevine API responses
│ ├── project_list.json
│ ├── project_contacts.json
│ └── client.json
└── .env # Environment variables (not tracked)
Core Features
Authentication System
- Firebase Authentication integration for secure user login
- Server-side session management with 8-hour expiration
- User profile management in Firestore
- Role-based access control (admin-enabled users only)
Case Management Dashboard
- Real-time fetching of projects from Filevine API
- Project filtering based on user's assigned email
- Detailed case information display including:
- Client names and matter descriptions
- Project numbers and incident dates
- Contact information and project URLs
- Responsive design using Tailwind CSS
API Integration
- OAuth 2.0 authentication with Filevine API
- Bearer token management and refresh
- Comprehensive data fetching:
- Project lists with pagination support
- Individual project details
- Client information
- Project contacts
Configuration
Required Environment Variables
Create a .env file with the following variables:
# Flask Configuration
FLASK_SECRET_KEY=your-secret-key-here
# Firebase Configuration
FIREBASE_API_KEY=your-firebase-api-key
FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
FIREBASE_PROJECT_ID=your-firebase-project-id
FIREBASE_APP_ID=your-firebase-app-id
FIREBASE_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}' # or set GOOGLE_APPLICATION_CREDENTIALS
# Filevine API Configuration
FILEVINE_CLIENT_ID=your-filevine-client-id
FILEVINE_CLIENT_SECRET=your-filevine-client-secret
FILEVINE_PERSONAL_ACCESS_TOKEN=your-filevine-pat
FILEVINE_ORG_ID=your-filevine-org-id
FILEVINE_USER_ID=your-filevine-user-id
Firebase Setup
- Create a Firebase project at https://console.firebase.google.com
- Enable Authentication with Email/Password provider
- Create a Firestore database
- Generate a service account key and save as
rothbard-service-account.json - Configure Authentication settings for your web app
Filevine API Setup
- Obtain API credentials from your Filevine account
- Create a Personal Access Token (PAT)
- Note your Organization ID and User ID
- Configure OAuth 2.0 client credentials
Installation and Setup
-
Clone the repository
git clone <repository-url> cd rothbard -
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install dependencies
pip install -r requirements.txt -
Configure environment variables
cp .env.example .env # if available # Edit .env with your configuration -
Initialize Firebase
- Place your service account JSON file at
rothbard-service-account.json - Or set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable
- Place your service account JSON file at
-
Run the application
python app.pyThe application will be available at
http://localhost:5000
Usage
For Users
- Navigate to the application URL
- Sign in using Firebase Authentication (email/password)
- If not yet enabled, users will see a welcome page until an administrator enables their account
- Once enabled, users can access their case dashboard showing:
- All assigned projects/matters
- Client information and contact details
- Project metadata and links to Filevine
For Administrators
- User profiles are stored in Firestore at
users/{uid} - Enable users by setting
enabled: trueand providing acaseEmail - The
caseEmailfield determines which projects the user can access
Development Tools
Generate Sample API Data
Use the provided utility to generate sample Filevine API responses:
python generate_sample.py
This will create JSON files in the examples/ directory containing:
- Sample project lists
- Project contacts
- Client information
These samples are useful for development and testing without hitting the live API.
Security Considerations
- All API communications use HTTPS
- Firebase ID tokens are verified server-side
- Sessions have limited duration (8 hours)
- User access is controlled through Firestore profiles
- Sensitive credentials are stored in environment variables
- Filevine API tokens are properly scoped and managed
Future Enhancements
Planned improvements include:
- Firebase security rules hardening
- Terraform infrastructure as code for Firebase setup
- User-customizable dashboard columns
- Enhanced styling and responsive design
- Self-service user registration
- Administrative user management interface
- Real-time case updates
- Document upload/download capabilities
- Case status tracking and notifications
Dependencies
- Flask 3.0.3 - Web framework
- firebase-admin 6.6.0 - Firebase server SDK
- python-dotenv 1.0.1 - Environment variable management
- requests 2.32.3 - HTTP client for API calls
- itsdangerous 2.2.0 - Security utilities for Flask
API Endpoints
Internal Application Routes
GET /- Home route (redirects based on auth status)GET /login- Firebase login pagePOST /session_login- Firebase ID token exchangeGET /logout- Session terminationGET /welcome- User onboarding pageGET /dashboard- Main case dashboard (authenticated users only)
Filevine API Integration
- Projects:
/fv-app/v2/Projects - Project Details:
/fv-app/v2/Projects/{id} - Contacts:
/fv-app/v2/projects/{id}/contacts - Client Info:
/fv-app/v2/contacts/{id}
License
This project is proprietary software for Rothbard Law Group.