PennApps 2024 Best Use of Defang Challenge Winner 🏆
Minimize your tech stack's developmental cost
Underflow.1.mp4
Navigate to FastAPI application directory:
cd StackDB
Set API keys:
set CEREBRAS_API_KEY=<API KEY>
set OPENAI_API_KEY=<API KEY>
Start backend server:
python app.py
There is a three-step process to get the CLI underflow
tool running.
- Set up the Cerebras API key:
set CEREBRAS_API_KEY=<API KEY>
- Go to the
underflow_sdk_parent
folder - create virtual environment with
python3 -m venv underflow-env
- activate virtual environemtnw with
source underflow-env/bin/activate
- Run
pip install -e .
- Go to the
underflow_cli_parent
folder - Run
poetry install
- To test if it works, run the following command in cmd or terminal:
underflow semgrep/semgrep-vscode 20000
Building and maintaining software is complex, time-consuming, and can quickly become expensive, especially as your application scales. Developers, particularly those in startups, often overspend on tools, cloud services, and server infrastructure without realizing it. In fact, nearly 40% of server costs are wasted due to inefficient resource allocation, and servers often remain idle for up to 80% of their runtime.
As your traffic and data grow, so do your expenses. Managing these rising costs while ensuring your application's performance is critical—but it's not easy. This is where Underflow comes in. It automates the process of evaluating your tech stack and provides data-driven recommendations for cost-effective services and infrastructure. By analyzing your codebase and optimizing for traffic, Underflow helps you save money while maintaining the same performance and scaling capabilities.
Underflow is a command-line tool that helps developers optimize their tech stack by analyzing the codebase and identifying opportunities to reduce costs while maintaining performance. With a single command, developers can input a GitHub repository and the number of monthly active users, and Underflow generates a detailed report comparing the current tech stack with an optimized version. The report highlights potential cost savings, performance improvements, and suggests more efficient external services. The tool also provides a clear breakdown of why certain services were recommended, making it easier for developers to make informed decisions about their infrastructure.
Underflow is a command-line tool designed for optimizing software architecture and minimizing costs based on projected user traffic. It is executed with a single command and two arguments:
underflow <github-repository-url> <monthly-active-users>
Upon execution, Underflow leverages the OpenAI API to analyze the provided codebase, identifying key third-party services integrated into the project. The extracted service list and the number of monthly active users are then sent to a FastAPI backend for further processing.
The backend queries an AWS RDS-hosted MySQL database, which contains a comprehensive inventory of external service providers, including cloud infrastructure, CI/CD platforms, container orchestration tools, distributed computing services, and more. The database stores detailed information such as pricing tiers, traffic limits, service categories, and performance characteristics. The backend uses this data to identify alternative services that provide equivalent functionality at a lower cost while supporting the required user traffic.
The results of this optimization process are cached, and a comparison report is generated using the OpenAI API. This report highlights the cost and performance differences between the original tech stack and the proposed optimized stack, along with a rationale for selecting the new services.
Finally, Underflow launches a GUI that presents a detailed analytics report comparing the original and optimized tech stacks. The report provides key insights into cost savings, performance improvements, and the reasoning behind service provider selections.
This technical solution offers developers a streamlined way to evaluate and optimize their tech stacks based on real-world cost and performance considerations.
We’re proud of creating a tool that simplifies the complex task of optimizing tech stacks while reducing costs for developers. Successfully integrating multiple components, such as the OpenAI API for codebase analysis, a FastAPI backend for processing, and an AWS-hosted MySQL database for querying external services, was a significant achievement. Additionally, building a user-friendly command-line interface that provides clear, data-driven reports about tech stack performance and cost optimization is something we're excited about. We also managed to create a streamlined workflow that allows developers to assess cost-saving opportunities without needing deep knowledge of infrastructure or services.
- Generating a better database containing more comprehensive list of available external services and dependencies
- Migrate traffic determination from user manual input to be based on server-level architecture, such as using elastic search on server logs to determine the true amount of third party service usages