DEV Community

Cover image for Fauna functions: Server-side database functions
Kirk Kirkconnell
Kirk Kirkconnell

Posted on • Edited on • Originally published at linkedin.com

Fauna functions: Server-side database functions

The move from traditional RDBMS to NoSQL databases brought many advantages but also led to losing some critical features, one example is stored procedures. Cloud services like AWS Lambda and Azure Functions have attempted to fill this gap but often fall short in proximity to data, consistency, and regional constraints. Fauna's document-relational database model addresses these challenges by reintegrating stored procedure-like functionality directly within the database, negating the need for external services and their associated complexities for some use cases, but not all.

Fauna’s server-side functions enhance data operations by running application code close to the data, akin to stored procedures, but with enhanced capabilities. These functions are type-checked only once upon creation or update, reducing the overhead in repeatable operations and ensuring faster execution. This approach not only streamlines code deployment across database replicas but also significantly reduces the need for region-aware programming. By embedding business logic within functions, Fauna enhances performance, minimizes transmission overhead, and simplifies application architecture.

In addition, Fauna's functions can bolster security and schema enforcement by enabling you to restrict direct database, collection, or document access, allowing only function-based interactions. Functions can be managed through Fauna’s Schema Language (FSL), which can be version-controlled alongside application code. This encourages developers to reconsider their approach to NoSQL databases, inviting them to explore the benefits of embedding functions and business logic close to their data as we used to, thus leveraging the full potential of Fauna's unique database architecture.

For more info on Fauna's server-side functions, check out the docs and give functions a try with a free trial.

Top comments (0)