React application for ZipCase.
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env.local
# Edit .env.local with your local development settings
# Start development server
npm run devCheck code quality and style with ESLint:
npm run lintVerify TypeScript types:
npm run typecheckRun tests for the frontend components:
# Run all tests
npm run test
# Run tests in watch mode (automatically reruns when files change)
npm run test:watch
# Run tests with coverage report
npm run test:coverage
# Run a specific test file
npm run test -- path/to/test-file.test.tsxFor thorough checking before committing, run:
npm run lint && npm run typecheck && npm run testThe application uses environment variables for configuration:
API_URL: The URL for the backend APIPORTAL_URL: The URL for the court portalPORTAL_CASE_URL: The URL for case data in the court portalCOGNITO_USER_POOL_ID: Cognito User Pool IDCOGNITO_CLIENT_ID: Cognito Client ID
Note: For local development, configured with Vite, these will be prepended with VITE_
For local development:
- Copy
.env.exampleto.env.local - Edit
.env.localwith your specific configuration
For production deployment:
- These values are injected during the CI/CD build process
- The values are sourced from AWS SSM Parameter Store or similar
- Deploy the infrastructure:
# Navigate to terraform directory
cd ../infra/terraform/dev
# Initialize terraform
terraform init
# Apply terraform configuration
terraform apply -var-file=variables.tfvars# Build and deploy to dev environment
npm run deploy:devThis script:
- Builds the React application
- Syncs the build files to the S3 bucket
- Invalidates the CloudFront distribution cache
To deploy to production, create a similar deploy:prod script in package.json:
"deploy:prod": "npm run build && aws s3 sync dist/ s3://zipcase-frontend-prod && aws cloudfront create-invalidation --distribution-id YOUR_PROD_DISTRIBUTION_ID --paths \"/*\""The frontend is deployed to AWS with the following components:
- S3 bucket for static file hosting (in your default region)
- CloudFront distribution for content delivery
- Route53 for DNS configuration
- ACM certificate in us-east-1 (required for CloudFront)
The frontend uses the following domain pattern:
- Development:
dev.zipcase.org - Production:
zipcase.org(root domain)
While most of your resources are in us-east-2, CloudFront requires certificates to be in us-east-1. The Terraform configuration handles this by:
- Creating a new ACM certificate in us-east-1 specifically for CloudFront
- Creating a dedicated Route53 zone for the frontend domain
- Setting up DNS validation records in this zone
- Waiting for certificate validation before creating the CloudFront distribution
This multi-region approach is a standard pattern for AWS CloudFront deployments.
After deploying the infrastructure, you'll need to configure your domain registrar to point to the AWS nameservers for your frontend domain. The nameservers can be found in the AWS Console under Route53 > Hosted zones > [your frontend domain] > NS record.