anchor
Insights /  
12 Elixir Open-Source Projects to Build Your SaaS Ground-Up

12 Elixir Open-Source Projects to Build Your SaaS Ground-Up

May 20, 2024
->
10 min read
Elixir
By
Volodymyr Sverediuk
Elixir Developer
Sofiia Yurkevska
Content Writer

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

GraphQL API development engine
Absinthe is a complete implementation of the GraphQL Working Draft, designed with a conversational and readable API that feels natural to Elixir developers. It emphasizes extensibility with a modular architecture, allowing developers to add, swap out, or remove components as needed, even per document.

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

Background Job Processor
Background job processing is a critical component, enabling asynchronous task execution and offloading computationally intensive operations from the request-response cycle. Oban is a powerful and flexible Elixir library that excels in handling various background job use cases, making it suitable for systems of any size.

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

Filtering, Ordering, and Pagination for Ecto Queries
Flop is an Elixir library explicitly designed for Ecto that simplifies the process of applying filtering, ordering, and pagination to your database queries. One of Flop's key features is its support for offset-based and cursor-based pagination. Offset-based pagination allows you to navigate through records using offset/limit or page/page_size parameters. In contrast, cursor-based pagination, also known as key set pagination, provides a more efficient alternative that is compatible with Relay pagination arguments.

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

Effortless Multi-Tenancy for Ecto Applications
Triplex offers a straightforward and effective solution for managing tenant data within your Elixir and Phoenix applications. By offloading the complexities of multi-tenancy to a dedicated library, you can focus on delivering value to your customers while ensuring the security and isolation of their data.

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

Powerful In-Memory Caching for Elixir
Whether you're building a new application or optimizing an existing one, Cachex offers a powerful and feature-rich caching solution that can significantly improve the performance and scalability of your Elixir applications.

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

JWT Authentication for Elixir
Joken is an Elixir library that simplifies working with JSON Web Tokens (JWTs), providing a robust and flexible solution for implementing JWT-based authentication. Adhering to the JWT specification, Joken supports standard algorithms like HS256, RS256, and ES256 while allowing token payloads and signature algorithms to be customized. It prioritizes security with built-in protections against vulnerabilities like token replay attacks and includes features like token expiration and audience validation. Joken offers seamless integration with Phoenix and utilities for working with claims. Whether building new applications or retrofitting existing ones, Joken is a valuable tool for secure, scalable JWT authentication in Elixir.

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

Batteries-included HTTP Client
Req is a batteries-included HTTP client for Elixir, offering a comprehensive set of features with minimal code. With just a couple of lines, you get automatic response body decompression and decoding, following redirects, retrying on errors, and much more. Its power lies in its modular design, where virtually all features are broken down into individual functions called steps. You can easily re-use and re-arrange built-in steps from the Req.Steps module or write your custom steps, providing flexibility and extensibility for your HTTP client needs

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

Secure Encryption for Elixir
Cloak is an Elixir encryption library that simplifies implementing robust encryption practices in your applications. It automatically generates random initialization vectors (IVs) and produces tagged ciphertexts, providing an additional security and integrity verification layer.

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

Flexible AWS API Integration
ExAws is a flexible and easy-to-use set of AWS APIs for Elixir, enabling seamless integration with a wide range of AWS services. One of ExAws's key strengths is its modular design. Each AWS service is packaged as a separate dependency, allowing you to include only the services your application requires. This approach promotes a lean and efficient codebase, minimizing unnecessary dependencies and reducing the overall application footprint.

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

Seamless Localization
Simplifying localization is at the core of ex_cldr. Implementing localization in your applications is as easy as handling non-localized data. This simplicity means less overhead and faster development cycles.

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

HTTP-2 Compliant Wrapper for Sending iOS and Android Push Notifications
Pigeon is an Elixir library designed to simplify sending push notifications to iOS and Android devices. By providing an HTTP2-compliant interface, Pigeon ensures that your notification delivery is efficient and secure and adheres to modern standards for push communication.

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

Robust HTTP Request Mocking
exvcr is an Elixir library inspired by the Ruby VCR gem, designed to simplify and enhance the testing of third-party API integrations. By allowing you to record and replay HTTP interactions, exvcr helps you create reliable and deterministic tests for your Elixir applications.

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.

Build Your Team
with Freshcode
Author
linkedin
Volodymyr Sverediuk
Elixir Developer

A software developer with extensive years of experience. For the past decade, my focus has been on web development utilizing Elixir, Ruby, and JavaScript.

linkedin
Sofiia Yurkevska
Content Writer

Infodumper, storyteller and linguist in love with programming - what a mixture for your guide to the technology landscape!

Shall we discuss
your idea?
Uploading...
fileuploaded.jpg
Upload failed. Max size for files is 10 MB.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
What happens after you fill this form?
We review your inquiry and respond within 24 hours
We hold a discovery call to discuss your needs
We map the delivery flow and manage the paperwork
You receive a tailored budget and timeline estimation
Looking for a Trusted Outsourcing Partner?