{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Welcome","text":"

Welcome to the Community Solid Server! Here we will cover many aspects of the server, such as how to propose changes, what the architecture looks like, and how to use many of the features the server provides.

The documentation here is still incomplete both in content and structure, so feel free to open a discussion about things you want to see added. While we try to update this documentation together with updates in the code, it is always possible we miss something, so please report it if you find incorrect information or links that no longer work.

An introductory tutorial that gives a quick overview of the Solid and CSS basics can be found here. This is a good way to get started with the server and its setup.

If you want to know what is new in the latest version, you can check out the release notes for a high level overview and information on how to migrate your configuration to the next version. A list that includes all minor changes can be found in the changelog

"},{"location":"#using-the-server","title":"Using the server","text":""},{"location":"#what-the-internals-look-like","title":"What the internals look like","text":""},{"location":"#comprehensive-guides-and-tutorials","title":"Comprehensive guides and tutorials","text":""},{"location":"#making-changes","title":"Making changes","text":"

For core developers with push access only:

"},{"location":"architecture/core/","title":"Core building blocks","text":"

There are several core building blocks used in many places of the server. These are described here.

"},{"location":"architecture/core/#handlers","title":"Handlers","text":"

A very important building block that gets reused in many places is the AsyncHandler. The idea is that a handler has 2 important functions. canHandle determines if this class is capable of correctly handling the request, and throws an error if it can not. For example, a class that converts JSON-LD to turtle can handle all requests containing JSON-LD data, but does not know what to do with a request that contains a JPEG. The second function is handle where the class executes on the input data and returns the result. If an error gets thrown here it means there is an issue with the input. For example, if the input data claims to be JSON-LD but is actually not.

The power of using this interface really shines when using certain utility classes. The one we use the most is the WaterfallHandler, which takes as input a list of handlers of the same type. The input and output of a WaterfallHandler is the same as those of its inputs, meaning it can be used in the same places. When doing a canHandle call, it will iterate over all its input handlers to find the first one where the canHandle call succeeds, and when calling handle it will return the result of that specific handler. This allows us to chain together many handlers that each have their specific niche, such as handler that each support a specific HTTP method (GET/PUT/POST/etc.), or handlers that only take requests targeting a specific subset of URLs. To the parent class it will look like it has a handler that supports all methods, while in practice it will be a WaterfallHandler containing all these separate handlers.

Some other utility classes are the ParallelHandler that runs all handlers simultaneously, and the SequenceHandler that runs all of them one after the other. Since multiple handlers are executed here, these only work for handlers that have no output.

"},{"location":"architecture/core/#streams","title":"Streams","text":"

Almost all data is handled in a streaming fashion. This allows us to work with very large resources without having to fully load them in memory, a client could be reading data that is being returned by the server while the server is still reading the file. Internally this means we are mostly handling data as Readable objects. We actually use Guarded<Readable> which is an internal format we created to help us with error handling. Such streams can be created using utility functions such as guardStream and guardedStreamFrom. Similarly, we have a pipeSafely to pipe streams in such a way that also helps with errors.

"},{"location":"architecture/dependency-injection/","title":"Dependency injection","text":"

The community server uses the dependency injection framework Components.js to link all class instances together, and uses Components-Generator.js to automatically generate the necessary description configurations of all classes. This framework allows us to configure our components in a JSON file. The advantage of this is that changing the configuration of components does not require any changes to the code, as one can just change the default configuration file, or provide a custom configuration file.

More information can be found in the Components.js documentation, but a summarized overview can be found below.

"},{"location":"architecture/dependency-injection/#component-files","title":"Component files","text":"

Components.js requires a component file for every class you might want to instantiate. Fortunately those get generated automatically by Components-Generator.js. Calling npm run build will call the generator and generate those JSON-LD files in the dist folder. The generator uses the index.ts, so new classes always have to be added there or they will not get a component file.

"},{"location":"architecture/dependency-injection/#configuration-files","title":"Configuration files","text":"

Configuration files are how we tell Components.js which classes to instantiate and link together. All the community server configurations can be found in the config folder. That folder also contains information about how different pre-defined configurations can be used.

A single component in such a configuration file might look as follows:

{\n  \"comment\": \"Storage used for account management.\",\n  \"@id\": \"urn:solid-server:default:AccountStorage\",\n  \"@type\": \"JsonResourceStorage\",\n  \"source\": { \"@id\": \"urn:solid-server:default:ResourceStore\" },\n  \"baseUrl\": { \"@id\": \"urn:solid-server:default:variable:baseUrl\" },\n  \"container\": \"/.internal/accounts/\"\n}\n

With the corresponding constructor of the JsonResourceStorage class:

public constructor(source: ResourceStore, baseUrl: string, container: string)\n

The important elements here are the following:

As you can see from the constructor, the other fields are direct mappings from the constructor parameters. source references another object, which we refer to using its identifier urn:solid-server:default:ResourceStore. baseUrl is just a string, but here we use a variable that was set before calling Components.js which is why it also references an @id. These variables are set when starting up the server, based on the command line parameters.

"},{"location":"architecture/overview/","title":"Architecture overview","text":"

The initial architecture document the project was started from can be found here. Many things have been added since the original inception of the project, but the core ideas within that document are still valid.

As can be seen from the architecture, an important idea is the modularity of all components. No actual implementations are defined there, only their interfaces. Making all the components independent of each other in such a way provides us with an enormous flexibility: they can all be replaced by a different implementation, without impacting anything else. This is how we can provide many different configurations for the server, and why it is impossible to provide ready solutions for all possible combinations.

"},{"location":"architecture/overview/#architecture-diagrams","title":"Architecture diagrams","text":"

Having a modular architecture makes it more difficult to give a complete architecture overview. We will limit ourselves to the more commonly used default configurations we provide, and in certain cases we might give examples of what differences there are based on what configurations are being imported.

To do this we will make use of architecture diagrams. We will use an example below to explain the formatting used throughout the architecture documentation:

flowchart TD\n  LdpHandler(\"<strong>LdpHandler</strong><br>ParsingHttphandler\")\n  LdpHandler --> LdpHandlerArgs\n\n  subgraph LdpHandlerArgs[\" \"]\n    RequestParser(\"<strong>RequestParser</strong><br>BasicRequestParser\")\n    Auth(\"<br>AuthorizingHttpHandler\")\n    ErrorHandler(\"<strong>ErrorHandler</strong><br><i>ErrorHandler</>\")\n    ResponseWriter(\"<strong>ResponseWriter</strong><br>BasicResponseWriter\")\n  end

Below is a summary of how to interpret such diagrams:

For example, in the above, LdpHandler is a shorthand for the actual identifier urn:solid-server:default:LdpHandler and is an instance of ParsingHttpHandler. It has 4 parameters, one of which has no identifier but is an instance of AuthorizingHttpHandler.

"},{"location":"architecture/overview/#features","title":"Features","text":"

Below are the sections that go deeper into the features of the server and how those work.

"},{"location":"architecture/features/cli/","title":"Parsing Command line arguments","text":"

When starting the server, the application actually uses Components.js twice to instantiate components. The first instantiation is used to parse the command line arguments. These then get converted into Components.js variables and are used to instantiate the actual server.

"},{"location":"architecture/features/cli/#architecture","title":"Architecture","text":"
flowchart TD\n  CliResolver(\"<strong>CliResolver</strong><br>CliResolver\")\n  CliResolver --> CliResolverArgs\n\n  subgraph CliResolverArgs[\" \"]\n    CliExtractor(\"<strong>CliExtractor</strong><br>YargsCliExtractor\")\n    ShorthandResolver(\"<strong>ShorthandResolver</strong><br>CombinedShorthandResolver\")\n  end\n\n  ShorthandResolver --> ShorthandResolverArgs\n  subgraph ShorthandResolverArgs[\" \"]\n    BaseUrlExtractor(\"<br>BaseUrlExtractor\")\n    KeyExtractor(\"<br>KeyExtractor\")\n    AssetPathExtractor(\"<br>AssetPathExtractor\")\n  end

The CliResolver (urn:solid-server-app-setup:default:CliResolver) is simply a way to combine both the CliExtractor (urn:solid-server-app-setup:default:CliExtractor) and ShorthandResolver (urn:solid-server-app-setup:default:ShorthandResolver) into a single object and has no other function.

Which arguments are supported and which Components.js variables are generated can depend on the configuration that is being used. For example, for an HTTPS server additional arguments will be needed to specify the necessary key/cert files.

"},{"location":"architecture/features/cli/#cliresolver","title":"CliResolver","text":"

The CliResolver converts the incoming string of arguments into a key/value object. By default, a YargsCliExtractor is used, which makes use of the yargs library and is configured similarly.

"},{"location":"architecture/features/cli/#shorthandresolver","title":"ShorthandResolver","text":"

The ShorthandResolver uses the key/value object that was generated above to generate Components.js variable bindings. A CombinedShorthandResolver combines the results of multiple ShorthandExtractor by mapping their values to specific variables. For example, a BaseUrlExtractor will be used to extract the value for baseUrl, or port if no baseUrl value is provided, and use it to generate the value for the variable urn:solid-server:default:variable:baseUrl.

These extractors are also where the default values for the server are defined. For example, BaseUrlExtractor will be instantiated with a default port of 3000 which will be used if no port is provided.

The variables generated here will be used to initialize the server.

"},{"location":"architecture/features/http-handler/","title":"Handling HTTP requests","text":"

The direction of the arrows was changed slightly here to make the graph readable.

flowchart LR\n  HttpHandler(\"<strong>HttpHandler</strong><br>SequenceHandler\")\n  HttpHandler --> HttpHandlerArgs\n\n  subgraph HttpHandlerArgs[\" \"]\n    direction LR\n    Middleware(\"<strong>Middleware</strong><br><i>HttpHandler</i>\")\n    WaterfallHandler(\"<br>WaterfallHandler\")\n  end\n\n  Middleware --> WaterfallHandler\n  WaterfallHandler --> WaterfallHandlerArgs\n\n  subgraph WaterfallHandlerArgs[\" \"]\n    direction TB\n    StaticAssetHandler(\"<strong>StaticAssetHandler</strong><br>StaticAssetHandler\")\n    SetupHandler(\"<strong>SetupHandler</strong><br><i>HttpHandler</i>\")\n    OidcHandler(\"<strong>OidcHandler</strong><br><i>HttpHandler</i>\")\n    NotificationHttpHandler(\"<strong>NotificationHttpHandler</strong><br><i>HttpHandler</i>\")\n    StorageDescriptionHandler(\"<strong>StorageDescriptionHandler</strong><br><i>HttpHandler</i>\")\n    AuthResourceHttpHandler(\"<strong>AuthResourceHttpHandler</strong><br><i>HttpHandler</i>\")\n    IdentityProviderHttpHandler(\"<strong>IdentityProviderHttpHandler</strong><br><i>HttpHandler</i>\")\n    LdpHandler(\"<strong>LdpHandler</strong><br><i>HttpHandler</i>\")\n  end\n\n  StaticAssetHandler --> SetupHandler\n  SetupHandler --> OidcHandler\n  OidcHandler --> NotificationHttpHandler\n  NotificationHttpHandler --> StorageDescriptionHandler\n  StorageDescriptionHandler --> AuthResourceHttpHandler\n  AuthResourceHttpHandler --> IdentityProviderHttpHandler\n  IdentityProviderHttpHandler --> LdpHandler

The HttpHandler is responsible for handling an incoming HTTP request. The request will always first go through the Middleware, where certain required headers will be added such as CORS headers.

After that it will go through the list in the WaterfallHandler to find the first handler that understands the request, with the LdpHandler at the bottom being the catch-all default.

"},{"location":"architecture/features/http-handler/#staticassethandler","title":"StaticAssetHandler","text":"

The urn:solid-server:default:StaticAssetHandler matches exact URLs to static assets which require no further logic. An example of this is the favicon, where the /favicon.ico URL is directed to the favicon file at /templates/images/favicon.ico. It can also map entire folders to a specific path, such as /.well-known/css/styles/ which contains all stylesheets.

"},{"location":"architecture/features/http-handler/#setuphandler","title":"SetupHandler","text":"

The urn:solid-server:default:SetupHandler is responsible for redirecting all requests to /setup until setup is finished, thereby ensuring that setup needs to be finished before anything else can be done on the server, and handling the actual setup request that is sent to /setup. Once setup is finished, this handler will reject all requests and thus no longer be relevant.

If the server is configured to not have setup enabled, the corresponding identifier will point to a handler that always rejects all requests.

"},{"location":"architecture/features/http-handler/#oidchandler","title":"OidcHandler","text":"

The urn:solid-server:default:OidcHandler handles all requests related to the Solid-OIDC specification. The OIDC component is configured to work on the /.oidc/ subpath, so this handler catches all those requests and sends them to the internal OIDC library that is used.

"},{"location":"architecture/features/http-handler/#notificationhttphandler","title":"NotificationHttpHandler","text":"

The urn:solid-server:default:NotificationHttpHandler catches all notification subscription requests. By default these are requests targeting /.notifications/. Which specific subscription type is targeted is then based on the next part of the URL.

"},{"location":"architecture/features/http-handler/#storagedescriptionhandler","title":"StorageDescriptionHandler","text":"

The urn:solid-server:default:StorageDescriptionHandler returns the relevant RDF data for requests targeting a storage description resource. It does this by knowing which URL suffix is used for such resources, and verifying that the associated container is an actual storage container.

"},{"location":"architecture/features/http-handler/#authresourcehttphandler","title":"AuthResourceHttpHandler","text":"

The urn:solid-server:default:AuthResourceHttpHandler is identical to the urn:solid-server:default:LdpHandler which will be discussed below, but only handles resources relevant for authorization.

In practice this means that is your server is configured to use Web Access Control for authorization, this handler will catch all requests targeting .acl resources.

The reason these already need to be handled here is so these can also be used to allow authorization on the following handler(s). More on this can be found in the identity provider documentation

"},{"location":"architecture/features/http-handler/#identityproviderhttphandler","title":"IdentityProviderHttpHandler","text":"

The urn:solid-server:default:IdentityProviderHttpHandler handles everything related to our custom identity provider API, such as registering, logging in, returning the relevant HTML pages, etc. All these requests are identified by being on the /idp/ subpath. More information on the API can be found in the identity provider documentation

"},{"location":"architecture/features/http-handler/#ldphandler","title":"LdpHandler","text":"

Once a request reaches the urn:solid-server:default:LdpHandler, the server assumes this is a standard Solid request according to the Solid protocol. A detailed description of what happens then can be found here

"},{"location":"architecture/features/initialization/","title":"Server initialization","text":"

When starting the server, multiple Initializers trigger to set up everything correctly, the last one of which starts listening to the specified port. Similarly, when stopping the server several Finalizers trigger to clean up where necessary, although the latter only happens when starting the server through code.

"},{"location":"architecture/features/initialization/#app","title":"App","text":"
flowchart TD\n  App(\"<strong>App</strong><br>App\")\n  App --> AppArgs\n\n  subgraph AppArgs[\" \"]\n    Initializer(\"<strong>Initializer</strong><br><i>Initializer</i>\")\n    AppFinalizer(\"<strong>Finalizer</strong><br><i>Finalizer</i>\")\n  end

App (urn:solid-server:default:App) is the main component that gets instantiated by Components.js. Every other component should be able to trace an instantiation path back to it if it also wants to be instantiated.

It's only function is to contain an Initializer and Finalizer which get called by calling start/stop respectively.

"},{"location":"architecture/features/initialization/#initializer","title":"Initializer","text":"
flowchart TD\n  Initializer(\"<strong>Initializer</strong><br>SequenceHandler\")\n  Initializer --> InitializerArgs\n\n  subgraph InitializerArgs[\" \"]\n    direction LR\n    LoggerInitializer(\"<strong>LoggerInitializer</strong><br>LoggerInitializer\")\n    PrimaryInitializer(\"<strong>PrimaryInitializer</strong><br>ProcessHandler\")\n    WorkerInitializer(\"<strong>WorkerInitializer</strong><br>ProcessHandler\")\n  end\n\n  LoggerInitializer --> PrimaryInitializer\n  PrimaryInitializer --> WorkerInitializer

The very first thing that needs to happen is initializing the logger. Before this other classes will be unable to use logging.

The PrimaryInitializer will only trigger once, in the primary worker thread, while the WorkerInitializer will trigger for every worker thread. Although if your server setup is single-threaded, which is the default, there is no relevant difference between those two.

"},{"location":"architecture/features/initialization/#primaryinitializer","title":"PrimaryInitializer","text":"
flowchart TD\n  PrimaryInitializer(\"<strong>PrimaryInitializer</strong><br>ProcessHandler\")\n  PrimaryInitializer --> PrimarySequenceInitializer(\"<strong>PrimarySequenceInitializer</strong><br>SequenceHandler\")\n  PrimarySequenceInitializer --> PrimarySequenceInitializerArgs\n\n  subgraph PrimarySequenceInitializerArgs[\" \"]\n    direction LR\n    CleanupInitializer(\"<strong>CleanupInitializer</strong><br>SequenceHandler\")\n    PrimaryParallelInitializer(\"<strong>PrimaryParallelInitializer</strong><br>ParallelHandler\")\n    WorkerManager(\"<strong>WorkerManager</strong><br>WorkerManager\")\n  end\n\n  CleanupInitializer --> PrimaryParallelInitializer\n  PrimaryParallelInitializer --> WorkerManager

The above is a simplification of all the initializers that are present in the PrimaryInitializer as there are several smaller initializers that also trigger but are less relevant here.

The CleanupInitializer is an initializer that cleans up anything that might have remained from a previous server start and could impact behaviour. Relevant components in other parts of the configuration are responsible for adding themselves to this array if needed. An example of this is file-based locking components which might need to remove any dangling locking files.

The PrimaryParallelInitializer can be used to add any initializers to that have to happen in the primary process. This makes it easier for users to add initializers by being able to append to its handlers.

The WorkerManager is responsible for setting up the worker threads, if any.

"},{"location":"architecture/features/initialization/#workerinitializer","title":"WorkerInitializer","text":"
flowchart TD\n  WorkerInitializer(\"<strong>WorkerInitializer</strong><br>ProcessHandler\")\n  WorkerInitializer --> WorkerSequenceInitializer(\"<strong>WorkerSequenceInitializer</strong><br>SequenceHandler\")\n  WorkerSequenceInitializer --> WorkerSequenceInitializerArgs\n\n  subgraph WorkerSequenceInitializerArgs[\" \"]\n    direction LR\n    WorkerParallelInitializer(\"<strong>WorkerParallelInitializer</strong><br>ParallelHandler\")\n    ServerInitializer(\"<strong>ServerInitializer</strong><br>ServerInitializer\")\n  end\n\n  WorkerParallelInitializer --> ServerInitializer

The WorkerInitializer is quite similar to the PrimaryInitializer but triggers once per worker thread. Like the PrimaryParallelInitializer, the WorkerParallelInitializer can be used to add any custom initializers that need to run.

"},{"location":"architecture/features/initialization/#serverinitializer","title":"ServerInitializer","text":"

The ServerInitializer is the initializer that finally starts up the server by listening to the relevant port, once all the initialization described above is finished. It takes as input 2 components: a HttpServerFactory and a ServerListener.

flowchart TD\n  ServerInitializer(\"<strong>ServerInitializer</strong><br>ServerInitializer\")\n  ServerInitializer --> ServerInitializerArgs\n\n  subgraph ServerInitializerArgs[\" \"]\n    direction LR\n    ServerFactory(\"<strong>ServerFactory</strong><br>BaseServerFactory\")\n    ServerListener(\"<strong>ServerListener</strong><br>ParallelHandler\")\n  end\n\n  ServerListener --> HandlerServerListener(\"<strong>HandlerServerListener</strong><br>HandlerServerListener\")\n\n  HandlerServerListener --> HttpHandler(\"<strong>HttpHandler</strong><br><i>HttpHandler</i>\")

The HttpServerFactory is responsible for starting a server on a given port. Depending on the configuration this can be an HTTP or an HTTPS server. The created server emits events when it receives requests.

A ServerListener is a class that takes the created server as input and attaches a listener to interpret events. One listener that is always used is the urn:solid-server:default:HandlerServerListener, which calls an HttpHandler to resolve HTTP requests.

Sometimes it is necessary to add additional listeners, these can then be added to the urn:solid-server:default:ServerListener as it is a ParallellHandler. An example of this is when WebSockets are used to handle notifications.

"},{"location":"architecture/features/notifications/","title":"Notifications","text":"

This section covers the architecture used to support the Notifications protocol as described in https://solidproject.org/TR/2022/notifications-protocol-20221231.

There are three core architectural components, that have distinct entry points:

"},{"location":"architecture/features/notifications/#discovery","title":"Discovery","text":"

Discovery is done through the storage description resource(s). The server returns the same triples for every such resource as the notification subscription URL is always located in the root of the server.

flowchart LR\n  StorageDescriptionHandler(\"<br>StorageDescriptionHandler\")\n  StorageDescriptionHandler --> StorageDescriber(\"<strong>StorageDescriber</strong><br>ArrayUnionHandler\")\n  StorageDescriber --> NotificationDescriber(\"NotificationDescriber<br>NotificationDescriber\")\n  NotificationDescriber --> NotificationDescriberArgs\n\n  subgraph NotificationDescriberArgs[\" \"]\n    direction LR\n    NotificationChannelType(\"<br>NotificationChannelType\")\n    NotificationChannelType2(\"<br>NotificationChannelType\")\n  end

The server uses a StorageDescriptionHandler to generate the necessary RDF data and to handle content negotiation. To generate the data we have multiple StorageDescribers, whose results get merged together in an ArrayUnionHandler.

A NotificationChannelType contains the specific details of a specification notification channel type, including a JSON-LD representation of the corresponding subscription resource. One specific instance of a StorageDescriber is a NotificationSubcriber, which merges those JSON-LD descriptions into a single set of RDF quads. When adding a new subscription type, a new instance of such a class should be added to the urn:solid-server:default:StorageDescriber.

"},{"location":"architecture/features/notifications/#notificationchannel","title":"NotificationChannel","text":"

To subscribe, a client has to send a specific JSON-LD request to the URL found during discovery.

flowchart LR\n  NotificationTypeHandler(\"<strong>NotificationTypeHandler</strong><br>WaterfallHandler\")\n  NotificationTypeHandler --> NotificationTypeHandlerArgs\n\n  subgraph NotificationTypeHandlerArgs[\" \"]\n    direction LR\n    OperationRouterHandler(\"<br>OperationRouterHandler\") --> NotificationSubscriber(\"<br>NotificationSubscriber\")\n    NotificationChannelType --> NotificationChannelType(\"<br><i>NotificationChannelType</i>\")\n    OperationRouterHandler2(\"<br>OperationRouterHandler\") --> NotificationSubscriber2(\"<br>NotificationSubscriber\")\n    NotificationChannelType2 --> NotificationChannelType2(\"<br><i>NotificationChannelType</i>\")\n  end

Every subscription type should have a subscription URL relative to the root notification URL, which in our configs is set to /.notifications/. For every type there is then a OperationRouterHandler that accepts requests to that specific URL, after which a NotificationSubscriber handles all checks related to subscribing, for which it uses a NotificationChannelType. If the subscription is valid and has authorization, the results will be saved in a NotificationChannelStorage.

"},{"location":"architecture/features/notifications/#activity","title":"Activity","text":"
flowchart TB\n  ListeningActivityHandler(\"<strong>ListeningActivityHandler</strong><br>ListeningActivityHandler\")\n  ListeningActivityHandler --> ListeningActivityHandlerArgs\n\n  subgraph ListeningActivityHandlerArgs[\" \"]\n    NotificationChannelStorage(\"<strong>NotificationChannelStorage</strong><br><i>NotificationChannelStorage</i>\")\n    ResourceStore(\"<strong>ResourceStore</strong><br><i>ActivityEmitter</i>\")\n    NotificationHandler(\"<strong>NotificationHandler</strong><br>WaterfallHandler\")\n  end\n\n  NotificationHandler --> NotificationHandlerArgs\n  subgraph NotificationHandlerArgs[\" \"]\n    direction TB\n    NotificationHandler1(\"<br><i>NotificationHandler</i>\")\n    NotificationHandler2(\"<br><i>NotificationHandler</i>\")\n  end

An ActivityEmitter is a class that emits events every time data changes in the server. The MonitoringStore is an implementation of this in the server. The ListeningActivityHandler is the class that listens to these events and makes sure relevant notifications get sent out.

It will pull the relevant subscriptions from the storage and call the stored NotificationHandler for each of time. For every subscription type, a NotificationHandler should be added to the WaterfallHandler that handles notifications for the specific type.

"},{"location":"architecture/features/notifications/#websocketchannel2023","title":"WebSocketChannel2023","text":"

To add support for WebSocketChannel2023 notifications, components were added as described in the documentation above.

For discovery, a NotificationDescriber was added with the corresponding settings.

As NotificationChannelType, there is a specific WebSocketChannel2023Type that contains all the necessary information.

"},{"location":"architecture/features/notifications/#handling-notifications","title":"Handling notifications","text":"

As NotificationHandler, the following architecture is used:

flowchart TB\n  TypedNotificationHandler(\"<br>TypedNotificationHandler\")\n  TypedNotificationHandler --> ComposedNotificationHandler(\"<br>ComposedNotificationHandler\")\n  ComposedNotificationHandler --> ComposedNotificationHandlerArgs\n\n  subgraph ComposedNotificationHandlerArgs[\" \"]\n    direction LR\n    BaseNotificationGenerator(\"<strong>BaseNotificationGenerator</strong><br><i>NotificationGenerator</i>\")\n    BaseNotificationSerializer(\"<strong>BaseNotificationSerializer</strong><br><i>NotificationSerializer</i>\")\n    WebSocket2023Emitter(\"<strong>WebSocket2023Emitter</strong><br>WebSocket2023Emitter\")\n    BaseNotificationGenerator --> BaseNotificationSerializer --> WebSocket2023Emitter\n  end

A TypedNotificationHandler is a handler that can be used to filter out subscriptions for a specific type, making sure only WebSocketChannel2023 subscriptions will be handled.

A ComposedNotificationHandler combines 3 interfaces to handle the notifications:

urn:solid-server:default:BaseNotificationGenerator is a generator that fills in the default Notification template, and also caches the result so it can be reused by multiple subscriptions.

urn:solid-server:default:BaseNotificationSerializer converts the Notification to a JSON-LD representation and handles any necessary content negotiation based on the accept notification feature.

A WebSocket2023Emitter is a specific emitter that checks whether the current open WebSockets correspond to the subscription.

"},{"location":"architecture/features/notifications/#websockets","title":"WebSockets","text":"
flowchart TB\n  WebSocket2023Listener(\"<strong>WebSocket2023Listener</strong><br>WebSocket2023Listener\")\n  WebSocket2023Listener --> WebSocket2023ListenerArgs\n\n  subgraph WebSocket2023ListenerArgs[\" \"]\n    direction LR\n    NotificationChannelStorage(\"<strong>NotificationChannelStorage</strong><br>NotificationChannelStorage\")\n    SequenceHandler(\"<br>SequenceHandler\")\n  end\n\n  SequenceHandler --> SequenceHandlerArgs\n\n  subgraph SequenceHandlerArgs[\" \"]\n    direction TB\n    WebSocket2023Storer(\"<strong>WebSocket2023Storer</strong><br>WebSocket2023Storer\")\n    WebSocket2023StateHandler(\"<strong>WebSocket2023StateHandler</strong><br>BaseStateHandler\")\n  end

To detect and store WebSocket connections, the WebSocket2023Listener is added as a listener to the HTTP server. For all WebSocket connections that get opened, it verifies whether they correspond to an existing subscription. If yes, the information gets sent out to its stored WebSocket2023Handler.

In this case, this is a SequenceHandler, which contains a WebSocket2023Storer and a BaseStateHandler. The WebSocket2023Storer will store the WebSocket in the same map used by the WebSocket2023Emitter, so that class can emit events later on, as mentioned above. The state handler will make sure that a notification gets sent out if the subscription has a state feature request, as defined in the notification specification.

"},{"location":"architecture/features/notifications/#webhookchannel2023","title":"WebHookChannel2023","text":"

The additions required to support WebHookChannel2023 are quite similar to those needed for WebSocketChannel2023:

"},{"location":"architecture/features/protocol/authorization/","title":"Authorization","text":"
flowchart TD\n  AuthorizingHttpHandler(\"<br>AuthorizingHttpHandler\")\n  AuthorizingHttpHandler --> AuthorizingHttpHandlerArgs\n\n  subgraph AuthorizingHttpHandlerArgs[\" \"]\n    CredentialsExtractor(\"<strong>CredentialsExtractor</strong><br><i>CredentialsExtractor</i>\")\n    ModesExtractor(\"<strong>ModesExtractor</strong><br><i>ModesExtractor</i>\")\n    PermissionReader(\"<strong>PermissionReader</strong><br><i>PermissionReader</i>\")\n    Authorizer(\"<strong>Authorizer</strong><br>PermissionBasedAuthorizer\")\n    OperationHttpHandler(\"<br><i>OperationHttpHandler</i>\")\n  end

Authorization is usually handled by the AuthorizingHttpHandler, which receives a parsed HTTP request in the form of an Operation. It goes through the following steps:

  1. A CredentialsExtractor identifies the credentials of the agent making the call.
  2. A ModesExtractor finds which access modes are needed for which resources.
  3. A PermissionReader determines the permissions the agent has on the targeted resources.
  4. The above results are compared in an Authorizer.
  5. If the request is allowed, call the OperationHttpHandler, otherwise throw an error.
"},{"location":"architecture/features/protocol/authorization/#authentication","title":"Authentication","text":"

There are multiple CredentialsExtractors that each determine identity in a different way. Potentially multiple extractors can apply, making a requesting agent have multiple credentials.

The diagram below shows the default configuration if authentication is enabled.

flowchart TD\n  CredentialsExtractor(\"<strong>CredentialsExtractor</strong><br>UnionCredentialsExtractor\")\n  CredentialsExtractor --> CredentialsExtractorArgs\n\n  subgraph CredentialsExtractorArgs[\" \"]\n    WaterfallHandler(\"<br>WaterfallHandler\")\n    PublicCredentialsExtractor(\"<br>PublicCredentialsExtractor\")\n  end\n\n  WaterfallHandler --> WaterfallHandlerArgs\n  subgraph WaterfallHandlerArgs[\" \"]\n    direction LR\n    DPoPWebIdExtractor(\"<br>DPoPWebIdExtractor\") --> BearerWebIdExtractor(\"<br>BearerWebIdExtractor\")\n  end

Both of the WebID extractors make use of the access-token-verifier library to parse incoming tokens based on the Solid-OIDC specification. All these credentials then get combined into a single union object.

If successful, a CredentialsExtractor will return an object containing all the information extracted, such as the WebID of the agent, or the issuer of the token.

There are also debug configuration options available that can be used to simulate credentials. These can be enabled as different options through the config/ldp/authentication imports.

"},{"location":"architecture/features/protocol/authorization/#modes-extraction","title":"Modes extraction","text":"

Access modes are a predefined list of read, write, append, create and delete. The ModesExtractor determine which modes will be necessary and for which resources, based on the request contents.

flowchart TD\n  ModesExtractor(\"<strong>ModesExtractor</strong><br>IntermediateCreateExtractor\")\n  ModesExtractor --> HttpModesExtractor(\"<strong>HttpModesExtractor</strong><br>WaterfallHandler\")\n\n  HttpModesExtractor --> HttpModesExtractorArgs\n\n  subgraph HttpModesExtractorArgs[\" \"]\n    direction LR\n    PatchModesExtractor(\"<strong>PatchModesExtractor</strong><br><i>ModesExtractor</i>\") --> MethodModesExtractor(\"<br>MethodModesExtractor\")\n  end

The IntermediateCreateExtractor is responsible if requests try to create intermediate containers with a single request. E.g., a PUT request to /foo/bar/baz should create both the /foo/ and /foo/bar/ containers in case they do not exist yet. This extractor makes sure that create permissions are also checked on those containers.

Modes can usually be determined based on just the HTTP methods, which is what the MethodModesExtractor does. A GET request will always need the read mode for example.

The only exception are PATCH requests, where the necessary modes depend on the body and the PATCH type.

flowchart TD\n  PatchModesExtractor(\"<strong>PatchModesExtractor</strong><br>WaterfallHandler\") --> PatchModesExtractorArgs\n  subgraph PatchModesExtractorArgs[\" \"]\n    N3PatchModesExtractor(\"<br>N3PatchModesExtractor\")\n    SparqlUpdateModesExtractor(\"<br>SparqlUpdateModesExtractor\")\n  end

The server supports both N3 Patch and SPARQL Update PATCH requests. In both cases it will parse the bodies to determine what the impact would be of the request and what modes it requires.

"},{"location":"architecture/features/protocol/authorization/#permission-reading","title":"Permission reading","text":"

PermissionReaders take the input of the above to determine which permissions are available. The modes from the previous step are not yet needed, but can be used as optimization as we only need to know if we have permission on those modes. Each reader returns all the information it can find based on the resources and modes it receives. In most of the default configuration the following readers are combined when WebACL is enabled as authorization method. In case authorization is disabled by changing the authorization import to config/ldp/authorization/allow-all.json, the diagram would be a single class that always returns all permissions.

flowchart TD\n  PermissionReader(\"<strong>PermissionReader</strong><br>AuxiliaryReader\")\n  PermissionReader --> UnionPermissionReader(\"<br>UnionPermissionReader\")\n  UnionPermissionReader --> UnionPermissionReaderArgs\n\n  subgraph UnionPermissionReaderArgs[\" \"]\n    PathBasedReader(\"<strong>PathBasedReader</strong><br>PathBasedReader\")\n    OwnerPermissionReader(\"<strong>OwnerPermissionReader</strong><br>OwnerPermissionReader\")\n    WrappedWebAclReader(\"<strong>WrappedWebAclReader</strong><br>ParentContainerReader\")\n  end\n\n  WrappedWebAclReader --> WebAclAuxiliaryReader(\"<strong>WebAclAuxiliaryReader</strong><br>AuthAuxiliaryReader\")\n  WebAclAuxiliaryReader --> WebAclReader(\"<strong>WebAclReader</strong><br>WebAclReader\")

The first thing that happens is that if the target is an auxiliary resource that uses the authorization of its subject resource, the AuxiliaryReader inserts that identifier instead. An example of this is if the requests targets the metadata of a resource.

The UnionPermissionReader then combines the results of its readers into a single permission object. If one reader rejects a specific mode and another allows it, the rejection takes priority.

The PathBasedReader rejects all permissions for certain paths. This is used to prevent access to the internal data of the server.

The OwnerPermissionReader makes sure owners always have control access to the pods they created on the server. Users will always be able to modify the ACL resources in their pod, even if they accidentally removed their own access.

The final readers are specifically relevant for the WebACL algorithm. The ParentContainerReader checks the permissions on a parent resource if required: creating a resource requires append permissions on the parent container, while deleting a resource requires write permissions there.

In case the target is an ACL resource, control permissions need to be checked, no matter what mode was generated by the ModesExtractor. The AuthAuxiliaryReader makes sure this conversion happens.

Finally, the WebAclReader implements the efffective ACL resource algorithm and returns the permissions it finds in that resource. In case no ACL resource is found this indicates a configuration error and no permissions will be granted.

"},{"location":"architecture/features/protocol/authorization/#acp","title":"ACP","text":"

It is also possible to use ACP as authorization method instead of WebACL. In that case the diagram is very similar, except the AuthAuxiliaryReader is configured for Access Control Resources, and it points to a AcpReader instead.

"},{"location":"architecture/features/protocol/authorization/#authorization_1","title":"Authorization","text":"

All the results of the previous steps then get combined in the PermissionBasedAuthorizer to either allow or reject a request. If no permissions are found for a requested mode, or they are explicitly forbidden, a 401/403 will be returned, depending on if the agent was logged in or not.

"},{"location":"architecture/features/protocol/overview/","title":"Solid protocol","text":"

The LdpHandler, named as a reference to the Linked Data Platform specification, chains several handlers together, each with their own specific purpose, to fully resolve the HTTP request. It specifically handles Solid requests as described in the protocol specification, e.g. a POST request to create a new resource.

Below is a simplified view of how these handlers are linked.

flowchart LR\n  LdpHandler(\"<strong>LdpHandler</strong><br>ParsingHttphandler\")\n  LdpHandler --> AuthorizingHttpHandler(\"<br>AuthorizingHttpHandler\")\n  AuthorizingHttpHandler --> OperationHandler(\"<strong>OperationHandler</strong><br><i>OperationHandler</i>\")\n  OperationHandler --> ResourceStore(\"<strong>ResourceStore</strong><br><i>ResourceStore</i>\")

A standard request would go through the following steps:

  1. The ParsingHttphandler parses the HTTP request into a manageable format, both body and metadata such as headers.
  2. The AuthorizingHttpHandler verifies if the request is authorized to access the targeted resource.
  3. The OperationHandler determines which action is required based on the HTTP method.
  4. The ResourceStore does all the relevant data work.
  5. The ParsingHttphandler eventually receives the response data, or an error, and handles the output.

Below are sections that go deeper into the specific steps.

"},{"location":"architecture/features/protocol/parsing/","title":"Parsing and responding to HTTP requests","text":"
flowchart TD\n  ParsingHttphandler(\"<br>ParsingHttphandler\")\n  ParsingHttphandler --> ParsingHttphandlerArgs\n\n  subgraph ParsingHttphandlerArgs[\" \"]\n    RequestParser(\"<strong>RequestParser</strong><br>BasicRequestParser\")\n    AuthorizingHttpHandler(\"<strong></strong><br>AuthorizingHttpHandler\")\n    ErrorHandler(\"<strong>ErrorHandler</strong><br><i>ErrorHandler</i>\")\n    ResponseWriter(\"<strong>ResponseWriter</strong><br>BasicResponseWriter\")\n  end

A ParsingHttpHandler handles both the parsing of the input data, and the serializing of the output data. It follows these 3 steps:

  1. Use the RequestParser to convert the incoming data into an Operation.
  2. Send the Operation to the AuthorizingHttpHandler to receive either a Representation if the operation was a success, or an Error in case something went wrong.
  3. Use the ResponseWriter to output the ResponseDescription as an HTTP response.
"},{"location":"architecture/features/protocol/parsing/#parsing-the-request","title":"Parsing the request","text":"
flowchart TD\n  RequestParser(\"<strong>RequestParser</strong><br>BasicRequestParser\") --> RequestParserArgs\n  subgraph RequestParserArgs[\" \"]\n    TargetExtractor(\"<strong>TargetExtractor</strong><br>OriginalUrlExtractor\")\n    PreferenceParser(\"<strong>PreferenceParser</strong><br>AcceptPreferenceParser\")\n    MetadataParser(\"<strong>MetadataParser</strong><br><i>MetadataParser</i>\")\n    BodyParser(\"<br><i>Bodyparser</i>\")\n    Conditions(\"<br>BasicConditionsParser\")\n  end\n\n  OriginalUrlExtractor --> IdentifierStrategy(\"<strong>IdentifierStrategy</strong><br><i>IdentifierStrategy</i>\")

The BasicRequestParser is mostly an aggregator of multiple smaller parsers that each handle a very specific part.

"},{"location":"architecture/features/protocol/parsing/#url","title":"URL","text":"

This is a single class, the OriginalUrlExtractor, but fulfills the very important role of making sure input URLs are handled consistently.

The query parameters will always be completely removed from the URL.

There is also an algorithm to make sure all URLs have a \"canonical\" version as for example both & and %26 can be interpreted in the same way. Specifically all special characters will be encoded into their percent encoding.

The IdentifierStrategy it gets as input is used to determine if the resulting URL is within the scope of the server. This can differ depending on if the server uses subdomains or not.

The resulting identifier will be stored in the target field of an Operation object.

"},{"location":"architecture/features/protocol/parsing/#preferences","title":"Preferences","text":"

The AcceptPreferenceParser parses the Accept header and all the relevant Accept-* headers. These will all be put into the preferences field of an Operation object. These will later be used to handle the content negotiation.

For example, when sending an Accept: text/turtle; q=0.9 header, this wil result in the preferences object { type: { 'text/turtle': 0.9 } }.

"},{"location":"architecture/features/protocol/parsing/#headers","title":"Headers","text":"

Several other headers can have relevant metadata, such as the Content-Type header, or the Link: <http://www.w3.org/ns/ldp#Container>; rel=\"type\" header which is used to indicate to the server that a request intends to create a container.

Such headers are converted to RDF triples and stored in the RepresentationMetadata object, which will be part of the body field in the Operation.

The default MetadataParser is a ParallelHandler that contains several smaller parsers, each looking at a specific header.

"},{"location":"architecture/features/protocol/parsing/#body","title":"Body","text":"

In case of most requests, the input data stream is used directly in the body field of the Operation, with a few minor checks to make sure the HTTP specification is being followed.

In the case of PATCH requests though, there are several specific body parsers that will convert the request into a JavaScript object containing all the necessary information to execute such a PATCH. Several validation checks will already take place there as well.

"},{"location":"architecture/features/protocol/parsing/#conditions","title":"Conditions","text":"

The BasicConditionsParser parses everything related to conditions headers, such as if-none-match or if-modified-since, and stores the relevant information in the conditions field of the Operation. These will later be used to make sure the request should be aborted or not.

"},{"location":"architecture/features/protocol/parsing/#sending-the-response","title":"Sending the response","text":"

In case a request is successful, the AuthorizingHttpHandler will return a ResponseDescription, and if not it will throw an error.

In case an error gets thrown, this will be caught by the ErrorHandler and converted into a ResponseDescription. The request preferences will be used to make sure the serialization is one that is preferred.

Either way we will have a ResponseDescription, which will be sent to the BasicResponseWriter to convert into output headers, data and a status code.

To convert the metadata into headers, it uses a MetadataWriter, which functions as the reverse of the MetadataParser mentioned above: it has multiple writers which each convert certain metadata into a specific header.

"},{"location":"architecture/features/protocol/resource-store/","title":"Resource store","text":"

The interface of a ResourceStore is mostly a 1-to-1 mapping of the HTTP methods:

The corresponding OperationHandler of the relevant method is responsible for calling the correct ResourceStore function.

In practice, the community server has multiple resource stores chained together, each handling a specific part of the request and then calling the next store in the chain. The default configurations come with the following stores:

  1. MonitoringStore
  2. IndexRepresentationStore
  3. LockingResourceStore
  4. PatchingStore
  5. RepresentationConvertingStore
  6. DataAccessorBasedStore

This chain can be seen in the configuration part in config/storage/middleware/default.json and all the entries in config/storage/backend.

"},{"location":"architecture/features/protocol/resource-store/#monitoringstore","title":"MonitoringStore","text":"

This store emits the events that are necessary to emit notifications when resources change.

There are 4 different events that can be emitted:

A changed event will always be emitted if a resource was changed. If the correct metadata was set by the source ResourceStore, an additional field will be sent along indicating the type of change, and an additional corresponding event will be emitted, depending on what the change is.

"},{"location":"architecture/features/protocol/resource-store/#indexrepresentationstore","title":"IndexRepresentationStore","text":"

When doing a GET request on a container /container/, this container returns the contents of /container/index.html instead if HTML is the preferred response type. All these values are the defaults and can be configured for other resources and media types.

"},{"location":"architecture/features/protocol/resource-store/#lockingresourcestore","title":"LockingResourceStore","text":"

To prevent data corruption, the server locks resources when being targeted by a request. Locks are only released when an operation is completely finished, in the case of read operations this means the entire data stream is read, and in the case of write operations this happens when all relevant data is written. The default lock that is used is a readers-writer lock. This allows simultaneous read requests on the same resource, but only while no write request is in progress.

"},{"location":"architecture/features/protocol/resource-store/#patchingstore","title":"PatchingStore","text":"

PATCH operations in Solid apply certain transformations on the target resource, which makes them more complicated than only reading or writing data since it involves both. The PatchingStore provides a generic solution for backends that do not implement the modifyResource function so new backends can be added more easily. In case the next store in the chain does not support PATCH, the PatchingStore will GET the data from the next store, apply the transformation on that data, and then PUT it back to the store.

"},{"location":"architecture/features/protocol/resource-store/#representationconvertingstore","title":"RepresentationConvertingStore","text":"

This store handles everything related to content negotiation. In case the resulting data of a GET request does not match the preferences of a request, it will be converted here. Similarly, if incoming data does not match the type expected by the store, the SPARQL backend only accepts triples for example, that is also handled here

"},{"location":"architecture/features/protocol/resource-store/#dataaccessorbasedstore","title":"DataAccessorBasedStore","text":"

Large parts of the requirements of the Solid protocol specification are resolved by the DataAccessorBasedStore: POST only working on containers, DELETE not working on non-empty containers, generating ldp:contains triples for containers, etc. Most of this behaviour is independent of how the data is stored which is why it can be generalized here. The store's name comes from the fact that it makes use of DataAccessors to handle the read/write of resources. A DataAccessor is a simple interface that only focuses on handling the data. It does not concern itself with any of the necessary Solid checks as it assumes those have already been made. This means that if a storage method needs to be supported, only a new DataAccessor needs to be made, after which it can be plugged into the rest of the server.

"},{"location":"contributing/making-changes/","title":"Pull requests","text":"

The community server is fully written in Typescript.

All changes should be done through pull requests.

We recommend first discussing a possible solution in the relevant issue to reduce the amount of changes that will be requested.

In case any of your changes are breaking, make sure you target the next major branch (versions/x.0.0) instead of the main branch. Breaking changes include: changing interface/class signatures, potentially breaking external custom configurations, and breaking how internal data is stored. In case of doubt you probably want to target the next major branch.

We make use of Conventional Commits.

Don't forget to update the release notes when adding new major features. Also update any relevant documentation in case this is needed.

When making changes to a pull request, we prefer to update the existing commits with a rebase instead of appending new commits, this way the PR can be rebased directly onto the target branch instead of needing to be squashed.

There are strict requirements from the linter and the test coverage before a PR is valid. These are configured to run automatically when trying to commit to git. Although there are no tests for it (yet), we strongly advice documenting with TSdoc.

If a list of entries is alphabetically sorted, such as index.ts, make sure it stays that way.

"},{"location":"contributing/release/","title":"Releasing a new major version","text":"

This is only relevant if you are a developer with push access responsible for doing a new release.

Steps to follow:

"},{"location":"contributing/release/#changes-when-doing-a-pre-release","title":"Changes when doing a pre-release","text":""},{"location":"contributing/release/#changes-when-doing-a-minor-release","title":"Changes when doing a minor release","text":""},{"location":"usage/client-credentials/","title":"Automating authentication with Client Credentials","text":"

One potential issue for scripts and other applications is that it requires user interaction to log in and authenticate. The CSS offers an alternative solution for such cases by making use of Client Credentials. Once you have created an account as described in the Identity Provider section, users can request a token that apps can use to authenticate without user input.

All requests to the client credentials API currently require you to send along the email and password of that account to identify yourself. This is a temporary solution until the server has more advanced account management, after which this API will change.

Below is example code of how to make use of these tokens. It makes use of several utility functions from the Solid Authentication Client. Note that the code below uses top-level await, which not all JavaScript engines support, so this should all be contained in an async function.

"},{"location":"usage/client-credentials/#generating-a-token","title":"Generating a token","text":"

The code below generates a token linked to your account and WebID. This only needs to be done once, afterwards this token can be used for all future requests.

import fetch from 'node-fetch';\n\n// This assumes your server is started under http://localhost:3000/.\n// This URL can also be found by checking the controls in JSON responses when interacting with the IDP API,\n// as described in the Identity Provider section.\nconst response = await fetch('http://localhost:3000/idp/credentials/', {\n  method: 'POST',\n  headers: { 'content-type': 'application/json' },\n  // The email/password fields are those of your account.\n  // The name field will be used when generating the ID of your token.\n  body: JSON.stringify({ email: 'my-email@example.com', password: 'my-account-password', name: 'my-token' }),\n});\n\n// These are the identifier and secret of your token.\n// Store the secret somewhere safe as there is no way to request it again from the server!\nconst { id, secret } = await response.json();\n

If there is something wrong with your input the response code will be 500. If no account is linked to the email, the message will be \"Account does not exist\" and if the password is wrong it will be \"Incorrect password\".

"},{"location":"usage/client-credentials/#requesting-an-access-token","title":"Requesting an Access token","text":"

The ID and secret combination generated above can be used to request an Access Token from the server. This Access Token is only valid for a certain amount of time, after which a new one needs to be requested.

import { createDpopHeader, generateDpopKeyPair } from '@inrupt/solid-client-authn-core';\nimport fetch from 'node-fetch';\n\n// A key pair is needed for encryption.\n// This function from `solid-client-authn` generates such a pair for you.\nconst dpopKey = await generateDpopKeyPair();\n\n// These are the ID and secret generated in the previous step.\n// Both the ID and the secret need to be form-encoded.\nconst authString = `${encodeURIComponent(id)}:${encodeURIComponent(secret)}`;\n// This URL can be found by looking at the \"token_endpoint\" field at\n// http://localhost:3000/.well-known/openid-configuration\n// if your server is hosted at http://localhost:3000/.\nconst tokenUrl = 'http://localhost:3000/.oidc/token';\nconst response = await fetch(tokenUrl, {\n  method: 'POST',\n  headers: {\n    // The header needs to be in base64 encoding.\n    authorization: `Basic ${Buffer.from(authString).toString('base64')}`,\n    'content-type': 'application/x-www-form-urlencoded',\n    dpop: await createDpopHeader(tokenUrl, 'POST', dpopKey),\n  },\n  body: 'grant_type=client_credentials&scope=webid',\n});\n\n// This is the Access token that will be used to do an authenticated request to the server.\n// The JSON also contains an \"expires_in\" field in seconds,\n// which you can use to know when you need request a new Access token.\nconst { access_token: accessToken } = await response.json();\n
"},{"location":"usage/client-credentials/#using-the-access-token-to-make-an-authenticated-request","title":"Using the Access token to make an authenticated request","text":"

Once you have an Access token, you can use it for authenticated requests until it expires.

import { buildAuthenticatedFetch } from '@inrupt/solid-client-authn-core';\nimport fetch from 'node-fetch';\n\n// The DPoP key needs to be the same key as the one used in the previous step.\n// The Access token is the one generated in the previous step.\nconst authFetch = await buildAuthenticatedFetch(fetch, accessToken, { dpopKey });\n// authFetch can now be used as a standard fetch function that will authenticate as your WebID.\n// This request will do a simple GET for example.\nconst response = await authFetch('http://localhost:3000/private');\n
"},{"location":"usage/client-credentials/#deleting-a-token","title":"Deleting a token","text":"

You can see all your existing tokens by doing a POST to http://localhost:3000/idp/credentials/ with as body a JSON object containing your email and password. The response will be a JSON list containing all your tokens.

Deleting a token requires also doing a POST to the same URL, but adding a delete key to the JSON input object with as value the ID of the token you want to remove.

"},{"location":"usage/dev-configuration/","title":"Configuring the CSS as a development server in another project","text":"

It can be useful to use the CSS as local server to develop Solid applications against. As an alternative to using CLI arguments, or environment variables, the CSS can be configured in the package.json as follows:

{\n  \"name\": \"test\",\n  \"version\": \"0.0.0\",\n  \"private\": \"true\",\n  \"config\": {\n    \"community-solid-server\": {\n      \"port\": 3001,\n      \"loggingLevel\": \"error\"\n    }\n  },\n  \"scripts\": {\n    \"dev:pod\": \"community-solid-server\"\n  },\n  \"devDependencies\": {\n    \"@solid/community-server\": \"^6.0.0\"\n  }\n}\n

These parameters will then be used when the community-solid-server command is executed as an npm script (as shown in the example above). Or whenever the community-solid-server command is executed in the same folder as the package.json.

Alternatively, the configuration parameters may be placed in a configuration file named .community-solid-server.config.json as follows:

{\n  \"port\": 3001,\n  \"loggingLevel\": \"error\"\n}\n

The config may also be written in JavaScript with the config as the default export such as the following .community-solid-server.config.js:

module.exports = {\n  port: 3001,\n  loggingLevel: \"error\"\n};\n
"},{"location":"usage/example-requests/","title":"Interacting with the server","text":""},{"location":"usage/example-requests/#put-creating-resources-for-a-given-url","title":"PUT: Creating resources for a given URL","text":"

Create a plain text file:

curl -X PUT -H \"Content-Type: text/plain\" \\\n  -d \"abc\" \\\n  http://localhost:3000/myfile.txt\n

Create a turtle file:

curl -X PUT -H \"Content-Type: text/turtle\" \\\n  -d \"<ex:s> <ex:p> <ex:o>.\" \\\n  http://localhost:3000/myfile.ttl\n
"},{"location":"usage/example-requests/#post-creating-resources-at-a-generated-url","title":"POST: Creating resources at a generated URL","text":"

Create a plain text file:

curl -X POST -H \"Content-Type: text/plain\" \\\n  -d \"abc\" \\\n  http://localhost:3000/\n

Create a turtle file:

curl -X POST -H \"Content-Type: text/turtle\" \\\n  -d \"<ex:s> <ex:p> <ex:o>.\" \\\n  http://localhost:3000/\n

The response's Location header will contain the URL of the created resource.

"},{"location":"usage/example-requests/#get-retrieving-resources","title":"GET: Retrieving resources","text":"

Retrieve a plain text file:

curl -H \"Accept: text/plain\" \\\n  http://localhost:3000/myfile.txt\n

Retrieve a turtle file:

curl -H \"Accept: text/turtle\" \\\n  http://localhost:3000/myfile.ttl\n

Retrieve a turtle file in a different serialization:

curl -H \"Accept: application/ld+json\" \\\n  http://localhost:3000/myfile.ttl\n
"},{"location":"usage/example-requests/#delete-deleting-resources","title":"DELETE: Deleting resources","text":"
curl -X DELETE http://localhost:3000/myfile.txt\n
"},{"location":"usage/example-requests/#patch-modifying-resources","title":"PATCH: Modifying resources","text":"

Modify a resource using N3 Patch:

curl -X PATCH -H \"Content-Type: text/n3\" \\\n  --data-raw \"@prefix solid: <http://www.w3.org/ns/solid/terms#>. _:rename a solid:InsertDeletePatch; solid:inserts { <ex:s2> <ex:p2> <ex:o2>. }.\" \\\n  http://localhost:3000/myfile.ttl\n

Modify a resource using SPARQL Update:

curl -X PATCH -H \"Content-Type: application/sparql-update\" \\\n  -d \"INSERT DATA { <ex:s2> <ex:p2> <ex:o2> }\" \\\n  http://localhost:3000/myfile.ttl\n
"},{"location":"usage/example-requests/#head-retrieve-resources-headers","title":"HEAD: Retrieve resources headers","text":"
curl -I -H \"Accept: text/plain\" \\\n  http://localhost:3000/myfile.txt\n
"},{"location":"usage/example-requests/#options-retrieve-resources-communication-options","title":"OPTIONS: Retrieve resources communication options","text":"
curl -X OPTIONS -i http://localhost:3000/myfile.txt\n
"},{"location":"usage/identity-provider/","title":"Identity Provider","text":"

Besides implementing the Solid protocol, the community server can also be an Identity Provider (IDP), officially known as an OpenID Provider (OP), following the Solid OIDC spec as much as possible.

It is recommended to use the latest version of the Solid authentication client to interact with the server.

The links here assume the server is hosted at http://localhost:3000/.

"},{"location":"usage/identity-provider/#registering-an-account","title":"Registering an account","text":"

To register an account, you can go to http://localhost:3000/idp/register/ if this feature is enabled, which it is on most configurations we provide. Currently our registration page ties 3 features together on the same page:

"},{"location":"usage/identity-provider/#account","title":"Account","text":"

To create an account you need to provide an email address and password. The password will be salted and hashed before being stored. As of now, the account is only used to log in and identify yourself to the IDP when you want to do an authenticated request, but in future the plan is to also use this for account/pod management.

"},{"location":"usage/identity-provider/#webid","title":"WebID","text":"

We require each account to have a corresponding WebID. You can either let the server create a WebID for you in a pod, which will also need to be created then, or you can link an already existing WebID you have on an external server.

In case you try to link your own WebID, you can choose if you want to be able to use this server as your IDP for this WebID. If not, you can still create a pod, but you will not be able to direct the authentication client to this server to identify yourself.

Additionally, if you try to register with an external WebID, the first attempt will return an error indicating you need to add an identification triple to your WebID. After doing that you can try to register again. This is how we verify you are the owner of that WebID. After registration the next page will inform you that you have to add an additional triple to your WebID if you want to use the server as your IDP.

All of the above is automated if you create the WebID on the server itself.

"},{"location":"usage/identity-provider/#pod","title":"Pod","text":"

To create a pod you simply have to fill in the name you want your pod to have. This will then be used to generate the full URL of your pod. For example, if you choose the name test, your pod would be located at http://localhost:3000/test/ and your generated WebID would be http://localhost:3000/test/profile/card#me.

The generated name also depends on the configuration you chose for your server. If you are using the subdomain feature, such as being done in the config/memory-subdomains.json configuration, the generated pod URL would be http://test.localhost:3000/.

"},{"location":"usage/identity-provider/#logging-in","title":"Logging in","text":"

When using an authenticating client, you will be redirected to a login screen asking for your email and password. After that you will be redirected to a page showing some basic information about the client. There you need to consent that this client is allowed to identify using your WebID. As a result the server will send a token back to the client that contains all the information needed to use your WebID.

"},{"location":"usage/identity-provider/#forgot-password","title":"Forgot password","text":"

If you forgot your password, you can recover it by going to http://localhost:3000/idp/forgotpassword/. There you can enter your email address to get a recovery mail to reset your password. This feature only works if a mail server was configured, which by default is not the case.

"},{"location":"usage/identity-provider/#json-api","title":"JSON API","text":"

All of the above happens through HTML pages provided by the server. By default, the server uses the templates found in /templates/identity/email-password/ but different templates can be used through configuration.

These templates all make use of a JSON API exposed by the server. For example, when doing a GET request to http://localhost:3000/idp/register/ with a JSON accept header, the following JSON is returned:

{\n  \"required\": {\n    \"email\": \"string\",\n    \"password\": \"string\",\n    \"confirmPassword\": \"string\",\n    \"createWebId\": \"boolean\",\n    \"register\": \"boolean\",\n    \"createPod\": \"boolean\",\n    \"rootPod\": \"boolean\"\n  },\n  \"optional\": {\n    \"webId\": \"string\",\n    \"podName\": \"string\",\n    \"template\": \"string\"\n  },\n  \"controls\": {\n    \"register\": \"http://localhost:3000/idp/register/\",\n    \"index\": \"http://localhost:3000/idp/\",\n    \"prompt\": \"http://localhost:3000/idp/prompt/\",\n    \"login\": \"http://localhost:3000/idp/login/\",\n    \"forgotPassword\": \"http://localhost:3000/idp/forgotpassword/\"\n  },\n  \"apiVersion\": \"0.3\"\n}\n

The required and optional fields indicate which input fields are expected by the API. These correspond to the fields of the HTML registration page. To register a user, you can do a POST request with a JSON body containing the correct fields:

{\n  \"email\": \"test@example.com\",\n  \"password\": \"secret\",\n  \"confirmPassword\": \"secret\",\n  \"createWebId\": true,\n  \"register\": true,\n  \"createPod\": true,\n  \"rootPod\": false,\n  \"podName\": \"test\"\n}\n

Two fields here that are not covered on the HTML page above are rootPod and template. rootPod tells the server to put the pod in the root of the server instead of a location based on the podName. By default the server will reject requests where this is true, except during setup. template is only used by servers running the config/dynamic.json configuration, which is a very custom setup where every pod can have a different Components.js configuration, so this value can usually be ignored.

"},{"location":"usage/identity-provider/#idp-configuration","title":"IDP configuration","text":"

The above descriptions cover server behaviour with most default configurations, but just like any other feature, there are several features that can be changed through the imports in your configuration file.

All available options can be found in the config/identity/ folder. Below we go a bit deeper into the available options

"},{"location":"usage/identity-provider/#access","title":"access","text":"

The access option allows you to set authorization restrictions on the IDP API when enabled, similar to how authorization works on the LDP requests on the server. For example, if the server uses WebACL as authorization scheme, you can put a .acl resource in the /idp/register/ container to restrict who is allowed to access the registration API. Note that for everything to work there needs to be a .acl resource in /idp/ when using WebACL so resources can be accessed as usual when the server starts up. Make sure you change the permissions on /idp/.acl so not everyone can modify those.

All of the above is only relevant if you use the restricted.json setting for this import. When you use public.json the API will simply always be accessible by everyone.

"},{"location":"usage/identity-provider/#email","title":"email","text":"

In case you want users to be able to reset their password when they forget it, you will need to tell the server which email server to use to send reset mails. example.json contains an example of what this looks like, which you will need to copy over to your base configuration and then remove the config/identity/email import.

"},{"location":"usage/identity-provider/#handler","title":"handler","text":"

There is only one option here. This import contains all the core components necessary to make the IDP work. In case you need to make some changes to core IDP settings, this is where you would have to look.

"},{"location":"usage/identity-provider/#pod_1","title":"pod","text":"

The pod options determines how pods are created. static.json is the expected pod behaviour as described above. dynamic.json is an experimental feature that allows users to have a custom Components.js configuration for their own pod. When using such a setup, a JSON file will be written containing all the information of the user pods so they can be recreated when the server restarts.

"},{"location":"usage/identity-provider/#registration","title":"registration","text":"

This setting allows you to enable/disable registration on the server. Disabling registration here does not disable registration during setup, meaning you can still use this server as an IDP with the account created there.

"},{"location":"usage/metadata/","title":"Editing metadata of resources","text":""},{"location":"usage/metadata/#what-is-a-description-resource","title":"What is a description resource","text":"

Description resources contain auxiliary information about a resource. In CSS, these represent metadata corresponding to that resource. Every resource always has a corresponding description resource and therefore description resources can not be created or deleted directly.

Description resources are discoverable by interacting with their subject resource: the response to a GET or HEAD request on a subject resource will contain a describedby Link Header with a URL that points to its description resource.

Clients should always follow this link rather than guessing its URL, because the Solid Protocol does not mandate a specific description resource URL. The default CSS configurations use as a convention that http://example.org/resource has http://example.org/resource.meta as its description resource.

"},{"location":"usage/metadata/#how-to-edit-the-metadata-of-a-resource","title":"How to edit the metadata of a resource","text":"

Editing the metadata of a resource is performed by editing the description resource directly. This can only be done using PATCH requests (see example workflow).

PUT requests on description resources are not allowed, because they would replace the entire resource state, whereas some metadata is protected or generated by the server.

Similarly, DELETE on description resources is not allowed because a resource will always have some metadata (e.g. rdf:type). Instead, the lifecycle of description resources is managed by the server.

"},{"location":"usage/metadata/#protected-metadata","title":"Protected metadata","text":"

Some metadata is managed by the server and can not be modified directly, such as the last modified date. The CSS will throw an error (409 ConflictHttpError) when trying to change this protected metadata.

"},{"location":"usage/metadata/#preserving-metadata","title":"Preserving metadata","text":"

PUT requests on a resource will reset the description resource. There is however a way to keep the contents of description resource prior to the PUT request: adding the HTTP Link header targeting the description resource with rel=\"preserve\".

When the resource URL is http://localhost:3000/foobar, preserving its description resource when updating its contents can be achieved like in the following example:

curl -X PUT 'http://localhost:3000/foobar' \\\n-H 'Content-Type: text/turtle' \\\n-H 'Link: <http://localhost:3000/foobar.meta>;rel=\"preserve\"' \\\n-d \"<ex:s> <ex:p> <ex:o>.\"\n
"},{"location":"usage/metadata/#impact-on-creating-containers","title":"Impact on creating containers","text":"

When creating a container the input body is ignored and performing a PUT request on an existing container will result in an error. Container metadata can only be added and modified by performing a PATCH on the description resource, similarly to documents. This is done to clearly differentiate between a container's representation and its metadata.

"},{"location":"usage/metadata/#example-of-a-workflow-for-editing-a-description-resource","title":"Example of a workflow for editing a description resource","text":"

In this example, we add an inbox description to http://localhost:3000/foo/. This allows discovery of the ldp:inbox as described in the Linked Data Notifications specification.

We have started the CSS with the default configuration and have already created an inbox at http://localhost:3000/inbox/.

Since we don't know the location of the description resource, we first send a HEAD request to the resource to obtain the URL of its description resource.

curl --head 'http://localhost:3000/foo/'\n

which will produce a response with at least these headers:

HTTP/1.1 200 OK\nLink: <http://localhost:3000/foo/.meta>; rel=\"describedby\"\n

Now that we have the URL of the description resource, we create a patch for adding the inbox in the description of the resource.

curl -X PATCH 'http://localhost:3000/foo/.meta' \\\n-H 'Content-Type: text/n3' \\\n--data-raw '@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n<> a solid:InsertDeletePatch;\nsolid:inserts { <http://localhost:3000/foo/> <http://www.w3.org/ns/ldp#inbox> <http://localhost:3000/inbox/>. }.'\n

After this update, we can verify that the inbox is added by performing a GET request to the description resource

curl 'http://localhost:3000/foo/.meta'\n

With as result for the body

@prefix dc: <http://purl.org/dc/terms/>.\n@prefix ldp: <http://www.w3.org/ns/ldp#>.\n@prefix posix: <http://www.w3.org/ns/posix/stat#>.\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.\n\n<http://localhost:3000/foo/> a ldp:Container, ldp:BasicContainer, ldp:Resource;\n    dc:modified \"2022-06-09T08:17:07.000Z\"^^xsd:dateTime;\n    ldp:inbox <http://localhost:3000/inbox/>;.\n

This can also be verified by sending a GET request to the subject resource itself. The inbox location can also be found in the Link headers.

curl -v 'http://localhost:3000/foo/'\n
HTTP/1.1 200 OK\nLink: <http://localhost:3000/inbox/>; rel=\"http://www.w3.org/ns/ldp#inbox\"\n
"},{"location":"usage/notifications/","title":"Receiving notifications","text":"

A CSS instance can be configured to support Solid notifications. These can be used to track changes on the server. There are no specific requirements on the type of notifications a Solid server should support, so on this page we'll describe the notification types supported by CSS, and how to make use of the different ways supported to receive notifications.

"},{"location":"usage/notifications/#discovering-subscription-services","title":"Discovering subscription services","text":"

CSS only supports discovering the notification subscription services through the storage description resource. This can be found by doing a HEAD request on any resource in your pod and looking for the Link header with the http://www.w3.org/ns/solid/terms#storageDescription relationship.

For example, when hosting the server on localhost with port 3000, the result is:

Link: <http://localhost:3000/.well-known/solid>; rel=\"http://www.w3.org/ns/solid/terms#storageDescription\"\n

Doing a GET to http://localhost:3000/.well-known/solid then gives the following result (simplified for readability):

@prefix notify: <http://www.w3.org/ns/solid/notifications#>.\n\n<http://localhost:3000/.well-known/solid>\n    a                   <http://www.w3.org/ns/pim/space#Storage> ;\n    notify:subscription <http://localhost:3000/.notifications/WebSocketChannel2023/> ,\n                        <http://localhost:3000/.notifications/WebhookChannel2023/> .\n<http://localhost:3000/.notifications/WebSocketChannel2023/>\n    notify:channelType  notify:WebSocketChannel2023 ;\n    notify:feature      notify:accept ,\n                        notify:endAt ,\n                        notify:rate ,\n                        notify:startAt ,\n                        notify:state .\n<http://localhost:3000/.notifications/WebhookChannel2023/>\n    notify:channelType  notify:WebhookChannel2023;\n    notify:feature      notify:accept ,\n                        notify:endAt ,\n                        notify:rate ,\n                        notify:startAt ,\n                        notify:state .\n

This says that there are two available subscription services that can be used for notifications and where to find them. Note that these discovery requests also support content-negotiation, so you could ask for JSON-LD if you prefer. Currently, however, this JSON-LD will not match the examples from the notification specification.

The above tells us where to send subscriptions and which features are supported for those services. You subscribe to a channel by POSTing a JSON-LD document to the subscription services. There are some small differences in the structure of these documents, depending on the channel type, which will be discussed below.

Subscription requests need to be authenticated using Solid-OIDC. The server will check whether you have Read permission on the resource you want to listen to. Requests without Read permission will be rejected.

"},{"location":"usage/notifications/#notification-channel-types","title":"Notification channel types","text":"

There are currently up to two supported ways to get notifications in CSS, depending on your configuration: the notification channel types WebSocketChannel2023; and WebhookChannel2023.

"},{"location":"usage/notifications/#websockets","title":"WebSockets","text":"

To subscribe to the http://localhost:3000/foo resource using WebSockets, you use an authenticated POST request to send the following JSON-LD document to the server, at http://localhost:3000/.notifications/WebSocketChannel2023/:

{\n  \"@context\": [\"https://www.w3.org/ns/solid/notification/v1\"],\n  \"type\": \"http://www.w3.org/ns/solid/notifications#WebSocketChannel2023\",\n  \"topic\": \"http://localhost:3000/foo\"\n}\n

If you have Read permissions, the server's reply will look like this:

{\n  \"@context\": [ \"https://www.w3.org/ns/solid/notification/v1\" ],\n  \"id\": \"http://localhost:3000/.notifications/WebSocketChannel2023/dea6f614-08ab-4cc1-bbca-5dece0afb1e2\",\n  \"type\": \"http://www.w3.org/ns/solid/notifications#WebSocketChannel2023\",\n  \"topic\": \"http://localhost:3000/foo\",\n  \"receiveFrom\": \"ws://localhost:3000/.notifications/WebSocketChannel2023/?auth=http%3A%2F%2Flocalhost%3A3000%2F.notifications%2FWebSocketChannel2023%2Fdea6f614-08ab-4cc1-bbca-5dece0afb1e2\"\n}\n

The most important field is receiveFrom. This field tells you the WebSocket to which you need to connect, through which you will start receiving notifications. In JavaScript, this can be done using the WebSocket object, such as:

const ws = new WebSocket(receiveFrom);\nws.on('message', (notification) => console.log(notification));\n
"},{"location":"usage/notifications/#webhooks","title":"Webhooks","text":"

Similar to the WebSocket subscription, below is sample JSON-LD that would be sent to http://localhost:3000/.notifications/WebhookChannel2023/:

{\n  \"@context\": [ \"https://www.w3.org/ns/solid/notification/v1\" ],\n  \"type\": \"http://www.w3.org/ns/solid/notifications#WebhookChannel2023\",\n  \"topic\": \"http://localhost:3000/foo\",\n  \"sendTo\": \"https://example.com/webhook\"\n}\n

Note that this document has an additional sendTo field. This is the Webhook URL of your server, the URL to which you want the notifications to be sent.

The response would then be something like this:

{\n  \"@context\": [ \"https://www.w3.org/ns/solid/notification/v1\" ],\n  \"id\": \"http://localhost:3000/.notifications/WebhookChannel2023/eeaf2c17-699a-4e53-8355-e91d13807e5f\",\n  \"type\": \"http://www.w3.org/ns/solid/notifications#WebhookChannel2023\",\n  \"topic\": \"http://localhost:3000/foo\",\n  \"sendTo\": \"https://example.com/webhook\"\n}\n
"},{"location":"usage/notifications/#unsubscribing-from-a-notification-channel","title":"Unsubscribing from a notification channel","text":"

Note

This feature is not part of the Solid Notification v0.2 specification so might be changed or removed in the future.

If you no longer want to receive notifications on the channel you created, you can send a DELETE request to the channel to remove it. Use the value found in the id field of the subscription response. There is no way to retrieve this identifier later on, so make sure to keep track of it just in case you want to unsubscribe at some point. No authorization is needed for this request.

"},{"location":"usage/notifications/#notification-format","title":"Notification format","text":"

Below is an example notification that would be sent when a resource changes:

{\n  \"@context\": [\n    \"https://www.w3.org/ns/activitystreams\",\n    \"https://www.w3.org/ns/solid/notification/v1\"\n  ],\n  \"id\": \"urn:123456:http://example.com/foo\",\n  \"type\": \"Update\",\n  \"object\": \"http://localhost:3000/foo\",\n  \"state\": \"987654\",\n  \"published\": \"2023-02-09T15:08:12.345Z\"\n}\n

A notification contains the following fields:

"},{"location":"usage/notifications/#notification-types","title":"Notification types","text":"

CSS supports five different notification types that the client can receive. The format of the notification can slightly change depending on the type.

Resource notification types:

Additionally, when listening to a container, there are two extra notifications that are sent out when the contents of the container change. For these notifications, the object fields references the resource that was added or removed, while the new target field references the container itself.

"},{"location":"usage/notifications/#features","title":"Features","text":"

The Solid notification specification describes several extra features that can be supported by notification channels. By default, these are all supported on the channels of a CSS instance, as can be seen in the descriptions returned by the server above. Each feature can be enabled by adding a field to the JSON-LD you send during subscription. The available fields are:

"},{"location":"usage/notifications/#important-note-for-server-owners","title":"Important note for server owners","text":"

There is not much restriction on who can create a new notification channel; only Read permissions on the target resource are required. It is therefore possible for the server to accumulate created channels. As these channels still get used every time their corresponding resource changes, this could degrade server performance.

For this reason, the default server configuration removes notification channels after two weeks (20160 minutes). You can modify this behaviour by adding the following block to your configuration:

{\n  \"@id\": \"urn:solid-server:default:WebSocket2023Subscriber\",\n  \"@type\": \"NotificationSubscriber\",\n  \"maxDuration\": 20160\n}\n

maxDuration defines after how many minutes every channel will be removed. Setting this value to 0 will allow channels to exist forever. Similarly, to change the maximum duration of webhook channels you can use the identifier urn:solid-server:default:WebHookSubscriber.

"},{"location":"usage/seeding-pods/","title":"How to seed Accounts and Pods","text":"

If you need to seed accounts and pods, the --seededPodConfigJson command line option can be used with as value the path to a JSON file containing configurations for every required pod. The file needs to contain an array of JSON objects, with each object containing at least a podName, email, and password field.

For example:

[\n  {\n    \"podName\": \"example\",\n    \"email\": \"hello@example.com\",\n    \"password\": \"abc123\"\n  }\n]\n

You may optionally specify other parameters as described in the Identity Provider documentation.

For example, to set up a pod without registering the generated WebID with the Identity Provider:

[\n  {\n    \"podName\": \"example\",\n    \"email\": \"hello@example.com\",\n    \"password\": \"abc123\",\n    \"webId\": \"https://id.inrupt.com/example\",\n    \"register\": false\n  }\n]\n

This feature cannot be used to register pods with pre-existing WebIDs, which requires an interactive validation step.

"},{"location":"usage/starting-server/","title":"Starting the Community Solid Server","text":""},{"location":"usage/starting-server/#quickly-spinning-up-a-server","title":"Quickly spinning up a server","text":"

Use Node.js\u00a014.14 or up and execute:

npx @solid/community-server\n

Now visit your brand new server at http://localhost:3000/!

To persist your pod's contents between restarts, use:

npx @solid/community-server -c @css:config/file.json -f data/\n
"},{"location":"usage/starting-server/#local-installation","title":"Local installation","text":"

Install the npm package globally with:

npm install -g @solid/community-server\n

To run the server with in-memory storage, use:

community-solid-server # add parameters if needed\n

To run the server with your current folder as storage, use:

community-solid-server -c @css:config/file.json -f data/\n
"},{"location":"usage/starting-server/#configuring-the-server","title":"Configuring the server","text":"

The Community Solid Server is designed to be flexible such that people can easily run different configurations. This is useful for customizing the server with plugins, testing applications in different setups, or developing new parts for the server without needing to change its base code.

An easy way to customize the server is by passing parameters to the server command. These parameters give you direct access to some commonly used settings:

parameter name default value description --port, -p 3000 The TCP port on which the server should listen. --baseUrl, -b http://localhost:$PORT/ The base URL used internally to generate URLs. Change this if your server does not run on http://localhost:$PORT/. --socket The Unix Domain Socket on which the server should listen. --baseUrl must be set if this option is provided --loggingLevel, -l info The detail level of logging; useful for debugging problems. Use debug for full information. --config, -c @css:config/default.json The configuration(s) for the server. The default only stores data in memory; to persist to your filesystem, use @css:config/file.json --rootFilePath, -f ./ Root folder where the server stores data, when using a file-based configuration. --sparqlEndpoint, -s URL of the SPARQL endpoint, when using a quadstore-based configuration. --showStackTrace, -t false Enables detailed logging on error output. --podConfigJson ./pod-config.json Path to the file that keeps track of dynamic Pod configurations. Only relevant when using @css:config/dynamic.json. --seededPodConfigJson Path to the file that keeps track of seeded Pod configurations. --mainModulePath, -m Path from where Components.js will start its lookup when initializing configurations. --workers, -w 1 Run in multithreaded mode using workers. Special values are -1 (scale to num_cores-1), 0 (scale to num_cores) and 1 (singlethreaded).

Parameters can also be passed through environment variables.

They are prefixed with CSS_ and converted from camelCase to CAMEL_CASE

eg. --showStackTrace => CSS_SHOW_STACK_TRACE

Command-line arguments will always override environment variables.

"},{"location":"usage/starting-server/#alternative-ways-to-run-the-server","title":"Alternative ways to run the server","text":""},{"location":"usage/starting-server/#from-source","title":"From source","text":"

If you rather prefer to run the latest source code version, or if you want to try a specific branch of the code, you can use:

git clone https://github.com/CommunitySolidServer/CommunitySolidServer.git\ncd CommunitySolidServer\nnpm ci\nnpm start -- # add parameters if needed\n
"},{"location":"usage/starting-server/#via-docker","title":"Via Docker","text":"

Docker allows you to run the server without having Node.js installed. Images are built on each tagged version and hosted on Docker Hub.

# Clone the repo to get access to the configs\ngit clone https://github.com/CommunitySolidServer/CommunitySolidServer.git\ncd CommunitySolidServer\n# Run the image, serving your `~/Solid` directory on `http://localhost:3000`\ndocker run --rm -v ~/Solid:/data -p 3000:3000 -it solidproject/community-server:latest\n# Or use one of the built-in configurations\ndocker run --rm -p 3000:3000 -it solidproject/community-server -c config/default.json\n# Or use your own configuration mapped to the right directory\ndocker run --rm -v ~/solid-config:/config -p 3000:3000 -it solidproject/community-server -c /config/my-config.json\n# Or use environment variables to configure your css instance\ndocker run --rm -v ~/Solid:/data -p 3000:3000 -it -e CSS_CONFIG=config/file-no-setup.json -e CSS_LOGGING_LEVEL=debug solidproject/community-server\n
"},{"location":"usage/starting-server/#using-a-helm-chart","title":"Using a Helm Chart","text":"

The official Helm Chart for Kubernetes deployment is maintained at CommunitySolidServer/css-helm-chart and published on ArtifactHUB. There you will find complete installation instructions.

# Summary\nhelm repo add community-solid-server https://communitysolidserver.github.io/css-helm-chart/charts/\nhelm install my-css community-solid-server/community-solid-server\n
"}]}