tracie-server
v0.0.3
Published
Events analytic made simple
Readme
Tracie Server
A minimal, self-hosted event tracking services, built with SQLite (Knex), using NodeJS.
- Setup
- Server APIs
- Create event: [POST] /tc
- Query data: [GET] /tc?{query}={value}
Setup
Asume you have clone or download the project to your machine. Once your server is running, the server should be accessable via //localhost:8080 or as configed.
You can run using pm2, or as a node application as below:
Run using PM2
PM2 is a node process manager. A ecosystem.config.js config file should be ready to use. You can also customize as you want. Once completed, start the pm2 process:
$ pm2 startRun as a Node application
- Setup enviroment variables by copy
.env.blankcontent to a new.envfile - Setup connection by run
yarn setupornpm run setup - Start server by run
yarn startornpm start
Server (APIs):
Server APIs are exposed through TRACIE_ENDPOINT path setup on the .env file.
Create an event:
[POST] /tcBody content must contains a name property
{
"name": "string"
}Query data
[GET] /tc?{query}={value}Available queries params:
| Name | Type and value | Definition |
| ---- | ---------- | --- |
| $name | string | event names, separate by a comma (.ie signup,hits) |
| $interval | month, week, day, hour, minute | group result by an interval unit |
| $intervalValue | number | period of $interval i.e 2 days, 3 weeks |
| $start | number, string | starting time in milliseconds or a valid JS date string |
| $end | number, string | ending time in milliseconds or a valid JS date string |
Query output
{
data: [{
name: string,
result: {
[date: string]: number
}
}]
}Where
name: event namedate: ISODate format stringdate's value: the frequency number
