The goal of this challenge is to create a browser application which receives, validates and displays data from a user.
Since it takes a while, we've prepared the application skeleton for you. It's not really a browser application, but we'll pretend that it is. ;)
In the provided skeleton, you should implement just two actions:
- Store action, which should validate and persist sample data in external service(s)
- Fetch action, which should retrieve data and ensure its integrity
Also, your solution must implement at least one of the following types of external services:
- Peer-to-peer service which hypothetically runs on user's hosts. Let’s call it "P2P" service. Networking and storage will be cheap for you - 0.0001$ per byte, but you can’t trust this service because a malicious user may spoof (modify) your data.
- Self-hosted service which runs on your server. Let’s call it "hosted" service. Networking and storage will be much more expensive for you - 0.001$ per byte, but the data is located on your server, so you can trust it.
For communication with your external service(s) we provide two functions which are wrappers around whatwg fetch. They help us to calculate incoming and outgoing traffic.
These functions are available for both the store and fetch application actions:
p2pFetch
- should be used to store / retrieve data for P2P serviceshostedFetch
- function to store / retrieve data for hosted services
- Clone this repository
- Implement as many external services as you need to store sample data from the application
- Implement the store action. Validate and persist sample data in the external service(s)
- Implement the fetch action. Fetch sample data back and ensure its integrity. When you fetch data back from the untrusted service, you should verify it for spoofing protection
- Write beautiful code. Code design (SOLID, Clean Architecture, 12factor) is important to us.
- Run application and see results. Try to spend as little money as possible. Cost depends on the size of request / response and elapsed time. You may find the exact formula in the application skeleton code
- Send us an archive with your solution
- Services should be written in JavaScript and run with Node.JS
- Services should be dockerized and started with docker compose in the root directory
- Data should be permanently persisted (i.e. available after a service restart)
- You should validate sample data in the store action. Throw error if data is not valid
- You should check data integrity in the fetch action to avoid spoofing. Keep in mind that you don't have access to the original input data which you received in the store action
- Make sure the data returned by the fetch action matches the input data from the store action
- You should use
p2pFetch
for sending / retrieving data from a P2P service - You should use
hostedFetch
for sending / retrieving data from a hosted service - You cannot store any data on the application side
Sample data represents a collection of various objects. Each type of object has its own validation rules.
id
- Format:
a-zA-Z0-9
- Length:
256
- Required
- Format:
type
- Value:
user
- Required
- Value:
userName
- Format:
a-zA-Z0-9_.
- Max length:
20
- Required
- Format:
firstName
- Max length:
100
- Max length:
lastName
- Max length:
100
- Max length:
email
- According to RFC
id
- Format:
a-zA-Z0-9
- Length:
256
- Required
- Format:
type
- Value:
payment
- Required
- Value:
fromUserId
- Format:
a-zA-Z0-9
- Length:
256
- Required
- Format:
toMerchantId
ortoUserId
- Format:
a-zA-Z0-9
- Length:
256
- Required
- Format:
amount
- Format: float number
- Not equal or less than
0
- Required
createdAt
- Format: Date ISO 8601
- Required
id
- Format:
a-zA-Z0-9
- Length:
256
- Required
- Format:
type
- Value:
merchant
- Required
- Value:
name
- Format:
a-zA-Z0-9
- Max length:
20
- Required
- Format:
Follow the challenge mission according to the provided requirements and do your best. Good luck!
Please email us engineering@deedmob.com your submission, which includes your name, code, and a short description of what technologies you used and why, and also how and what you would improve about your solution if you had more time :)
MIT © 2018 Dash Core Team