12 Elixir Open-Source Projects to Build Your SaaS Ground-Up
October 18, 2024
October 18, 2024
Freshcode
As the popularity of web development in Elixir grows, its ecosystem matures and offers tools for building full-fledged SaaS solutions. While the Phoenix Framework, with its powerful features like Phoenix Live and the Ecto database wrapper, has become the de facto standard for web development in Elixir, the ecosystem has a wealth of other open-source libraries that can significantly boost your productivity and enhance your application's capabilities.
Of course, Phoenix Framework with Phoenix Live and Ecto are amazing. But what about all the other small features you need for application development and upgrading? That’s what we are going to talk about in this article.
01. Absinthe
One of Absinthe's key strengths is its advanced resolution capabilities. It supports asynchronous field resolution, batched field resolution (addressing the infamous N+1 query problem), and a resolution plugin system that enables further extensibility. Additionally, Absinthe prioritizes safety, offering complexity analysis, configurable limiting, and support for precompiled documents to prevent custom document execution.
Using Absinthe, developers can define schemas using easy-to-read macros that build and verify their structure simultaneously, preventing runtime errors and increasing performance. Absinthe also supports idiomatic Elixir snake_case notation for defining schemas while transparently translating to camelCase notation for API clients. Alternatively, developers can define their translation schema by writing a simple adapter.
02. Oban
Compared to other background job processing tools, Oban offers several advantages. One of Oban's key differentiators is that it retains job data for historical metrics and inspection, ensuring that jobs are never lost or orphaned due to crashes, even if your application runs indefinitely. By running your job queue within an SQL database, Oban minimizes system dependencies and simplifies data backups. It also provides transactional control, allowing you to enqueue a job and other database changes, ensuring that everything is committed or rolled back atomically. Because of these, we chose Oban for the Beauty Business ERP case.
Oban Pro
Oban also offers an enterprise-grade version called Oban Pro, which builds upon the core of the Oban library with advanced features and professional support. Oban Pro enhances observability by integrating Oban's telemetry events with enterprise logging and monitoring solutions like Timber, Honeycomb, and Datadog. It also enables you to configure webhooks to receive notifications when jobs execute, retry, or discard due to max retries, ensuring you stay informed about critical job processing events.
Oban Pro provides prioritized email support and expedited response times from the Oban core team, ensuring your concerns are addressed promptly. Additionally, your purchase helps fund ongoing engineering work, keeping Oban modern and well-maintained.
03. Flop
Sorting is another area where Flop shines. It allows you to apply sort parameters on multiple fields in any direction, ensuring your data is presented in the desired order. Flop's filtering capabilities are equally impressive. It enables complex data filtering using multiple conditions, operators, and fields. Additionally, Flop includes parameter validation to ensure the validity of provided parameters, and it allows you to configure which fields are filterable or sortable, providing an additional layer of control.
Flop Phoenix
Flop Phoenix includes pre-built components like pagination links, sortable table headers, and filter forms. These components are designed to work seamlessly with Flop, allowing you to implement sorting, filtering quickly, and pagination functionality in your web applications. By leveraging these pre-built components, you can save valuable development time and effort while ensuring a consistent and user-friendly experience across your application.
04. Triplex
Triplex leverages database data segregation techniques, such as PostgreSQL schemas, to keep tenant-specific data separated while allowing you to continue using the familiar Ecto functions you're accustomed to. This approach ensures that each tenant's data remains isolated and secure without needing complex and error-prone data partitioning logic in your application code.
One of Triplex's key advantages is its simplicity. By abstracting away the complexities of multi-tenancy, Triplex enables developers to focus on building their core application functionality rather than spending valuable time and effort implementing and maintaining multi-tenancy mechanisms.
Triplex integrates seamlessly with Ecto, providing a consistent and familiar development experience. It allows you to define tenant-specific models and repositories while leveraging Ecto's query language and functionality. This tight integration ensures your multi-tenant application remains maintainable and extensible without sacrificing performance or introducing unnecessary complexity.
05. Cachex
Cachex is a speedy in-memory key/value store that provides core features like time-based key expirations and maximum size protection, ensuring efficient and up-to-date caching. However, Cachex's capabilities extend beyond these basics, offering advanced features to enhance caching strategies further.
One of Cachex's standout features is its support for pre/post execution hooks, allowing custom code to be executed before or after cache operations. This facilitates advanced cache warming strategies, ensuring frequently accessed data is readily available. Additionally, Cachex supports transactions and row locking for atomic operations, maintaining data consistency and integrity. Asynchronous write operations run in the background, enhancing performance by minimizing the impact on your application's responsiveness.
06. Joken
It allows you to customize the token payload, including any additional claims or metadata your application requires. This flexibility extends to the token's signature algorithm, as Joken supports using custom algorithms, allowing you to implement your security protocols if needed.
07. Req
Req's simplicity and feature-rich nature make it a valuable addition to your Elixir toolset. It streamlines HTTP communication and lets you focus on your application's core functionality while relying on a robust and well-designed HTTP client library.
08. Cloak
Cloak's integration with Elixir's native configuration system allows you to seamlessly manage your encryption keys and settings, ensuring that sensitive data remains secure and easily manageable throughout your application's lifecycle.
Notably, Cloak enables searching through encrypted data, a valuable capability for applications that need to comply with regulations like GDPR while still allowing efficient data retrieval and analysis. This feature ensures that sensitive information, such as user credentials, remains secure while enabling necessary functionality. By abstracting away the complexities of secure encryption, Cloak empowers developers to focus on their application's core functionality while ensuring that sensitive data remains protected from unauthorized access.
09. ExAws
ExAws supports various authentication methods, including environment variables, IAM roles (including ECS task roles and instance roles), AWS CLI config files, and role-based authentication. This flexibility ensures you can seamlessly integrate ExAws into your AWS infrastructure and authentication workflows.
10. ex_cldr
ex_cldr is a collection of Elixir libraries that provides comprehensive support for localization. Utilizing data from the Common Locale Data Repository (CLDR) empowers you to create applications that feel native to users globally by handling everything from date and time formatting to number and currency translation.
One of ex_cldr's standout features is its extensive data coverage. The libraries address various localization needs, including calendar systems, number formatting, and list presentation. ex_cldr is designed for ease of use, ensuring that you can implement localization in your applications as effortlessly as handling non-localized data. Adhering to CLDR standards guarantees that your application's localization is accurate, reliable, and up-to-date with the latest cultural norms.
ex_cldr enhances user experience by delivering content in the user's local format, making your application more intuitive and user-friendly. This capability can drive engagement, satisfaction, and higher user retention rates. By automating complex localization processes, ex_cldr reduces development time, allowing your team to focus on other critical features. It also ensures consistency and accuracy in your localization efforts, reducing the risk of cultural missteps and improving trust with a global user base.
11. Pigeon
One of Pigeon's key features is its seamless integration with APNs (Apple Push Notification Service) and FCM (Firebase Cloud Messaging). This dual compatibility allows you to implement push notifications for iOS and Android platforms using a unified interface. Pigeon's architecture supports concurrent and asynchronous notification sending, optimizing the performance and scalability of your notification system.
Pigeon manages your connection, maintaining persistent connections to reduce latency and support high-throughput scenarios. By abstracting away the complexities of HTTP2 and connection handling, Pigeon empowers developers to focus on crafting engaging user experiences while ensuring that critical notifications are delivered promptly and reliably. Its robust error-handling and retry mechanisms further enhance reliability, making Pigeon an indispensable tool for any Elixir application requiring push notifications.
12. exvcr
One of exvcr's standout features is its ability to capture actual HTTP requests and responses during test runs. These captured interactions are saved as cassettes, which can be replayed in subsequent test runs. This mechanism ensures that your tests are faster and immune to network instability and changes in the external API.
exvcr integrates seamlessly with Elixir's testing framework, making it easy to incorporate into your existing test suite. By abstracting away the complexities of HTTP request mocking, exvcr enables developers to write comprehensive tests for their 3rd party API integrations with minimal effort. This results in more robust and reliable code, as you can confidently verify that your application behaves correctly in various scenarios without relying on live external services.
By automating the capture and replay of HTTP interactions, exvcr significantly reduces the time and effort required to mock external APIs. This empowers developers to focus on their core application logic, ensuring high-quality software that meets user expectations.
Infographics: 12 Elixir Tools
Takeaway
Elixir has a rich ecosystem of powerful libraries that simplify and enhance various aspects of application development, from GraphQL APIs to background job processing, multi-tenancy, caching, JWT authentication, HTTP clients, encryption, AWS integration, localization, push notifications, and testing with mocked HTTP requests. The maturity and breadth of this ecosystem showcases the growth and adoption of Elixir as a robust language for building scalable and maintainable applications.
with Freshcode