The Platform
Built for mission-critical legal ops
LexFlow isn't just software. It's a cloud-native architecture on AWS with hard multi-tenant isolation, high availability, end-to-end encryption and responsible AI. This is how we protect and scale your legal data.
Cloud Architecture
Cloud-native, end to end on AWS
Every layer was picked to maximize security, scalability and resilience. No servers to manage, no bottlenecks, no critical single points of failure.
Presentation Layer
Next.js 14 + CloudFront
Landing, admin portal and tenant portal as static sites distributed globally by CloudFront with ACM wildcard certificates. Minimal latency from any location, zero web servers to maintain.
API Layer
API Gateway + AWS Lambda + FastAPI
Python API built on FastAPI running on AWS Lambda (Mangum) behind an API Gateway HTTP API. Automatic scaling, pay-per-use, no idle capacity. 104 endpoints live, Cognito JWT authentication on every request.
Data Layer
PostgreSQL 16 RDS + S3
Managed PostgreSQL 16 on RDS with automated daily backups and 7-day retention. Documents in S3 with short-lived pre-signed URLs (5 minutes). Row-Level Security and mandatory tenant_id filters on every table.
Async Processing
SQS + EventBridge + Worker Lambda
Document uploads, OCR, AI embeddings and notifications run off the HTTP request path. EventBridge Scheduler drives recurring jobs (30/15/7-day alerts). Automatic retries on transient failures.
Identity & Access
AWS Cognito + MFA
Enterprise authentication with Cognito User Pools, USER_PASSWORD_AUTH flow, optional TOTP-based MFA. Signed JWT with role scopes, verified on every API call.
Observability
CloudWatch + Audit Log
Structured logs, metrics and alarms in CloudWatch. On top of that, every sensitive action is written to an immutable audit log in the database (who, what, when, from where).
Defense in Depth
Layered security, not a perimeter
We assume any layer can fail. That's why we design redundant controls at every level: network, application, data and AI.
Encryption at rest
All documents in S3 use SSE-S3 (AES-256). RDS storage encryption enabled. In EPIC 21 we migrate to a dedicated KMS CMK per tenant.
Encryption in transit
TLS 1.2+ enforced on every endpoint. AWS-managed ACM certificates with automatic renewal. HSTS enabled on CloudFront.
Multi-tenant isolation
tenant_id NOT NULL on every business table. Middleware extracts tenant_id from the JWT and injects it into every query. PostgreSQL Row-Level Security as an additional safety net.
Server-side RBAC
Permissions validated on the backend for every endpoint, never the UI alone. Roles: admin, legal_ops, legal_user, viewer, each with specific scopes.
No public document URLs
Documents are never directly accessible. We mint pre-signed S3 URLs that expire in 5 minutes, validating ownership and permissions before issuing them.
Immutable audit log
Every login, query, edit, download and deletion is logged with timestamp, IP, user-agent and tenant. Insert-only: the history cannot be modified or deleted.
High Availability
Engineered not to stop
99.9% SLA on Pro and Enterprise plans. Serverless infrastructure that scales automatically under spikes and recovers on its own.
99.9%
Uptime SLA (Pro)
Contractual penalties in Enterprise
<200ms
API p95 latency
Measured from Mexico City to us-east-2
Multi-AZ
RDS replication
Automatic failover on zone outage
24/7
Automated monitoring
CloudWatch alarms + on-call notification
Combining Lambda (automatic scaling with no intervention), RDS Multi-AZ (synchronous replica in a second availability zone) and CloudFront (global cache) lets us absorb traffic spikes without degradation and keep running during partial AWS failures.
Redundancy & Resilience
Your data, triply safe
Data loss is not an option in a legal system. We use the strongest durability guarantees on the market and add our own layers on top.
S3: 99.999999999% durability
AWS automatically replicates every document across at least 3 availability zones within the region. The probability of losing an object is effectively zero (eleven nines).
RDS with daily backups
Daily automated snapshots with 7-day retention. Second-level point-in-time recovery. Additional long-retention weekly backups for audit.
Disaster Recovery us-east-1
Secondary region ready for cross-region DR. Target RTO 4 hours, RPO 1 hour. Runbook maintained and tested.
Retries and dead-letter queues
SQS guarantees delivery with exponential retries. Failed messages land in a Dead Letter Queue for manual inspection without being lost.
Tech Stack
Mature technologies, chosen with intent
Every component is an industry standard, running in production at thousands of companies. No experimental tech on the critical path.
Frontend
- Next.js 14React framework with SSG/SSR
- Tailwind CSS v4Utility-first CSS
- TypeScriptStrict end-to-end typing
Backend
- Python 3.12Modern runtime, type hints
- FastAPIHigh-performance async API
- Pydantic v2Validation and serialization
- SQLAlchemy 2ORM with async support
Data
- PostgreSQL 16Relational, ACID database
- pg_trgmTrigram fuzzy search
- AlembicVersioned migrations
AWS
- LambdaServerless compute
- API GatewayHTTP API
- RDSManaged PostgreSQL
- S3Object storage
- SQS + EventBridgeQueues and scheduling
- CognitoIdentity and access
- CloudFrontGlobal CDN
- SESTransactional email
Security
- AWS WAFWeb application firewall
- AWS ShieldManaged DDoS protection
- IAMFine-grained access control
- CloudTrailAPI call audit trail
- KMSCryptographic key management
- Secrets ManagerSecret rotation and custody
- ACMManaged TLS certificates
- reCAPTCHA v3Bot defense on public forms
AI
- Amazon BedrockManaged LLM, zero-retention
- Anthropic ClaudePrimary chatbot model
- RAGPer-tenant context retrieval
Responsible AI
AI that never compromises your data
AI capabilities are powerful, but legal data is sensitive. Our design guarantees that AI usage never trains third-party models or leaks information between tenants.
Zero-retention with the provider
We work with providers (Bedrock, Anthropic) under no-retention contracts: prompts and responses are not stored on the provider's side nor used to train models.
Hard tenant isolation
The context sent to the model only contains data belonging to the authenticated user's tenant. Mandatory filters and server-side verification before every call.
Irreversible embeddings
For semantic search we use numerical vectors derived from text. The provider never receives the original document content, only its mathematical representation.
Mandatory disclosure
Users always know when they are interacting with AI. Generated responses are explicitly tagged and the user can inspect the source document.
Complete usage log
Every call is written to ai_usage_log: tenant, user, provider, model, tokens, cost and status. Auditable and internally billable.
Humans in the loop
AI assists — it doesn't decide. Every document generated, classified or summarized by AI is surfaced for human review and correction before becoming official.
Compliance & Audit
Built for legal and regulatory audits
Legal teams can't afford traceability gaps. We designed the platform to answer any audit question with evidence.
- Immutable log of every action: login, read, edit, download, delete, print
- Version control with checksums on every document
- Authoritative server-side timestamps, not client-side
- Export of activity logs by entity and date range
- Separation of duties by role (RBAC)
- Data is the customer's property and is delivered in full upon contract termination
- Aligned with LFPDPPP best practices (Mexico) with a roadmap toward ISO 27001
Want to talk to the technical team?
We'll walk you through the architecture in detail
Book a technical session with our team: we answer questions about security, integration, SLA, infrastructure or any specific requirement from your IT group.