You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-28Lines changed: 44 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,48 +1,59 @@
1
1
# Herow SDK Backend
2
2
3
-
[HSB is the SDK backside API](https://github.com/herowio/herow-sdk-backend) helping us to save the world.
3
+
## Table of contents
4
4
5
-
It includes several api interacting with [SDK iOS](https://github.com/herowio/herow-sdk-ios) and [SDK Android](https://github.com/herowio/herow-sdk-android).
5
+
*[General info](#general-info)
6
+
*[Technologies](#technologies)
7
+
*[Setup](#setup)
6
8
7
-

9
+
## General info
8
10
9
-
## How to test it?
11
+
[This project is the HEROW's SDK backside API](https://github.com/herowio/herow-sdk-backend).
10
12
11
-
`node` is also needed, we use `v15.14.0` but should work with lower version.
13
+
It includes API needed to interact with [SDK iOS](https://github.com/herowio/herow-sdk-ios) and [SDK Android](https://github.com/herowio/herow-sdk-android).
14
+
15
+
You can deploy it on AppEngine, Heroku, Kubernetes or on premise.
16
+
17
+
## Technologies
18
+
19
+
Project is created with:
20
+
21
+
- Node _(v15.14.0 - but should work with lower version)_
`docker-compose` sets up a Redis and a Kafka instances.
27
-
28
-
Under macOS, edit `docker-compose.yml` and update `KAFKA_ADVERTISED_HOST_NAME` by setting your local IP. _(localhost should work under Linux)_
38
+
Deploy Redis and Kafka via docker
29
39
30
40
```
31
-
$> docker-compose up
32
-
$> docker-compose -f docker-compose.yml.arm64 up # for Apple M1
41
+
$> docker-compose up # for x86
42
+
$> docker-compose -f docker-compose.yml.arm64 up # for M1
33
43
```
34
44
35
-
and…
45
+
After that, install dependencies and run it
36
46
37
47
```
48
+
$> npm install
38
49
$> npm start
39
50
```
40
51
41
-
# Redis interactions
52
+
##Redis interactions
42
53
43
-
We massively use Redis as database. You have to set a `REDIS_URL` env var to interact with. _(the default value is: redis://127.0.0.1)_
54
+
We massively use Redis as database. You have to set a `REDIS_URL` env var to interact with. _(default value: redis://127.0.0.1)_
44
55
45
-
##identity key
56
+
### Identity key
46
57
47
58
This key allows to match an SDK instance to a `client`. You can create any client as needed. **You should create a dedicated key for SDK Android and SDK iOS by client and by version**. By this way, you could "stop" easily a specific sdk for a given client.
48
59
@@ -57,8 +68,11 @@ We need 4+1 informations :
57
68
| username | a dedicated account allowing to use the app | appdemo |
58
69
| password | a dedicated password | rtFGHG6$ |
59
70
71
+
60
72
The 5th element is a salt used to hash those informations:
Every time an SDK generates a token, it is stored with key `token:<token>` and associated with `client`'s identifier (see above). This key is storing during `TOKEN_EXPIRATION` env var _(default is set to 10800 seconds -> 3 hours)_.
96
+
After successful authentification, `token`is stored by using key `token:<token>` and associated with the `client`'s identifier _(see above)_. This key is storing during `TOKEN_EXPIRATION` env var _(default is set to 10800 seconds -> 3 hours)_.
83
97
84
-
## device key
98
+
## Device key
85
99
86
100
The SDK configuration _(IDFA, customId, optin)_ is stored on key `device:<deviceId>` during `USER_INFO_EXPIRATION` env var _(default is set to 2592000 seconds -> 30 days)_.
87
101
102
+
SDK updates those information every day. Meaning that a quiet user is forgotten after 30 days, to prevent privacy.
103
+
88
104
## last-modified-cache key
89
105
90
106
The SDK regularly pulls its configuration.
91
-
When cache seems oudated, we can use the key `last-modified-cache:<client>` to order a cache refresh.
107
+
When cache seems outdated, we use the key `last-modified-cache:<client>` to order a cache refresh.
92
108
93
109
`last-modified-cache:<client>` contains timestamp in milliseconds of the last cache update. SDK will decide if it have to refresh it.
94
110
95
-
## campaigns key
111
+
## Campaigns key
96
112
97
113
`campaigns:<client>` contains an array of campaigns associated to a given client. If this key is modified, we also should upgrade `last-modified-cache:<client>`.
98
114
99
-
## zones key
115
+
## Zones key
100
116
101
-
`zones:<client>:<geohash>` contains an array of "zones" dedicated to a client and to a specific area. [Geohash](https://fr.wikipedia.org/wiki/Geohash) is a 4 digits geocoding code used to parcel the world on 20kmx20km squares. If this key is modified, we also should upgrade `last-modified-cache:<client>`.
117
+
`zones:<client>:<geohash>` contains an array of "zones" dedicated to a client and to a specific area. [Geohash](https://fr.wikipedia.org/wiki/Geohash) is a 4 digits geocoding code used to parcel the world on 20x20 km squares. If this key is modified, we also should upgrade `last-modified-cache:<client>`.
102
118
103
-
## pois key
119
+
## Pois key
104
120
105
121
`pois:<geohash>` contains a array of "pois" for a given area. Content is shared with every client.
106
122
@@ -505,4 +521,4 @@ Sent when a notification is opened _(click on it)_.
0 commit comments