> For the complete documentation index, see [llms.txt](https://docs.microart.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.microart.app/apps/ntfx/storage-provider.md).

# Storage Provider

### API

```csharp
using NTFX.Api;
// assume namespace and class

public static void Execute(AppContext _context)
{
   var RootBucket = _context.Storage.RequestBucket("/");
   var UsersBucket = _context.Storage.RequestBucket("/users");
   var OtherStuff = _context.Storage.RequestBucket("/otherstuff");
   
   var NamesBucket = _context.Storage.CreateBucket("/names");
   
   
   RootBucket.Get("SomeChildValue").Set("Another Value");
   UsersBucket.Where((user) => user.Name.Contains("ntfx")).Delete();
}
```

#### Buckets

Buckets are simply containered parts of the larger Storage System. Buckets ensure each application has its own part of the storage isolated from each other.

If required applications can request access to the global bucket, ntfx bucket, and even the subsystem buckets.

```csharp
var GlobalBucket = await _context.Storage.RequestGlobalBucket();
var NTFXBucket = await _context.Storage.RequestNTFXBucket(); // Requires admin
var SubsystemBucket = await _context.Storage.RequestSubsystemBucket(); // Requires root
```

#### Accessing another apps bucket

Application buckets are isolated until the user or the application allows another application access

For an application to allow another application access, it must be subscribed to the `OnApplicationRequestApplicationBucket` event.

In application to application requests, the application that owns the bucket should have a handler similar to the example shown below:

{% code title="application.cs" %}

```csharp
MyApp.Events.OnApplicationRequestApplicationBucket += (req,res) => {
  if (req.Application.FullName.Tolower() == "sytem info")
  {
    return res.AllowAccess();
  }
};
```

{% endcode %}

For user to application requests, the user can simply elevate to admin to view all the buckets.

#### Making a bucket permanently public

```batch
#admin#
sytem buckets make-public "mysamplebucket" --force --persist
```
