Developers, ask your questions here!

If you have any question about developing applications for Cozy, this category is for you!

Hello sir, I’m new in Cozy. I want to develop a cloud storage mobile app that have a basic features like upload, download, share, rename and delete. I’ve already read the Cozy documentation but I feel confused which developer documentation that exactly need to follow.

Could you guide me how to develop a mobile application for Cozy and tell me what is the first step I need to do before developing a mobile app. I’ve already read the article on how to create a mobile Cozy application but I don’t know where to setup index.html.


Hello @ainnazrah95,

We need to update and improve our developer documentation. Sorry for any inconvenience.

I’ll try to answer your questions:

  • to develop a web app or a mobile app for cozy, you need to be familiar with cozy-stack and the JavaScript client cozy-client that will let you interact with the cozy server (aka cozy-stack).
  • the cozy mobile documentation aims to drive the developer towards porting a webapp to a cordova app, so you need to be familiar with cordova development.
  • the difference between a cozy cordova app and a cozy web app is essentially on the way the token is retrieved: the mobile app needs a OAuth authentication (cozy has a built-in react components to perform such an authentication: when the web app doesn’t (because it is served by the cozy-stack with valid token and cookies).

Let us know if you have more questions and thanks for your interest.

1 Like

Thank you for your compact and easy to understand your explanations. I’ll come back to ask for another question if there’s a problem occurs when developing the cozy mobile app. Really gives me some inspire to start developing the mobile app :grinning:

Hello. Just to make sure I got it: cozy-client-js is a NodeJS library making REST calls to a Cosy Stack Instance (that can be a Cosy Stack Instance on your Cloud as well)?

Hello @prebours,

Welcome aboard :smile:

Yes it is!

Let us know how we could help you develop your first application for Cozy.

Thanks @Clochix. What would be useful is to get a simple example. For example, what would be tehe code to list all my documents stored on my Cozy Cloud using cozy-client-js (i.e. the url of the instance is Did I miss that in the documentation?

I agree there’s not much code examples inside the documentation. We should add some “How to”.

Here’s probably what you are looking for: I must admit I found it only because I know the underlying API.

Thanks @Clochix. I am currently looking at the cozy-stack-client (in the package dir of cozy-client). I am trying to run a simple nodejs commandline program to retrieve the list of the files on my cozy cloud. I just want to run node index.js and get the list displayed in the console.

This is what I have done so far:

lobal.window = new Object();
const cozy = require('cozy-stack-client');

const options = {
    clientID: '',
    clientName: 'TestClient',
    clientKind: 'web',
    clientSecret: 'test',
    clientURI: '',
    registrationAccessToken: '',
    redirectURI: 'http://localhost',
    softwareID: 'test',
    softwareVersion: '1.0',
    logoURI: '',
    policyURI: '',
    notificationPlatform: '',
    notificationDeviceToken: ''

const client = new cozy.OAuthClient(options)

// next?

A simple example would be awesome.

Hi @prebours !

First off, let’s distinguish between cozy-client-js and cozy-client. cozy-client-js is the legacy version, but right now it’s more stable and has more documentation. cozy-client-js is the replacement, but it’s mostly geared towards webapps.

In any case, there are 2 steps in what you want to do:

  1. Register your node.js client so it can have access to your cozy
  2. Query the data you want

Step 1 is actually the most annoying for an OAuth client. For cozy-client-js there’s a fairly complete example here. For cozy-client the relevant doc is here. You can also call client. register(url) instead of client.startOAuthFlow(openURL) and I think it will work in node too.

Once you have the token, you can go to phase 2. For cozy-client-js you might use statByPath.
For cozy-client, it will be something like client.query(client.find('io.cozy.todos')).then(console.log).

Hope this helps!

1 Like


I would like to query data from a view of couchDB using the cozy stack.

Could you help me to find information about the good way to do it? I do not find any point about it in the documentation.


Hello @yvallet,

Welcome aboard :smile:

Are you planning to develop a JavaScript application, using our JS client libraries, or other technologies?

Yes actually we are planning to develop a react application. This is a project for the Metropole (Grand Lyon).

I guess this documentation may be useful:

Is this what you’re looking for?

Thanks you, I will look at it.

If you’re from a react app distributed by the stack, you’d better to use the javascript cozy-client lib. If you created your app with create-cozy-app, you already have an instance of cozy-client initialized in your React tree.

You will find an introduction on how to use it in the documentation. The where clause do accept a couchdb mango selector if you need to, but simple selectors are usually enough.

You should not have to manually query the stack. If you really need to, you will also find a client.getStackClient().fetchJSON() method.

We were on a wrong way, we were thinking about using views. This link was helpful:

According to all your links we will use mango selector via the cozy-client

Thanks again