These steps describe common crates and tools in Rust ecosystem required for web backend development.
❗️Before completing this step you should complete all its sub-steps.
After doing them you should be able to answer the following questions:
- How should I interact with databases in Rust application and why? How can I organize migrations for my project?
- What should I use for HTTP server implementation in Rust, when and why? What about WebSocket connections?
- What are options for making HTTP request (including WebSocket ones)?
- What is RPC? Name several the most adopted technologies, their advantages and disadvantages, explain which one could be used under which circumstances, and what and where is their best fit?
Estimated time: 3 days
Write a simple GraphQL API server with the following data model:
User
hasid
(unique),name
(unique) andfriends
(list of otherUser
s) fields.User
is able to authenticate with itspassword
.
API requirements:
- Ability to register users.
- Ability to authenticate users.
- Ability to retrieve a single user and all its friends (with their friends) (should require authorization).
- Ability to add some user to friends list and remove from there (should require authorization).
Web frameworks, tools and database choices are up to you. Keep things simple to fit into the dedicated time.
If you have enough time after implementing base requirements, consider to add the following to your solution:
- Provide migrations for database schema (if possible).
- Add comprehensive documentation to your code and API, and generate it in HTML form.
- Cover your implementation with unit and E2E tests.
- Implement GraphQL query depth limiting.
- Use dataloading to optimize interaction with database in GraphQL resolvers.