Giter Club home page Giter Club logo

zumm's Introduction

Zumm Technical Exercise

This application is deployed at https://zumm.lgrv.net. To run it locally, simply clone this repo and run (sudo) docker compose up -d.

Background

This is a technical exercise produced for a company whose product is a niche dating app. It is built with Go 1.22 and the Echo framework.

This is the first Go project I have worked on, having come from a Python background, which was really interesting as it meant I had to strip all language and framework away in my brain and rely on fundamentals.

I used TDD throughout which really helped me encode the requirements, get the app off the ground quickly (originally with Gin and SQLite) and provide a safety net for refactoring, especially in conjunction with the Go debugger delve

Application

Framework

Initially I began with Gin as it seemed to be the simplest way to get the app going and satisfy the test I'd written for the canary endpoint. However, further down the line, after having already implemented JWT 'manually', I refactored to use Echo, mostly because it had JWT middleware built-in

Routes

This application offers the following HTTP endpoints:

  • / GET
    • Canary/healthcheck simply returning HTTP 200
  • /user/create GET
    • Create and return a random user profile
  • /login POST
    • Authenticate as a user, returns a JWT token
  • /discover GET
    • Get user profiles near you
    • Protected by JWT auth
  • /swipe POST
    • Register your verdict on another user
    • Protected by JWT auth

Database

Initially I began with SQLite, which I am a huge fan of, but when it came to dockerising and productionising the application I reached straight for Postgres, mostly because it's what I'm used to and I didn't want any surprises.

GORM seems to be the SQL Alchemy of the Go world and was an easy choice for the ORM.

Authentication

The production systems I've worked on in the past have all used AWS IAM for authentication. However, I have a good understanding of encryption and reading the requirements it seemed to me to require symmetrical encryption and decryption with a private secret. JWT is a ubiquitous implementation of symmetrical encryption, and the Echo framework has JWT middleware built in.

Conventions

The built-in Go formatter is great and hides a multitude of sins, but despite that I am absolutely certain this project contains unidiomatic and unconventional Go code.

However, as an example of my general attitude to conventions, I have used conventional commits throughout. I've also used a trunk development branch and squashed my commits when I merge a PR into the main branch.

Roadmap

So much of this application is unfinished with regards to normal engineering practice. By way of example, the JWT secret is stored in plain text, and so are the user passwords!

zumm's People

Contributors

elgrove avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.