# Architecture Audit and Improvements for Thoughtful Automation

Source: https://www.serverless.direct/works/thoughtful-automation

Client: Thoughtful Automation

Discover how we conducted an architecture audit and implemented improvements for Thoughtful Automation, a platform dedicated to automating business processes.

## Thoughtful Automation

Thoughtful Automation, a platform dedicated to streamlining business processes, sought our expertise to conduct a comprehensive architecture audit and implement necessary improvements. By leveraging our in-depth analysis of the frontend, backend, and AWS infrastructure, we aimed to address existing issues and optimize the platform's performance.

Thoughtful Automation's backend, built as a single express server stored in a lambda, presented runtime challenges. Additionally, the frontend and AWS architecture failed to meet the client's requirements, necessitating a thorough overhaul.

**Backend Refactoring.** To enhance backend stability, we opted to rewrite it entirely using Typescript, employing a type-safe approach. We also incorporated VPC configurations for databases to bolster security and rebuilt the Postgres database for improved data manipulation speed.

**Frontend Reconstruction.** Given the initial JavaScript-based frontend's limitations, we undertook a rewrite using Typescript, improving stability through a type-safe approach.

**AWS Architecture Enhancements.** We adopted serverless architecture to optimize CI/CD management, adhering to microservices best practices. By dividing the architecture into separate AWS Lambdas, we ensured streamlined functionality. Furthermore, we reconstructed the serverless configuration to ensure error-free deployments.

### Real-Time Bot Actions

Leveraging AWS Lambdas, we enabled real-time updates from bots with less than a one-second delay, updating the database logs accordingly. Future plans involve integrating WebSockets API Gateway to further enhance real-time functionality.

### Scheduled Bot Execution

We employed AWS Step Functions to enable precise scheduling of bot executions at specific times, ensuring accurate and timely automation.

### High-Performance Filtering and Sorting

By designing an optimized database structure and implementing efficient indexing, we significantly enhanced the platform's filtering and sorting capabilities, enabling swift data retrieval.

## Impact

Following the refactoring phase, Thoughtful Automation experienced substantial performance improvements. Backend response time and frontend loading time reduced to under 50 ms and 2 seconds, respectively, for main information pages upon initial load. Additionally, we addressed AWS Lambda cold starts, allowing backend requests to be handled in under a second.

Moreover, our security enhancements included VPC configurations for databases, enhanced authentication handling, and improved database structure and credentials storage.

These improvements elevated the value of Thoughtful Automation's services, empowering users to navigate extensive bot logs and job executions. The platform now meets the primary needs of its users, enabling our client to promote it as an exceptionally effective service.

More case studies: https://www.serverless.direct/works.md

## Contact
- Email: hello@serverless.direct
- Book a call with Kyrylo Kozak, Founder and CEO: https://meetings-eu1.hubspot.com/kyrylo-kozak
- Website: https://www.serverless.direct
