Important Links
Important: How to submit your solution
- [ ] Edit
By: <Name> from <Company> at the top of the README.md with your own details so I can match your submissions to your application/CV
- [ ] Create sensible Git commits
- [ ] Push your solution to a new private repository on GitHub
- [ ] Invite me to your repository so I can review the work: https://github.com/maximilianschmitt
Timeframe
Please complete the coding challenge within 7 days of receiving it. If you need more time, please let me know.
About the challenge
The coding challenge is an imaginary backend for a tipping feature. Users buy a virtual currency called tokens. Users sends tokens to other users as tips. Received tokens can be paid out to the recipient’s bank account.
Notes & tips
- You will need to maintain two separate balances per user:
tokensReceived: Tokens received via tips
- These can be paid out
- These cannot be sent to other users
tokensPurchased: Tokens purchased with real money
- These cannot be paid out
- These can be sent to other users
- Check
src/routes/get-user.test.ts and src/routes/get-user.ts for a sample implementation, demonstrating:
- Authentication
- Using custom errors for consistent error responses
- Using
src/testing/testData.ts to add test data for tests
- You will need to modify the database schema. You can do this by editing
src/schema.sql
- Implement proper input validation for things like query parameters and request bodies (where applicable). You’re free to use a library like
zod or joi for this
- Make sure your SQL is safe against SQL injections and inconsistent database state
- Integration with a payment processor or third-party API is not required
- You can authenticate as a user by setting the
Authorization: <UserId> header. This is not a production-safe setup but should make it easy to write tests etc.