Hi, thank you for attempting our take-home test. We'd like you to build a mini currency conversion app. The application should provide currency conversion, signin functionality and protect against replay attacks, and include comprehensive functional tests.
- Set up a NestJS project with TypeScript.
- Implement the following API endpoints:
- POST /auth/login - User login (no signup required)
- GET /exchange-rates - Current exchange rates for supported currencies
- POST /convert - Perform a currency conversion
- GET /user/transactions - Retrieve user's conversion history ( Users can only convert when they login )
- You are permitted to integrate with an external API (e.g., Open Exchange Rates) to fetch exchange rate data.
- Use PostgreSQL for storing user data and transaction history.
- Implement measures to prevent replay attacks.
- Write functional tests for key functionalities.
- Implement proper error handling and validation.
- Create a rate-limiting middleware to prevent API abuse.
- Set up a React project using Create React App with TypeScript or Next.js.
- Implement the following pages/components:
- Login page
- Currency converter
- User dashboard displaying transaction history
- Use rtk query for state management and data fetching.
- Implement client-side form validation for all inputs using react-hook-form and yup/zod for forms
- Create reusable UI components for currency input and conversion display.
- Use Tailwind CSS for styling, ensuring a responsive design.
- Implement proper error handling and display user-friendly error messages.
- Implement protection against replay attacks in the authentication system. This could involve:
- Using nonces (number used once) with each request
- Implementing timestamped tokens with a short validity period
- Maintaining a server-side cache of recently used tokens
- Implement proper CORS settings to prevent unauthorized access to the API.
- Code quality, organization, and TypeScript usage
- Implementation of security measures, especially replay attack prevention
- Accuracy and efficiency of currency conversion functionality
- Quality of functional tests
- API design and implementation
- Frontend architecture and user experience
- Error handling and edge case management
- Create a private GitHub repository for your project.
- Include a README.md with:
- Setup instructions
- List of completed features and any known issues
- Commit your code regularly to show your progress.
- Once completed, share the link to your repository ( make it public )
We look forward to reviewing your solution, happy hacking!