Bank of Anthos Investment Platform - Project Journey
What Inspired Me
The Bank of Anthos Investment Platform was inspired by the need to create a modern, scalable financial services application that demonstrates microservices architecture in a cloud-native environment. And at the same time, smartly invests a portion of the current balance based on spending habits. The project draws inspiration from:
- Real-world Banking Systems: Understanding how modern banks handle investment portfolios, tier-based fund allocation, and real-time market data processing
- Microservices Architecture: Building a distributed system that showcases the benefits of service decomposition and independent scalability
- Cloud-Native Technologies: Leveraging Kubernetes, containerization, and modern DevOps practices
- Financial Technology Innovation: Creating a system that can handle complex investment scenarios with real-time market updates and portfolio management
What we Learned
Technical Skills Gained
Microservices Architecture
- Service Decomposition: Breaking down a monolithic banking application into focused, single-responsibility services
- Inter-Service Communication: Implementing REST APIs, database connections, and event-driven patterns
- Service Discovery: Understanding how services find and communicate with each other in a distributed environment
- Data Consistency: Managing consistency across multiple databases and services
Database Design & Management
- PostgreSQL Integration: Working with multiple PostgreSQL instances for different data domains
- Schema Design: Creating normalized schemas for portfolios, transactions, queues, and assets
- Database Triggers & Views: Implementing automated data processing and reporting capabilities
- Connection Pooling: Managing database connections efficiently across services
Cloud-Native Development
- Containerization: Building Docker images for Python Flask applications
- Kubernetes: Creating deployments, services, and managing container orchestration
- Skaffold: Streamlining development workflows with automated building and deployment
Python & Flask Development
- RESTful API Design: Creating comprehensive APIs with proper error handling and validation
- Background Processing: Implementing continuous services that run without manual intervention
- Database Integration: Using psycopg2 for PostgreSQL connections and transaction management
- Threading & Concurrency: Managing background threads for continuous processing
Financial Domain Knowledge
- Portfolio Management: Understanding tier-based investment strategies and allocation models
- Market Data Processing: Implementing real-time market data simulation and processing
- Transaction Processing: Building queue-based systems for handling investment and withdrawal requests
- Risk Management: Implementing consistency checks and validation across financial operations
How we Built the Project
Phase 1: Foundation & Core Services
`markdown
Database Schema Design
- Created user-portfolio-db for portfolio management
- Designed queue-db for investment/withdrawal processing
- Implemented assets-db for market data storage
- Established proper relationships and constraints
Core Investment Services
- Built invest-svc for processing investment requests
- Created withdraw-svc for handling withdrawal operations
- Implemented portfolio-reader-svc for portfolio data access
- Developed investment-manager-svc for orchestrating operations `
Phase 2: Queue Management & Processing
`markdown
Queue Processing System
- Developed user-request-queue-svc for batch processing
- Implemented step5 functionality for global tier variable updates
- Created background processing with configurable intervals
- Built comprehensive queue management and monitoring
Market Data Integration
- Created market-reader-svc for market data simulation
- Implemented real-time price updates for various asset types
- Built analytics and reporting capabilities
- Integrated with assets-db for persistent market data `
Phase 3: Order Execution & Consistency
`markdown
Order Execution System
- Built execute-order-svc for buy/sell order processing
- Implemented probability-based execution logic
- Created tier pool management and fund verification
- Added comprehensive order tracking and status management
Consistency Management
- Developed consistency-manager-svc for data synchronization
- Implemented continuous background processing
- Built delta calculation for market value changes
- Created portfolio value and allocation updates `
Phase 4: Integration & Testing
`markdown
Service Integration
- Connected all services through well-defined APIs
- Implemented proper error handling and logging
- Created comprehensive health and monitoring endpoints
- Established data flow between all components
Testing & Validation
- Built comprehensive unit test suites for all services
- Implemented integration tests for service interactions
- Created performance tests for concurrent operations
- Validated step5 functionality and consistency management `
Phase 5: Deployment & Documentation
`markdown
Containerization & Deployment
- Created Dockerfiles for all services
- Built Kubernetes manifests with proper resource management
- Implemented Skaffold configurations for development
Documentation & AI Integration
- Wrote comprehensive llm.txt files for AI agent interaction
- Created detailed README files for each service
- Built API documentation with examples
- Implemented monitoring and observability features
- Developed agentic development patterns with structured documentation `
Challenges we Faced
Technical Challenges
Database Consistency Management
- Challenge: Maintaining data consistency across multiple databases (queue-db, user-portfolio-db, assets-db)
- Solution: Implemented consistency-manager-svc with continuous background processing and delta calculations
- Learning: Understanding eventual consistency patterns and implementing proper synchronization mechanisms
Step5 Implementation Complexity
- Challenge: Implementing the complex step5 requirement for updating global tier variables based on batch processing results
- Solution: Created comprehensive batch processing logic with proper status checking and environment variable management
- Learning: Mastering background processing patterns and global state management in microservices
Service Communication & Integration
- Challenge: Ensuring reliable communication between 10+ microservices with proper error handling
- Solution: Implemented comprehensive API design with proper HTTP status codes, error responses, and retry logic
- Learning: Understanding distributed system patterns and failure modes
Testing Distributed Systems
- Challenge: Testing complex interactions between multiple services with database dependencies
- Solution: Created comprehensive mocking strategies and integration test suites
- Learning: Mastering testing patterns for microservices and database interactions
Architecture Challenges
Scalability & Performance
- Challenge: Designing services that can handle concurrent operations and scale independently
- Solution: Implemented proper resource management, connection pooling, and asynchronous processing
- Learning: Understanding performance bottlenecks in distributed systems
Data Flow Complexity
- Challenge: Managing complex data flows between investment processing, queue management, and portfolio updates
- Solution: Created clear service boundaries and implemented proper event-driven patterns
- Learning: Mastering event-driven architecture and service orchestration
Development Challenges
Environment Variable Management
- Challenge: Managing 6+ tier environment variables across multiple services
- Solution: Implemented centralized environment variable management with proper validation
- Learning: Understanding configuration management in distributed systems
Error Handling & Recovery
- Challenge: Implementing robust error handling across services with proper recovery mechanisms
- Solution: Created comprehensive error handling with graceful degradation and retry logic
- Learning: Building resilient distributed systems
Documentation & AI Integration
- Challenge: Creating comprehensive documentation for AI agent interaction
- Solution: Developed detailed llm.txt files with API examples and usage patterns
- Learning: Understanding how to document systems for AI agent consumption
Agentic Development Acceleration
- Challenge: Enabling fast development cycles with AI agents while maintaining code quality
- Solution: Implemented comprehensive llm.txt files with detailed function descriptions, API specifications, and usage examples
- Learning: Structured documentation enables AI agents to understand and modify microservices independently
Key Achievements
Technical Accomplishments
- 10+ Microservices: Successfully built and integrated 10+ microservices
- 5 Databases: Implemented and managed 5 PostgreSQL databases with proper schemas
- Comprehensive APIs: Created 50+ API endpoints with proper documentation
- Background Processing: Implemented continuous processing services
- Testing Coverage: Built comprehensive test suites with 100+ test cases
- Agentic Development: Created 20+ llm.txt files enabling AI agents to understand and modify services
Architecture Achievements
- Cloud-Native: Full Kubernetes deployment with proper resource management
- Monitoring: Comprehensive health checks and monitoring endpoints
- Scalability: Services designed for independent scaling and high availability
Business Logic Achievements
- Investment Processing: Complete investment and withdrawal processing pipeline
- Portfolio Management: Real-time portfolio updates with market data integration
- Queue Management: Batch processing with proper status tracking
- Consistency Management: Automated data synchronization across services
Future Enhancements
Technical Improvements
- Event Streaming: Implement Apache Kafka for real-time event processing
- Caching Layer: Add Redis for improved performance and reduced database load
- API Gateway: Implement proper API gateway for centralized routing and security
- Monitoring: Add Prometheus and Grafana for comprehensive observability
Business Features
- Advanced Analytics: Implement portfolio performance analytics and reporting
- Risk Management: Add risk assessment and portfolio optimization features
- Mobile API: Create mobile-optimized APIs for mobile application integration
- Multi-Currency: Support for multiple currencies and international investments
Operational Improvements
- Security: Implement proper authentication and authorization
- Backup & Recovery: Add automated backup and disaster recovery procedures
- Load Testing: Implement comprehensive load testing for production readiness
- Documentation: Create user-facing documentation and API documentation
Lessons Learned
Microservices Architecture
- Service Boundaries: Clear service boundaries are crucial for maintainability
- Data Consistency: Eventual consistency is often sufficient for business operations
- Service Communication: Well-designed APIs are the foundation of successful microservices
Development Practices
- Testing: Comprehensive testing is essential for distributed systems
- Documentation: Good documentation enables AI agents and other developers to understand the system
- Error Handling: Robust error handling is critical for production systems
- Agentic Development: llm.txt files with detailed function descriptions accelerate AI agent development cycles
Financial Domain
- Regulatory Compliance: Financial systems require careful attention to data consistency and audit trails
- Performance: Financial operations often require real-time processing capabilities
- Scalability: Investment platforms must handle varying loads and user growth
LLM.txt Files and Agentic Development
Revolutionary Documentation Approach
One of the most innovative aspects of this project was the implementation of comprehensive llm.txt files for each microservice. This approach revolutionized how AI agents interact with and understand complex microservices architectures.
What are LLM.txt Files?
Each microservice includes a detailed llm.txt file that serves as a complete specification for AI agents, containing:
- Service Overview: Purpose, architecture, and role in the system
- API Endpoints: Complete request/response formats with examples
- Database Schema: Table structures, relationships, and operations
- Business Logic: Step-by-step processing flows and algorithms
- Integration Patterns: How services communicate with each other
- Environment Variables: Configuration parameters and their purposes
- Error Handling: Common error scenarios and responses
- Usage Examples: Real-world API calls and responses
- Testing Information: How to test and validate functionality
Benefits for Agentic Development
1. Fast Service Creation
- AI agents can create new microservices from scratch using llm.txt specifications
- Detailed function descriptions enable precise code generation
- API endpoints are automatically implemented with proper error handling
2. Seamless Integration
- Agents understand service dependencies and communication patterns
- Database schemas are correctly implemented with proper relationships
- Environment variables and configuration are automatically set up
3. Consistent Architecture
- All services follow the same documentation patterns
- Standardized API response formats across the platform
- Uniform error handling and logging approaches
4. Rapid Prototyping
- New features can be prototyped by modifying llm.txt files
- Agents can implement changes without deep system knowledge
- Testing scenarios are automatically generated from specifications
Example LLM.txt Structure
# Service Overview
- Purpose: Investment processing microservice
- Architecture: Flask-based REST API
- Dependencies: user-portfolio-db, user-tier-agent
# API Endpoints
POST /api/v1/invest
- Request: {account_number, amount}
- Response: {status, transaction_id, tier_allocations}
- Error Codes: 400, 500
# Database Operations
- user_portfolios: INSERT/UPDATE for portfolio data
- portfolio_transactions: INSERT for transaction records
- Constraints: tier allocations must sum to 100%
# Business Logic
1. Validate account and amount
2. Check balance via balancereader
3. Get tier allocation from user-tier-agent
4. Update portfolio in user-portfolio-db
5. Record transaction
6. Return success response
# Integration Points
- Calls user-tier-agent for fund allocation
- Updates user-portfolio-db for portfolio changes
- Returns status to investment-manager-svc
Impact on Development Speed
Traditional Development: 2-3 days per microservice
- Design API endpoints
- Implement business logic
- Create database schemas
- Write tests
- Document functionality
Agentic Development with LLM.txt: 2-3 hours per microservice
- AI agent reads llm.txt specification
- Generates complete microservice code
- Implements all API endpoints
- Creates database operations
- Generates comprehensive tests
- Updates documentation
Quality Assurance
The llm.txt approach ensures high code quality through:
- Comprehensive Specifications: Every aspect is documented
- Consistent Patterns: All services follow the same structure
- Built-in Testing: Test scenarios are part of the specification
- Error Handling: Common failure modes are documented
- Integration Testing: Service communication is clearly defined
Future Applications
This llm.txt approach can be extended to:
- API Gateway Configuration: Automatic route setup
- Database Migrations: Schema changes based on specifications
- Monitoring Setup: Health checks and metrics from documentation
- Security Policies: Authentication and authorization patterns
- Performance Optimization: Load balancing and caching strategies
This project represents a comprehensive journey into modern software architecture, financial technology, and cloud-native development. The experience has provided deep insights into building scalable, maintainable, and robust distributed systems that can handle complex business requirements while maintaining high performance and reliability. The innovative use of llm.txt files for agentic development has demonstrated how AI agents can accelerate microservices development while maintaining code quality and architectural consistency.
Built With
- ai-hub
- artifact-registry
- bash/shell
- docker
- flask
- gke
- google-cloud
- google-cloud-build
- google-container-registry
- gunicorn
- kubernetes
- kustomize
- markdown
- postgresql
- psycopg2
- pyjwt
- pytest
- python
- requests
- sql
- unittest
- yaml
Log in or sign up for Devpost to join the conversation.