Skip to content

johngrantdev/tasktime-server

Repository files navigation

Migrated into monorepo project

Tasktime Server

The tasktime backend service provides a REST API with validation, authentication and authorization for the tasktime app.

Some of the tech and packages used

The full list of packages used can be seen in the package.json file.

written in Typescript

Nest js - module based backend Node.js framework providing modules for express js, jest, jwt, class-validator, mailer, among others.

Passport with magic login - Passwordless authentication using magic links sent to users email address.

Handlebars - Templating lanugage to dynamicly generate static html/css. Used to send email sign-in links, notifications etc.

Maizzle - Framework for creating HTML/CSS packages using tailwindCSS. This is configured to generate handlebars templates

Mikro ORM - Postgres

Swagger - API Documentation

Database ERD (WIP)

The below link is the working design for the database schema.

Entity Relationship Diagram

First Prototype

I initially started building this using express js which can be viewed at the following branch of this repo.

Express branch

Running the server

Clone Repo

Requirements: Node.js and npm package manager installed.

create a .env file in the root directory of the project with the following parameters.

APP_NAME = 'tasktime server'
APP_DESCRIPTION = 'The tasktime backend service provides a REST API with validation, authentication and authorization for the tasktime app.'
SERVER_URL = http://localhost:3010
JWT_SECRET_KEY = generated_long_secret_key
DB_NAME = tasktimedev
DB_HOST = db_host_URL
DB_PORT = 5432
DB_USER = postgres
DB_PASS = dbpassword
SMTP_URL = smtp.mailprovider.com
SMTP_PORT = 587
SMTP_USER = [email protected]
SMTP_PASS = SMTPPassword
SMTP_FROM_ADDRESS = [email protected]

Use of of the following commands to run the server.

# dev mode watching for changes
$ npm run start:dev

# production mode
$ npm run start:prod

Docker

Follow these steps to create a docker image of this project.

The below command will compile the typescript sourcecode to javascript in the dist directory.

$ npm run build

The below command will create the docker image on the system.

$ docker build -t tasktime-server:dev-latest .

Docker-Compose

The below docker compose file uses enviroment variables. Place the .env file shown above in the same directory as this file.

version: "3.7"

services:
  tasktime-server-dev:
    image: tasktime-server:dev-latest
    container_name: tasktime-server-dev
    ports:
      - "3030:8080"
    environment:
      - APP_NAME=$APP_NAME
      - APP_DESCRIPTION=$APP_DESCRIPTION
      - SERVER_URL=$SERVER_URL
      - JWT_SECRET_KEY=$JWT_SECRET_KEY
      - DB_NAME=$DB_NAME
      - DB_HOST=$DB_HOST
      - DB_PORT=$DB_PORT
      - DB_USER=$DB_USER
      - DB_PASS=$DB_PASS
      - SMTP_URL=$SMTP_URL
      - SMTP_PORT=$SMTP_PORT
      - SMTP_USER=$SMTP_USER
      - SMTP_PASS=$SMTP_PASS
      - SMTP_FROM_ADDRESS=$SMTP_FROM_ADDRESS

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Use

There is no license on this project and so all copyright protections are reserved. Please contact me at [email protected] if you would like to use this project.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published