First Go project. Backend hiring test for Array engineering.

BACKEND TEST 1

Submitted by: Mitchell Sullivan

Intro

This is basically my first-ever project in Go. As such, it's quite simple and bears little resemblance to the hulking behemoth I'd have wrought in .NET. But, hey, isn't that the whole point of Go?

Because I'm a novice in this language, there are some sacrifices, but I thought that the trade-off of using Array's technology was worth it. This project lacks demonstrations of more advanced practices with which I am familiar in other languages, like dependency injection and exhaustive unit testing. Proper commenting and git commits fell by the wayside while I focused on learning, as did a certain degree of polish.

Directions

To run the app, just make sure that port 8099 is free on your machine, or change HOST_PORT in the .env file, and run docker-compose up.

A Postman collection is included in docs, as well an OpenApi 3.0 spec.

In Postman, after signing up, logging in, or refreshing, the token will need be retrieved from the response body and set as the Bearer token with the Authorization header.

Design

Login is facilitated via a JWT that expires in 1 hour. For the sake of a minimum viable product, I have NOT implemented a separate refresh token with a longer expiry time; the unexpired JWT will need to be used in a refresh request within the hour in order to obtain a new one, and the old one will be revoked.

Logout and token revocation are facilitated via a blacklist, stored in Redis, with a time-to-live of 1 hour, since the JWT would become invalid after that time, anyway.

I gave Redis a replica, probably out of insecurity over my experience level with Go and the desire to show off more skills. I had originally set up and was developing for a cluster, but even the Redis docs state that clustering is a clunky experience within Docker containers, so I chose something simpler.

The Gin web framework was chosen due to its popularity and the preponderance of examples which use it.

PostgreSQL is the database instead of MS SQL Server due to MSSQL's lack of initialization options when using docker (setup scripts basically require building a new container), and Postgres supports automatic database creation and an init directory for scripts.

The app uses GORM, an ORM, for data access; there is code for automatic migration to create the relevant table(s), but, since this exercise requires the inclusion of such DDL, the script is located at docker-vols/pg_init/setup.sql and is run on database startup, preventing the migration. For the primary key of Users, I've used a ULID (generated in-app), instead of a UUID vX, for improved indexing and because it seemed more appropriate for use as a JWT claim than a serial integer.

Thank you!

I'm on a rather arduous leg of my career-journey, so I would greatly appreciate any feedback or tips. Since my experience has been rather broad, I'd be willing to "start over" as a junior engineer in order to focus my skillset.

All the best,
MS

Similar Resources

A simple project (which is visitor counter) on kubernetesA simple project (which is visitor counter) on kubernetes

k8s playground This project aims to deploy a simple project (which is visitor counter) on kubernetes. Deploy steps kubectl apply -f secret.yaml kubect

Dec 16, 2022

this Project is base project about restfull API and MySQL

Requirements. This project only supports to run on Ubuntu currently go version = 1.16 docker docker-compose Install Protobuffer https://github.com/pr

Dec 10, 2021

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.

Grafana Tempo is an open source, easy-to-use and high-scale distributed tracing backend. Tempo is cost-efficient, requiring only object storage to ope

Jan 8, 2023

StaticBackend is a simple backend server API handling user mgmt, database, storage and real-time component

StaticBackend is a simple backend server API handling user mgmt, database, storage and real-time component

StaticBackend is a simple backend that handles user management, database, file storage, forms, and real-time experiences via channel/topic-based communication for web and mobile applications.

Jan 7, 2023

A Grafana backend plugin for automatic synchronization of dashboard between multiple Grafana instances.

Grafana Dashboard Synchronization Backend Plugin A Grafana backend plugin for automatic synchronization of dashboard between multiple Grafana instance

Dec 23, 2022

The tool for manage gitlab terraform backend

The tool for backup and restore gitlab terraform states Build how to: git clone https://github.com/CRASH-Tech/gitlab-terraform-manager.git cd gitlab-t

Oct 3, 2021

Experimentation for backend on GCP's App Engine

gcp-app-engine-go Experimentation for backend on GCP's App Engine Archived. App Engine project with multiples services and CI/CD setup: default (hello

Jan 15, 2022

Grafana DB2 Data Source Backend Plugin

Grafana DB2 Data Source Backend Plugin This template is a starting point for building Grafana Data Source Backend Plugins What is Grafana Data Source

Dec 13, 2021

Amazeful web backend server for golang

Amazeful-Backend The all new Amazeful-Backend written in GoLang using Chi. To re

Jan 10, 2022
Go-backend-test - Creating backend stuff & openid connect authentication stuff in golang

Go Backend Coding Practice This is my practice repo to learn about creating back

Feb 5, 2022
A best practices Go source project with unit-test and integration test, also use skaffold & helm to automate CI & CD at local to optimize development cycle

Dependencies Docker Go 1.17 MySQL 8.0.25 Bootstrap Run chmod +x start.sh if start.sh script does not have privileged to run Run ./start.sh --bootstrap

Apr 4, 2022
Litmus helps Kubernetes SREs and developers practice chaos engineering in a Kubernetes native way.
Litmus helps Kubernetes SREs and developers practice chaos engineering in a Kubernetes native way.

Litmus Cloud-Native Chaos Engineering Read this in other languages. ???? ???? ???? ???? Overview Litmus is a toolset to do cloud-native chaos engineer

Jan 1, 2023
Taina backend Backend service With Golang

taina-backend Backend service Getting Started Essential steps to get your backend service deployed A helloworld example has been shipped with the temp

Nov 17, 2021
Acropolis Backend is the Go backend for Acropolis - the central management system for Full Stack at Brown
Acropolis Backend is the Go backend for Acropolis - the central management system for Full Stack at Brown

Acropolis Backend Acropolis Backend is the Go backend for Acropolis — the centra

Dec 25, 2021
Oct 7, 2022
Planet Scale Robotics - Offload computation-heavy robotic operations to GPU powered world's first cloud-native robotics platform.

robolaunch ?? Planet Scale Robotics - Offload computation-heavy robotic operations to GPU powered world's first cloud-native robotics platform. robola

Jan 1, 2023
Backend Project using Go with Dgraph Database and Chi as HTTP Service

Drawflow-Requests For init DGraph Database docker run --rm -it -p 8080:8080 -v ~/dgraph:/dgraph dgraph/standalone:v20.03.0 docker run --rm -it -p 8080

Dec 11, 2021
Navmux - Test project evaluate writing the equivalent of boat repro using go

navmux Test project evaluate writing the equivalent of boat repro using go. The

Jan 10, 2022
Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

The Moby Project Moby is an open-source project created by Docker to enable and accelerate software containerization. It provides a "Lego set" of tool

Jan 8, 2023