Skip to content

Commit

Permalink
Foodsy assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Download committed Dec 2, 2021
0 parents commit e5be49d
Show file tree
Hide file tree
Showing 33 changed files with 15,538 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/typescript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
ARG VARIANT="16-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node packages
# RUN su node -c "npm install -g <your-package-list -here>"
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/typescript-node
{
"name": "Node.js & TypeScript",
"runArgs": ["--init"],
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"args": {
"VARIANT": "14"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"prisma.prisma"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.next
dist
node_modules
tsconfig.tsbuildinfo
dev.db
dev.db-journal
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Assignment

<div align="center">
<a href="https://foodsy.eu/">
<img
src="https://uploads-ssl.webflow.com/5953bc2faaef8c203fb570b7/5bd22f5c166db1a4287b55c9_foodsy%20-%20logo%20-%20red.svg"
height="125"
alt="Foodsy logo"
/>
</a>
<h1>Foodsy</h1>
<h4>Foodsy assignment.</h4>
</div>

## Intro

To determine whether you’re the person for the job, we’d like you to do this exercise. The goal is to get a sense of your capabilities and thought processes.

The assignment is split into 2 parts:
* Preparation
* Live coding session

### Preparation

This repository helps you with the preparation. Please clone this repository and then follow this README to setup a local development environment. Make sure you install the prerequisites and the project dependencies to get the projects to run correctly on your machine. When you can view the website in your browser, your preparation is completed.

### Live coding session

When it's time for the live coding session, we will share the requirements of a new feature we expect you to build and you will build it live with us watching. We have sized the assignment so it is possible to finish it within the duration of the session, but this is not our main priority. We are looking for GOOD progammers more than we are looking for FAST programmers. So take your time.

## Information

We have an existing monorepo using npm workspaces with 3 packages:

**client**: Next.js application which only utilises the framework's client side features, it's using Chakra UI for the styling.

**common**: General package for sharing functions between the client and server.

**server**: Node.js web application built with Fastify, Prisma ORM and a SQLite database.

## Prerequisites

- Node.js v14+.
- NPM v8.1.1+.

It's recommended to use [Visual Studio Code](https://code.visualstudio.com/) as the text editor for this assignment since it has first class support for TypeScript.

### Getting started

Run `npm install` in the root of the project, if everything went well, node modules should be hoisted to the root `node_modules` folder.

```bash
~/assignment
> npm i -g npm # Double check to make sure the right version is installed
> npm install --legacy-peer-deps
```

### Scripts

Generate the Prisma client

```bash
~/assignment/packages/server
> npx prisma generate
```

Apply migrations

```bash
~/assignment/packages/server
> npx prisma migrate dev
```

Seed the database

```bash
~/assignment/packages/server
> npx prisma db seed
```

Initialise the ORM

```bash
~/assignment/packages/server
> npx prisma generate
```

Start the webserver

```bash
~/assignment/packages/server
> npm start
```

View the database in the browser

```bash
~/assignment/packages/server
> npx prisma studio
```

Start the website

```bash
~/assignment/packages/client
> npm run dev
```

### Resources

- [TypeScript](https://www.typescriptlang.org/) - TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
- [Fastify](https://www.fastify.io/) - Fast and low overhead web framework, for Node.js
- [Next.js](https://nextjs.org/) - The React Framework
for Production
- [Prisma](https://www.prisma.io/) - Next-generation Node.js and TypeScript ORM
- [Chakra UI](https://chakra-ui.com/) - Create accessible React apps with speed
Loading

0 comments on commit e5be49d

Please sign in to comment.