Objective

The objective of this assignment is to assess your Backend development skills, problem-solving abilities, and code quality. You will be creating a secure and scalable backend service built on Node.js and Express.js. Similar to a minimal version of AnswersAi, this service will take in user requests and handle questions. This is designed to be used with a frontend application - and while you do not need to build any frontend, please keep this in mind while designing this service.

This assignment has been designed to be doable within 4-5 hours. You will have 5 days from when you receive the email to submit this assignment. If you need more time, please email [email protected] to request an extension.

You do not need to complete 100% of task requirements. Please complete as much as you can within the 5-day timeline - we value speed over perfection.

Requirements

  1. Design a RESTful API using Node.js and Express.js with the following endpoints:

  2. Implement authentication and authorization using JWT tokens or similar for API security.

  3. Design and implement a database schema for questions and users.

    1. Ensure that this is scalable, and be prepared to explain your design choice (relation vs non-relational, ACID guarantees, etc).
    2. Keep in mind that this service will scale to hundreds of thousands of users who might use it concurrently.
    3. Optional: Use an ORM (such as Sequelize or Knex.js).
  4. Integrate with an AI service (e.g. OpenAI API) to generate answers. Use secure libraries/SDKs for API calls. We recommend langchain.

    1. Keep in mind that this service will scale to hundreds of thousands of users who might use it concurrently.
    2. Please document a solution (no need to code it) that ensures that users get timely responses even during periods of high load.
  5. Containerize the application using Docker. Provide a Dockerfile for easy deployment.

  6. Design a scalable infrastructure on AWS or GCP (EC2, RDS, ELB, ECS, Auto Scaling, etc.). Provide an architecture diagram or description.

    1. You do not need to deploy to the cloud. Simply provide an architecture diagram (using software like Lucidchart or on pen and paper), or a written description.
  7. Write unit tests for critical components (API endpoints, database interactions) using Jest, Mocha, or similar libraries.

  8. Provide a README with setup and running instructions, including dockerfile setup and running instructions, database setup, environment variables, and dependencies.

Evaluation Criteria

Your assignment will be evaluated based on the following criteria: