Octopus Energy Logo

Welcome to the Octopus Energy Frontend code test!

Visit the Product Page

Download Project Source Code

View README

README.md - Frontend Code Test - submission

James Bowler | james@bowler.family | www.kraken.bowler.family

Table of Contents

Hosting note

For the purposes of this coding test, this project is hosted at

A git repository is available for download as a zip file. It can be made available on github on request.

Quick start

This is a turborepo project using pnpm package manager.

Pre-requisits

Installing PNPM

Option 1 - Using NPM (recommended)

npm install -g pnpm

Option 2 - Using Corepack

corepack enable
corepack prepare pnpm@latest --activate

Local Setup

  1. Extract the zip file

  2. Install dependencies:

pnpm install
  1. Build all packages:
pnpm run build
  1. Run dev:
pnpm run dev

Additional commands

pnpm run test
pnpm run lint
pnpm run format:check

Project structure

apps/
├── kraken-client/          # Next.js frontend application
└── kraken-server/          # Backend server

packages/
├── eslint-config/          # Shared ESLint configurations
├── graphql-types/          # GraphQL type definitions and codegen
├── jest-config/            # Shared jest configurations
├── kraken-ui/              # Shared React component library
├── styles/                 # Shared styles and theme
└── typescript-config/      # Shared TypeScript configurations

Technologies

Frontend

Backend

Development Tools

Runtime

Rationale

I set out to demonstrate my ability to architect complex, scalable applications, designed to reduce code duplication and enforce consistency across multiple projects. The pattern I've choosen is based on experience, with code snippets and configuration taken from personal projects.

Given a self imposed time constraint, shortcuts have been made in the design and implementation; which would typically be addressed before using this in a production grade system.

I approached this task in a similar way as when setting up a new project for a new team, applying various assumptions and a significant time constraint.

Assumptions

Monorepo Architecture

This project uses a monorepo structure with Turborepo to efficiently manage multiple applications and shared packages.

Starting this structure on a small project allows the project to continuously scale, with all developers on the project familiar with the structure from day 1. This structure is worth considering in an environment using multiple front end and/or back end applications - e.g. a micro service architecture.

CSS Setup

For simplicity, I haven't implemented SCSS in this project.

I've choosen to use CSS modules, as opposed to a css framework like tailwind. CSS modules makes it easier to implement brand heavy, highly customised visuals. CSS being located alongside components makes it easier to locate relevant styling and scoped styles prevents naming conflicts.

Git Strategy

Github flow is used on this repository (https://docs.github.com/en/get-started/using-github/github-flow)

main branch represents production ready code. Branches should be prefixed with fix/, feature/, test/ or chore/ depending on the intent.