Skip to content

incutonez/life-stats

Repository files navigation

Life Stats

Statistics interest me, and I've always wanted something that could keep track of overall life stats, so I decided to make a simple app where I can log that information.

Getting Started

  1. Clone repo
  2. cd repo
  3. npm i (this repo uses npm workspaces, so you only need to be in root dir)
  4. npm run api in a dedicated terminal
  5. npm run ui in a dedicated terminal
  6. Navigate to http://localhost:5173
  7. Potentially use the browserPlugin in your browser (for FireFox) and use the Copy Details context menu that shows on a job description on LinkedIn or Indeed

Database

It's good to note that SQLite is used for the database, and because SQLite does not allow usernames/passwords, I created encryption/decryption functionality for the DB. Basically, if you set the DATABASE_PATH to something other than the default, then when the app starts, we'll attempt to decrypt the file at that location.

The very first time you run this app, the encrypted file won't exist, unless you're clairvoyant or something. When it does exist, we'll decrypt and copy it over to src/db/data.db. When the server is stopped, we attempt to encrypt and save it back to DATABASE_PATH. This will be saved as a gzipped tar, encrypted with the DATABASE_PASSWORD that you set, and only that password can decrypt it.

UI Stack

API Stack

OpenAPI Generation

When the API starts, it generates the Swagger doc based on the endpoint markups. This Swagger doc gets thrown in the spec dir. The dist and generated dirs are created from running the openapi-generator-cli through Docker, so there's no need to download Java on your local machine... you just need Docker in order to run this. It knows to use Docker through this config file.

Current features

This all started because I didn't want to manage job applications in an Excel spreadhseet, so I decided to build my own UI, with accompanying API and DB. It's a fairly simple interface, but I also wanted to try out some framework agnostic libraries in a Vue 3 app.

  1. Job Applications
    1. Allows uploading CSV data
    2. Allows creating new applications
    3. Allows adding comments to applications
    4. Allows linking applications to others (for things like reposted roles)
  2. Exercises
    1. Allows uploading Strava CSV data
    2. Allows importing from Strava, but you will have to auth first
    3. Conversions between Metric and Imperial (given your browser's language setting)
  3. Auditing
    1. Each feature has a "History" tab that shows your actions that have taken place throughout that feature

Test Environment

The test environment was something I wanted to get up, so I could use it as part of my application portfolio, and I decided to use the following architecture:

  1. Cloudflare - for all my DNS concerns, using origin rule rewrites for the API and UI
  2. AWS
    1. EC2 - for hosting my docker containers, added swap memory due to 1 GB micro instance limit and vite being a pig when building
    2. Lambda - for running functions to start/stop the instance
    3. EventBridge - for crontab scheduling of Lambda to start/stop instance
  3. Let's Encrypt/certbot - for SSL certs
  4. DDClient - for updating the EC2 IP every time it starts, due to not having an Elastic IP
  5. Docker - for containerizing my API and UI code for easy deployments
  6. Google Analytics - for my analytics needs, had to customize vite build to only include in test build

About

Application for tracking life statistics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •