Skip to content

Commit c4164de

Browse files
ios & backend challenges update (#3)
1 parent d5e2314 commit c4164de

File tree

8 files changed

+132
-31
lines changed

8 files changed

+132
-31
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ on:
1111
- "**.md"
1212

1313
env:
14-
GO_VERSION: "1.21.3" # https://go.dev/dl/
15-
GOLANGCI_LINT_VERSION: "v1.55.1" # https://github.com/golangci/golangci-lint/releases
14+
GO_VERSION: "1.21.4" # https://go.dev/dl/
15+
GOLANGCI_LINT_VERSION: "v1.55.2" # https://github.com/golangci/golangci-lint/releases
1616

1717
jobs:
1818
lint:
@@ -29,6 +29,14 @@ jobs:
2929
skip-cache: true
3030
working-directory: ./ios/server
3131

32+
security:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: golang/govulncheck-action@v1
36+
with:
37+
go-version-input: ${{ env.GO_VERSION }}
38+
work-dir: ./ios/server
39+
3240
build:
3341
runs-on: ubuntu-latest
3442
steps:

backend/readme.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Backend Challenge
2+
3+
This challenge is part of the backend hiring process at [Heart
4+
Hands](https://hearthands.tech/).
5+
6+
## Why this challenge?
7+
8+
Heart Hands is operating with a small team of dedicated & talented people. We
9+
are looking for seasoned engineers with a deep technical knowledge, strong
10+
understanding of their technical stack, and excellent product intuitions to join
11+
our team.
12+
13+
This exercise has been designed to give a glimpse of what it is like to build a
14+
messaging app, and the kind of technical challenges we face and care about. We
15+
are expecting you to spend between 4 and 6 hours on this challenge.
16+
17+
## Instructions
18+
19+
You are tasked with the server-side implementation of a messaging app that
20+
allows clients to send and receive text messages in private 1:1 chats.
21+
22+
We enforce no technical constraints: you are free to choose the language, data
23+
layer, network protocol, and design your API as you see fit. You are
24+
purposefully being given a lot of freedom here, and you will not be judged on
25+
these decisions alone, but we will challenge the understanding of the trade-offs
26+
you make.
27+
28+
Functional requirements:
29+
30+
- [ ] Clients should be able to uniquely identify themselves with a phone number
31+
(without authentication)
32+
- [ ] Clients should be able to send messages to other clients via their phone
33+
numbers
34+
- [ ] Clients should be able to list their chats
35+
- [ ] Clients should be able to list all messages in a chat
36+
37+
## Bonus
38+
39+
Some topics that we find interesting to dig:
40+
41+
- [ ] Choose a network protocol that enables soft real-time message delivery to the clients
42+
- [ ] Make the server message ingestion idempotent
43+
- [ ] Add support for sent/delivered/read message status
44+
- [ ] Add support for chats and messages pagination
45+
- [ ] Implement SMS phone number verification to authenticate the clients
46+
- [ ] Support SMS forwarding to relay the messages to the clients phone numbers
47+
48+
## Challenge Review
49+
50+
We know you only have a limited time alloted to deliver this challenge, and thus
51+
will have to prioritize what you work on. A few things that are important for us
52+
and that will be considered during the review:
53+
- **documentation**: is the readme clear? are important parts of the code
54+
documented?
55+
- **impact**: which features did you prioritize?
56+
- **maintainability**: is the code well-structured and easy to read/evolve?
57+
- **robustness**: is the code tested or easily testable? are edge-cases
58+
considered? is static analysis leveraged?
59+
60+
***
61+
62+
Good luck, and enjoy!

ios/readme.md

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,41 @@ Hands](https://hearthands.tech/).
55

66
## Why this challenge?
77

8-
Heart Hands is operating with a small team of dedicated and talented people. We
8+
Heart Hands is operating with a small team of dedicated & talented people. We
99
are looking for seasoned engineers with a deep technical knowledge, strong
10-
understanding of their technical stack, and good product intuitions to join our
11-
team.
10+
understanding of their technical stack, and excellent product intuitions to join
11+
our team.
1212

13-
This challenge has been designed to give a glimpse of what it is like to build a
13+
This exercise has been designed to give a glimpse of what it is like to build a
1414
messaging app, and the kind of technical challenges we face and care about. We
15-
are expecting you to spend no more than 48 hours on this.
15+
are expecting you to spend between 4 and 6 hours on this challenge.
1616

17-
## Summary
17+
## Instructions
1818

19-
You are tasked to develop a messaging app that allows to send and receive
20-
messages with several bots, each in their own chat.
19+
You are tasked with the implementation of an iOS messaging app that allows to
20+
communicate (send and receive text messages) with bots, each in their own 1:1
21+
chat.
2122

22-
A server is available for you to use, you can read more about it in
23-
[`./server`](./server). The documentation contains informations on how it can be
24-
run and what kinds of API endpoints are available.
23+
A server is available for you to use. You can read more about it in
24+
[`./server`](./server). Its documentation contains informations on how it can be
25+
run, and what kinds of API endpoints & entities are available.
2526

26-
## Requirements
27-
28-
What are we expecting you to build?
27+
Functional requirements:
2928

3029
- [ ] The app should start on a screen showing the list of all chats
3130
- [ ] The app should allow opening each chat individually
3231
- [ ] The app should allow sending messages to a chat
3332
- [ ] The app should reflect the messages sent to and received from the server
33+
- [ ] The app should be resilient to bad network conditions (drops & timeouts)
3434

3535
## Bonus
3636

37-
What could be implemented to improve the UX?
37+
Some topics that we find interesting to dig:
3838

3939
- [ ] Make the app work offline (both for app state and sending)
40-
- [ ] Make the app resilient to bad network conditions (retries & timeouts)
4140
- [ ] Make the app idempotent in regards to what you send and receive
4241
- [ ] Integrate a splashscreen to hide chats while the app is loading
43-
- [ ] Add support for optimisic sending to give instantaneity in the UI
42+
- [ ] Add support for optimistic sending to give instantaneity in the UI
4443
- [ ] Add support for a local read/unread indicator
4544
- [ ] Avoid block changing states so the app feels fluid & snappy
4645
- [ ] Make the app compatible to run on iPad and macOS
@@ -49,8 +48,23 @@ What could be implemented to improve the UX?
4948

5049
## Design
5150

52-
We have prepared a design to help you during this challenge.
51+
We have prepared a design to help you during this challenge. You will also
52+
receive the Figma link along with the challenge instructions.
5353

5454
![design](./design.png)
5555

56+
## Challenge Review
57+
58+
We know you only have a limited time alloted to deliver this challenge, and thus
59+
will have to prioritize what you work on. A few things that are important for us
60+
and that will be considered during the review:
61+
- **documentation**: is the readme clear? are important parts of the code
62+
documented?
63+
- **impact**: which features did you prioritize?
64+
- **maintainability**: is the code well-structured and easy to read/evolve?
65+
- **robustness**: is the code tested or easily testable? are edge-cases
66+
considered? is static analysis leveraged?
67+
68+
***
69+
5670
Good luck, and enjoy!

ios/server/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module github.com/hearthands/challenges/ios/server
22

3-
go 1.21.3
3+
go 1.21.4
44

55
require (
66
github.com/go-chi/chi/v5 v5.0.10
77
github.com/go-chi/render v1.0.3
88
github.com/r3labs/sse/v2 v2.10.0
9-
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
9+
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
1010
)
1111

1212
require (
1313
github.com/ajg/form v1.5.1 // indirect
14-
golang.org/x/net v0.0.0-20191116160921-f9c825593386 // indirect
14+
golang.org/x/net v0.18.0 // indirect
1515
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
1616
)

ios/server/go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
1616
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
1717
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
1818
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
19+
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
20+
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
1921
golang.org/x/net v0.0.0-20191116160921-f9c825593386 h1:ktbWvQrW08Txdxno1PiDpSxPXG6ndGsfnJjRRtkM0LQ=
2022
golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
23+
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
24+
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
2125
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
2226
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
2327
gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y=

ios/server/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
)
2222

2323
var (
24-
hostname = envOrDefault("HOSTNAME", "localhost") // hostname used by the server
25-
port = envOrDefault("PORT", "3000") // port used by the server
26-
limit = 100 // maximum number of entities returned in a single request
24+
hostname = envOrDefault("HTTP_HOST", "localhost") // hostname used by the server
25+
port = envOrDefault("PORT", "3000") // port used by the server
26+
limit = 100 // maximum number of entities returned in a single request
2727
)
2828

2929
//go:embed data.json

ios/server/readme.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
# iOS Challenge - Server Companion
22

33
This server is used as a companion for the iOS challenge. Persistence is
4-
in-memory, restarting the server will reset its state.
4+
in-memory, and restarting the server will reset its state.
55

66
The server will sometime be a bit capricious, you might observe:
77
- failure to receive a response
8-
- server timing out when trying to send a message
8+
- timeouts when trying to send a message
99
- duplicate events being received in the messages stream
1010

1111
When that happens, you should retry and react accordingly.
1212

1313
## How to start the server?
1414

1515
1. You need to install Go on your system: follow the [official documentation](https://go.dev/doc/install)
16-
2. Then execute the command: `go run .`
16+
2. Then, execute the command: `go run .`
17+
18+
## How to make the server reachable from another machine?
19+
20+
You might want to allow the server to be reached from another machine
21+
(simulator or a phone for example). One way to do that is to use [ngrok]().
22+
23+
1. You need to install Ngrok on your system: follow the [official
24+
documentation](https://ngrok.com/download)
25+
2. Then, after having started the server (see above), execute the command: `ngrok http 3000`
26+
27+
This will give you a public URL of the form
28+
`https://9f98-62-194-145-77.ngrok.io`, that can be used to reach your server
29+
from any system that has an internet connection.
1730

1831
## API Documentation
1932

20-
This API exposes a few HTTP endpoints, and an SSE stream. It allows to list
33+
This API exposes a few HTTP endpoints and an SSE stream. It allows to list
2134
chats, and read & write messages.
2235

2336
### Notes

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Challenges [![ci status](https://github.com/hearthandsinc/challenges/actions/workflows/ci.yml/badge.svg)](https://github.com/hearthandsinc/challenges/actions/workflows/ci.yml)
22

33
This repository contains the [Heart Hands](https://hearthands.tech/) engineering
4-
challenges for [iOS](./ios) and _backend (soon)_.
4+
challenges for [iOS](./ios) and [backend](./backend) positions.
55

66
## Feedbacks
77

0 commit comments

Comments
 (0)