Back to Blogs
Leading Technical Innovation at Capitalino: Building FinTech Infrastructure from Scratch

Leading Technical Innovation at Capitalino: Building FinTech Infrastructure from Scratch

12/18/202515 min
fintechleadershipnodejstypescriptmicroservicesdocker

The Opportunity

In October 2023, I received a call that would shape the next two years of my career. The former Vice President of CITEX, one of Iran's largest cryptocurrency exchanges, was launching a new venture called Capitalino—a FinTech platform focused on digital investment management. They needed someone to build the technical foundation from scratch.

This wasn't just another job offer. It was an opportunity to architect and build critical financial infrastructure, lead a growing team, and create systems that would handle real money for real users. I said yes.

Building the Foundation

The Challenge

Starting a FinTech company means you're building trust, not just software. Every line of code needs to be secure. Every API endpoint needs to handle edge cases. Every database transaction needs to be atomic. The margin for error is zero.

When I joined, Capitalino had:

  • No existing codebase

  • No infrastructure

  • No established processes

  • A vision and a deadline
  • The Architecture

    I designed a microservices architecture that could scale horizontally while maintaining security and reliability:

    // Core service architecture
    ├── api-gateway/ // Nginx-based routing and rate limiting
    ├── auth-service/ // JWT-based authentication with 2FA
    ├── user-service/ // User management and profiles
    ├── investment-service/ // Core investment logic
    ├── payment-service/ // Crypto-to-fiat gateway
    ├── notification-service/ // Real-time alerts via WebSocket
    └── analytics-service/ // Data aggregation and reporting

    Key Technical Decisions

    1. Technology Stack

  • Backend: Node.js with TypeScript for type safety

  • Database: MongoDB for flexibility, PostgreSQL for financial transactions

  • Caching: Redis for session management and rate limiting

  • Message Queue: NATS for inter-service communication

  • Infrastructure: Docker containers orchestrated with Kubernetes
  • 2. Security First

  • All API endpoints behind authentication middleware

  • Rate limiting at multiple layers (Nginx, application, database)

  • Encrypted data at rest and in transit

  • Regular security audits and penetration testing

  • Compliance with financial regulations
  • 3. Developer Experience

  • Monorepo structure with shared TypeScript types

  • Automated testing pipeline (unit, integration, E2E)

  • CI/CD with GitHub Actions

  • Comprehensive logging and monitoring with ELK stack
  • Core Systems Built

    1. Investor Dashboard

    The investor dashboard was the heart of the platform. It needed to:

  • Display real-time portfolio values

  • Show transaction history with filtering

  • Provide analytics and insights

  • Handle thousands of concurrent users
  • Technical Implementation:

    // Real-time portfolio aggregation
    async function getPortfolioValue(userId: string): Promise {
    const cacheKey = portfolio:${userId};
    const cached = await redis.get(cacheKey);

    if (cached) return parseFloat(cached);

    // Aggregate from multiple sources
    const [investments, crypto, fiat] = await Promise.all([
    InvestmentService.getTotal(userId),
    CryptoService.getBalance(userId),
    FiatService.getBalance(userId)
    ]);

    const total = investments + crypto + fiat;
    await redis.setex(cacheKey, 30, total.toString()); // 30s cache

    return total;
    }

    Performance Optimizations:

  • Redis caching for frequently accessed data

  • Database query optimization with proper indexing

  • Pagination for large datasets

  • WebSocket for real-time updates
  • 2. Crypto-to-Fiat Payment Gateway

    Building a payment gateway that bridges cryptocurrency and traditional banking was one of the most complex challenges. It required:

  • Integration with multiple crypto exchanges

  • Real-time exchange rate updates

  • Secure transaction processing

  • Compliance with financial regulations

  • Atomic transactions to prevent double-spending
  • Transaction Flow:

    async function processPayment(
    userId: string,
    amount: number,
    fromCurrency: string,
    toCurrency: string
    ): Promise {
    const session = await mongoose.startSession();
    session.startTransaction();

    try {
    // 1. Lock user account
    await UserService.lockAccount(userId, session);

    // 2. Verify balance
    const balance = await BalanceService.getBalance(
    userId,
    fromCurrency,
    session
    );

    if (balance < amount) {
    throw new InsufficientFundsError();
    }

    // 3. Get exchange rate
    const rate = await ExchangeService.getRate(fromCurrency, toCurrency);

    // 4. Execute atomic transaction
    await Promise.all([
    BalanceService.debit(userId, fromCurrency, amount, session),
    BalanceService.credit(userId, toCurrency, amount * rate, session),
    TransactionService.create({
    userId,
    fromCurrency,
    toCurrency,
    amount,
    rate,
    status: 'completed'
    }, session)
    ]);

    await session.commitTransaction();
    return { success: true, transactionId: transaction._id };

    } catch (error) {
    await session.abortTransaction();
    throw error;
    } finally {
    session.endSession();
    }
    }

    3. RESTful API Design

    I designed a RESTful API that followed industry best practices:

    // API versioning
    /api/v1/investments
    /api/v1/investments/:id
    /api/v1/investments/:id/transactions

    // Consistent response format
    interface ApiResponse {
    success: boolean;
    data?: T;
    error?: {
    code: string;
    message: string;
    details?: any;
    };
    meta?: {
    page: number;
    limit: number;
    total: number;
    };
    }

    // Error handling middleware
    app.use((err, req, res, next) => {
    logger.error('API Error', { error: err, path: req.path });

    const status = err.statusCode || 500;
    res.status(status).json({
    success: false,
    error: {
    code: err.code || 'INTERNAL_ERROR',
    message: err.message || 'An unexpected error occurred',
    ...(process.env.NODE_ENV === 'development' && { stack: err.stack })
    }
    });
    });

    Award-Winning Projects

    AI Hologram Installation (ITEX 2024)

    One of the most exciting projects was building an AI-powered hologram installation for ITEX 2024. The goal was to create an interactive experience that would attract visitors and showcase Capitalino's innovative spirit.

    Technical Stack:

  • Python with FastAPI for the backend

  • Computer vision for gesture recognition

  • Real-time AI model inference

  • WebSocket for bidirectional communication

  • Docker for deployment
  • Architecture:

    # FastAPI endpoint for hologram interaction
    @app.post("/api/hologram/interact")
    async def process_interaction(gesture: GestureData):
    # Real-time gesture recognition
    recognized = await ai_model.predict(gesture.image)

    # Generate appropriate response
    response = await response_generator.generate(
    intent=recognized.intent,
    context=gesture.context
    )

    # Broadcast to connected clients
    await websocket_manager.broadcast({
    'type': 'hologram_response',
    'data': response
    })

    return {'success': True, 'response': response}

    Result: Capitalino won Best Booth at ITEX 2024, largely due to the innovative hologram installation that drew thousands of visitors.

    Financial Trading Gamification Platform (ITEX 2023)

    For the Shiraz ITEX 2023 exhibition, I built a competitive gamification platform that allowed visitors to simulate financial trading in real-time.

    Features:

  • Real-time market data integration

  • Leaderboard with live rankings

  • Achievement system

  • Social sharing capabilities
  • Tech Stack:

  • Node.js backend with WebSocket

  • React frontend with Next.js

  • Real-time data streaming

  • Redis for leaderboard management
  • Team Leadership

    Building the Team

    As the Technical Lead, I was responsible for:

  • Recruiting and interviewing candidates

  • Onboarding new developers

  • Setting coding standards and best practices

  • Code reviews and technical mentorship

  • Architecture decisions and technical debt management
  • Processes Established

  • Agile Development

  • - Two-week sprints
    - Daily standups
    - Sprint retrospectives
    - Kanban board for task tracking

  • Code Quality

  • - ESLint and Prettier for code formatting
    - TypeScript strict mode
    - Minimum 80% test coverage
    - Mandatory code reviews

  • Documentation

  • - API documentation with Swagger
    - Architecture decision records (ADRs)
    - Runbooks for operations
    - Onboarding guides for new developers

    Challenges and Solutions

    Challenge 1: Scaling Under Load

    Problem: During peak hours, the dashboard was slow and sometimes unresponsive.

    Solution:

  • Implemented Redis caching layer

  • Added database read replicas

  • Optimized database queries with proper indexing

  • Implemented connection pooling

  • Added CDN for static assets
  • Result: Response times improved from 2-3 seconds to under 200ms.

    Challenge 2: Payment Gateway Reliability

    Problem: Intermittent failures in the crypto-to-fiat gateway were causing transaction failures.

    Solution:

  • Implemented retry logic with exponential backoff

  • Added circuit breaker pattern

  • Created fallback mechanisms for exchange rate APIs

  • Enhanced logging and monitoring

  • Implemented transaction idempotency
  • Result: Transaction success rate improved from 92% to 99.7%.

    Challenge 3: Team Scaling

    Problem: As the team grew, knowledge silos developed and onboarding became difficult.

    Solution:

  • Created comprehensive documentation

  • Established pair programming sessions

  • Implemented knowledge sharing sessions

  • Created runbooks for common operations

  • Established a mentorship program
  • Metrics and Impact

    During my tenure at Capitalino:

  • Team Growth: From 1 (me) to 8 developers

  • Codebase: 50,000+ lines of production code

  • API Endpoints: 80+ RESTful endpoints

  • Uptime: 99.9% availability

  • Transaction Volume: Processed millions in transactions

  • Awards: Best Booth at ITEX 2024
  • Lessons Learned

  • Security is not optional - In FinTech, a single vulnerability can destroy trust and the business. Security must be built in from day one.
  • Documentation saves time - Good documentation reduces onboarding time and prevents knowledge silos.
  • Automation is key - CI/CD, automated testing, and infrastructure as code free up time for actual development.
  • Team culture matters - Technical excellence is important, but a positive team culture is what makes people stay and do their best work.
  • Start simple, scale smart - Don't over-engineer from the start. Build what you need now, but design for future growth.
  • Conclusion

    Leading the technical team at Capitalino was one of the most rewarding experiences of my career. I got to build critical financial infrastructure, lead a talented team, and create systems that handled real money for real users. The experience taught me that technical leadership is about more than just writing code—it's about building systems, processes, and teams that can scale and succeed.

    The skills I developed—from microservices architecture to team leadership—continue to shape how I approach technical challenges today.

    ---

    Interested in learning more about building FinTech infrastructure or technical leadership? Feel free to reach out!