Creating a Loklak App!

Hello everyone!

Today I will be shifting from course a bit. I will talk about how you can use Loklak API, create an app and show it off by deploying it on loklak.org .

Lets dive in!

Selection_039

This is how the loklak apps page looks like. If you want your creation to end up here, follow some simple steps.

Firstly clone loklak_server github repo.

git clone https://github.com/loklak/loklak_server.git

Deploy loklak server on localhost and you’ve got your “dev env” ready!

The next thing you need is an idea for an app which will use loklak API. When you have it, create a subdirectory under your loklak_server/html/apps/ folder and name your app. Now you start coding!! For easy quick-start, you can look at the boilerplate.

If you are planning to add some styles and scripts to your app, these must either be already present in loklak or you might have to add them explicitly. e.g. look at this app and notice the css and js folders which contain the custom scripts being used in the app.

Selection_041

index.html is the landing page for your app. The app.json file you create must have an json-Id format. You can use the json-Id file from an existing app for reference.

When you are sure about which Loklak API functions you want to use in your app, modify the "permissions" field in app.json to a comma-separated list of all api paths, that the app calls. This is used to apply authorization markers to the app, so it becomes visible if the app is actually usable for the user. e.g. look at this. Since this app just uses the search API to get the tweet feed. The permissions a user requires to use this app is    "/api/search.json" .

Selection_040
Social-Wall

Once you are done with coding your app, test it thoroughly on your local installation. See if your app appears under http://localhost:9000/api/apps.json in the app list. Test that your app is not browser specific and make sure to add a backlink to /apps/ to make it easier for user to browse to other apps from yours.

Since now you are sure that your app is “Loklak ready” all you have to do is send a pull request to https://github.com/loklak/loklak_server. Make sure that all your files are contained into one commit.

When your app gets merged, you would be able to see it here.

Thats all folks. For more info refer to the full documentation here.
Happy Coding!!!

Creating a Loklak App!