Skip to content

Feature: Additional tutorials #925

Open
@cabaucom376

Description

@cabaucom376

Is your feature request related to a problem?

I've noticed a lack of high-quality content on best practices for architecting databases with SurrealDB. My aim is to enhance the tutorial section with more robust, real-world examples and explanations.

I believe the Namespace and Database features are under-documented and can be confusing to implement. This is particularly true for multi-tenancy, where most available content consists of vague answers from the SurrealDB team. While the core concepts are outlined, applying these concepts to a real-world database architecture raises questions on best practices.

Example of current considerations:

I'm developing a system where a User can have multiple Workspaces, each fully isolated for privacy. Users can upload these Workspaces to a central server for collaboration, with permissions defined by the owner. Here are the approaches I'm considering:

  • Single Namespace/Database: All data is stored within a single Namespace and Database. While functional with appropriate schemas, this raises security concerns in a server environment, especially with deeply nested hierarchical data shared across users. Scalability also becomes a point of concern.

  • Users as Namespaces, Workspaces as Databases: Each user gets a Namespace, with each Workspace stored in a separate Database. However, this approach raises several challenges:

    • How can we dynamically create new Databases, considering $param doesn’t work with DEFINE statements?
    • Should workspace metadata (like names and descriptions) be stored in a global Database?
    • How can we grant other users access to specific Workspaces without duplicating data across Namespaces?
    • What strategies avoid name conflicts across Namespaces/Databases? Would UUIDs work, and how could they be referenced globally?
  • Workspaces as Namespaces, Users as Tables: In this model, Users are stored in a table, with one marked as the owner of each Workspace. But how can we dynamically create new Namespaces given the limitations of $param with DEFINE statements?


Describe the solution:

The solution is to create new tutorials that dive into practical use cases for SurrealDB's Namespaces and Databases. These tutorials would provide clear, step-by-step guides on implementing multi-tenancy, securing user data, and dynamically managing Databases.

One tutorial could explore how to structure a multi-tenant SaaS application where each user's data is isolated within its own Namespace and Workspace. It would cover dynamic Namespace and Database creation, managing user access permissions, and organizing global metadata efficiently.

These tutorials would give developers a concrete roadmap for applying SurrealDB's features to real-world applications, reducing confusion and enhancing confidence in building secure, scalable architectures.


Alternative methods:

I considered creating a YouTube tutorial series to visually demonstrate SurrealDB’s Namespaces and Databases. While this could offer a more hands-on approach, written tutorials within the documentation would be more accessible for developers who prefer detailed, text-based references for easy copy-pasting and following along at their own pace.

Contact Details

[email protected]

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions