tracie-server

0.0.3 • Public • Published

Tracie

Tracie Server

A minimal, self-hosted event tracking services, built with SQLite (Knex), using NodeJS.

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 start

Run as a Node application

  1. Setup enviroment variables by copy .env.blank content to a new .env file
  2. Setup connection by run yarn setup or npm run setup
  3. Start server by run yarn start or npm start

Server (APIs):

Server APIs are exposed through TRACIE_ENDPOINT path setup on the .env file.

Create an event:

[POST] /tc

Body 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 name
  • date: ISODate format string
  • date's value: the frequency number

Readme

Keywords

Package Sidebar

Install

npm i tracie-server

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

4.22 MB

Total Files

70

Last publish

Collaborators

  • hieunc