171 lines
8.0 KiB
Markdown
171 lines
8.0 KiB
Markdown
# Rothbard Client Portal - Project Overview
|
|
|
|
This document provides a high-level overview of the Rothbard Client Portal system for non-technical stakeholders. It explains the deployed components, how to access them, and the structure of the underlying codebase.
|
|
|
|
## System Components
|
|
|
|
The Rothbard Client Portal is a web application that allows law firm clients to securely view and manage their legal cases. The system is built using modern cloud technologies and follows best practices for security and scalability.
|
|
|
|
### Key Technologies Used
|
|
|
|
- **Frontend**: Server-side rendered HTML with Tailwind CSS
|
|
- **Backend**: Flask (Python) web server
|
|
- **Authentication**: Firebase Authentication
|
|
- **Database**: Firestore
|
|
- **Infrastructure**: Google Cloud Platform (GCP)
|
|
- **Deployment**: Google Cloud Run with automated CI/CD
|
|
|
|
## Google Cloud Platform (GCP) Components
|
|
|
|
The application is deployed and hosted on Google Cloud Platform with the following key components:
|
|
|
|
### 1. Google Cloud Project
|
|
This is the hub for all of the deployment components. From here you should be able to find the rest of what's shown below.
|
|
- **Project Name**: rothbard-staging2 (shortly to be renamed rothbard-prod)
|
|
- **Project ID**: rothbard-staging2-12345
|
|
- **Region**: us-central1
|
|
|
|
**Access Link**: [Google Cloud Console](https://console.cloud.google.com/home/dashboard?project=rothbard-staging2-12345)
|
|
|
|
### 2. Firebase Authentication
|
|
This is a google service for managing user authentications. This is the same content that is used on the admin page, so you can add/delete users here too.
|
|
- Service for managing user authentication
|
|
- Secure login with email/password
|
|
- Session management with 8-hour expiration
|
|
|
|
**Access Link**: [Firebase Console](https://console.firebase.google.com/project/rothbard-staging2-12345/authentication/providers)
|
|
|
|
### 3. Firestore Database
|
|
This is an interactive view of the firestore database. This basically stores a copy of the data in filevine, because the speed to query filevine directly is too slow. You can click through and see the raw data for the various components.
|
|
- NoSQL database for storing user profiles and preferences
|
|
- Securely stores user information with access controls
|
|
|
|
**Access Link**: [Firestore Console](https://console.firebase.google.com/project/rothbard-staging2-12345/firestore/data)
|
|
|
|
### 4. Google Cloud Run
|
|
This hosts the python application that serves the web page. It queries to the firestore database. If the app is having an error, it is likely related to this component. The logs are viewable here, too.
|
|
- Serverless platform for running the application
|
|
- Automatically scales based on demand
|
|
- Hosts the main Rothbard Client Portal application
|
|
- Also has a scheduled task every day to sync filevine data -> firestore
|
|
|
|
**Access Link**: [Cloud Run Console](https://console.cloud.google.com/run?project=rothbard-staging2-12345)
|
|
|
|
### 5. Google Container Registry
|
|
Each time a new version is deployed, it goes into this registry.
|
|
- Stores Docker containers for the application
|
|
- Used during the deployment process
|
|
|
|
**Access Link**: [Container Registry Console](https://console.cloud.google.com/gcr?project=rothbard-staging2-12345)
|
|
|
|
## Repository Structure
|
|
|
|
The source code for the application is organized in a structured way to support development and maintenance:
|
|
|
|
```
|
|
rothbard/
|
|
├── app.py # Main Flask application with routes and API integrations -- i.e., the logic for the web page
|
|
├── requirements.txt # Python dependencies
|
|
├── rothbard-service-account.json # Firebase service account credentials
|
|
├── rothbard-staging2-12345-firebase-adminsdk-fbsvc-7f95268383.json # Firebase service account for staging
|
|
├── 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
|
|
│ ├── admin_users.html # Admin user management interface
|
|
│ ├── admin_user_edit.html # Admin user edit interface
|
|
│ ├── admin_user_create.html # Admin user creation interface
|
|
│ └── _pagination.html # Pagination component
|
|
├── examples/ # Sample Filevine API responses - not needed except for exploration
|
|
│ ├── forms__complaintInfo.json
|
|
│ ├── forms__newFileReview.json
|
|
│ ├── project_tasks.json
|
|
│ ├── project_type_pahe_list.json
|
|
│ ├── project_team.json
|
|
│ └── ...
|
|
├── .env # Environment variables (not tracked)
|
|
├── .gcloudignore # Files ignored by Google Cloud Build
|
|
├── .gitignore # Files ignored by Git
|
|
├── cloudbuild.yaml # Google Cloud Build configuration
|
|
├── Dockerfile # Containerization configuration
|
|
├── deploy.sh # Deployment script
|
|
├── main.tf # Terraform infrastructure as code
|
|
├── firestore.rules # Firestore security rules
|
|
├── column_mapping.json # Column mapping configuration (unused)
|
|
├── DEPLOY.md # Deployment instructions
|
|
├── CLAUDE.md # Development guidance
|
|
└── utils.py # Utility functions for user profile management
|
|
```
|
|
|
|
## Deployment Process
|
|
|
|
The application follows an automated deployment process:
|
|
|
|
1. **Source Code Changes**: Developers push code changes to the repository
|
|
2. **CI/CD Pipeline**: Google Cloud Build automatically triggers
|
|
3. **Containerization**: The application is packaged into a Docker container
|
|
4. **Storage**: Container is stored in Google Container Registry
|
|
5. **Deployment**: Container is deployed to Google Cloud Run
|
|
6. **Application**: The application becomes available at its public URL
|
|
|
|
### Deployment Commands
|
|
A change can easily be deployed by running `./deploy.sh`, which is just shorthand for:
|
|
- Build and push container: `gcloud builds submit --tag gcr.io/rothbard-staging2-12345/rothbard-app`
|
|
- Deploy to Cloud Run: `gcloud run deploy rothbard-app --image gcr.io/rothbard-staging2-12345/rothbard-app:latest --region us-central1`
|
|
|
|
## Key Features
|
|
|
|
### Authentication System
|
|
- Secure user login using Firebase Authentication
|
|
- 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
|
|
- Responsive design using Tailwind CSS
|
|
- Configurable column visibility with local storage
|
|
- Pagination for large datasets
|
|
|
|
### Admin Interface
|
|
- Comprehensive user management dashboard
|
|
- Enable/disable user access
|
|
- Grant/revoke admin privileges
|
|
- Reset user passwords
|
|
- Create new users
|
|
- View all user profiles
|
|
|
|
## 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
|
|
- Firestore security rules restrict access to user's own profile
|
|
- Google Cloud Build and deployment use secure practices
|
|
|
|
## How to Access the System
|
|
|
|
### Application URL
|
|
The main application is accessible at: [https://rothbard-app-ucj555555-uc.a.run.app](https://rothbard-app-ucj555555-uc.a.run.app)
|
|
|
|
### Administrative Access
|
|
Administrative functions are available at: [https://rothbard-app-ucj555555-uc.a.run.app/admin/users](https://rothbard-app-ucj555555-uc.a.run.app/admin/users)
|
|
|
|
## Infrastructure as Code
|
|
|
|
The infrastructure is defined using Terraform (main.tf), which allows for consistent and reproducible deployments. This ensures that all components are created with the same configuration every time.
|
|
|
|
## Support and Maintenance
|
|
|
|
The system is designed to be:
|
|
- Scalable to handle varying loads
|
|
- Secure with proper authentication and authorization
|
|
- Maintainable with clear separation of concerns
|
|
- Observable with proper logging and monitoring |