Molid - A mock solid server for local testing


#1

When building Solid apps I was in need of a dummy server that just returns some data that I can easily adjust while developing an app - without setting up a real pod and without having to rely on a internet connection.

That’s why I built Molid, a very simple mock server that is able to serve fake linked data for local app development.

Quick start :rocket:

Start using npx, no installation needed

npx molid

Molid - mock Solid server listening on port 3333!

Molid provides some Solid data, that you can now access via HTTP, e.g.

curl http://localhost:3333/profile/card

All the mock data is stored within the .molid folder in your current directory. Adjust it to your needs and restart.

Usage within your Solid app project

See Readme

Is this useful for you?

Please let me know if this helps you too developing solid app! I know it is very limited for now. Feel free to open an issue and requests features you need for your app development.

If you have any questions, I am happy to help.

Source Code

Of course Molid is fully open source:


NSS with login free mode
#2

Thanks for sharing this with us, I think that mock servers can be pretty useful for developing. I wonder how it compares to other tools for that I know of.

In the update of solid-file-client we currently use solid-auth-cli to test all fetch methods. solid-auth-cli provides a fetch method which accepts app://ls/foo/bar urls for in-memory storage of a pod, file://foo/bar urls for using the file storage as a pod, and http[s] urls for using a remote (or localhost) pod. In our case we setup a test folder in the memory/file storage and then run our tests against it.
Advantages I see compared to Molid: can programmatically create test setup. can use GET/POST/DELETE/… requests. good for unit tests
Disadvantages: requires the app to use the solid-auth-cli fetch method. some setup is nice to have (if there is interest I can extract our setup logic into a separate package. It includes a TestFolderGenerator for creating and resetting folders)

Also, I’ve recently made a post here about solid-local-pod, which does pretty much the same thing as molid as far as I see. You can run parts of your filesystem as a localhost pod, supporting GET/DELETE/POST/…, but no authentication. So I’d be interested what the differences to molid would be. I guess starting it is slightly more complicated, though I don’t think that would be an obstacle to use it.


#3

Hi @A_A, thanks for sharing this, I wasn’t really aware of the alternatives, and so I cannot fully overlook the pros and cons here. But I am really glad that things are moving forward regarding those topics.

solid-local-pod really looks great! Molid is very similar to that in the current stage of development but the main focus is different and so I guess both will evolve differently. If I see it correctly solid-local-pod is mainly about serving the local file system as a solid pod. So you could even use it for your real data that you want to keep local and are not willing to put online.

Molid also reads data from the local file system, but it’s main focus is being a mock server for testing. The data from file system is only used to intialize the server state. Molid will support updates eventually, but will never change those files, just it’s internal state for the duration of a testing session. It is used to have a controlled and reproducable environment for manual and automated tests. Also the app under test can always do a real HTTP request and does not have to rely on file:// or app:// schema or any specific library to use.