Task Description:
Create an application that allows users to manage a digital library of books. Users will be able to register, log in, manage their book collections, categorize them, track reading progress, and view reading activity reports. The application will include a RESTful API, a database schema, and a user interface.
Frontend Requirements:
- Set up a React project using TypeScript.
- Implement user authentication:
- Develop registration and login pages where users can authenticate using an email and password.
- Use JWT tokens to manage and secure endpoints.
- Develop a user interface with the following functionalities for authenticated users:
- Manage a personal library of books with details such as:
- Book ID: Unique identifier for each book.
- Title: The title of the book.
- Author: The author of the book.
- Category: Genre or category of the book (e.g., Fiction, Non-Fiction, Mystery).
- Status: Reading status (e.g., Not Started, In Progress, Completed).
- Rating: An optional value between 1 to 5.
- Add book details, as per the above.
- Update book details, including status and rating.
- Delete books from the library.
- Search for books by title, author or rating.
- Sort books by title, author, category, rating or reading status.
- Manage a personal library of books with details such as:
- Develop a report view to display reading activity, such as:
- Total books read during a time period.
- Most frequently read category during a time period.
- Total time spent reading during a time period.
- Support the following time periods
- 1w (1 week)
- 1m (1 month)
- 1y (1 year)
- Implement error handling and validation for all input fields and authentication processes.
Backend Requirements:
- Set up a Node.js project with Express.js and TypeScript.
- Implement authentication using JWT to secure the endpoints:
- POST /auth/register: Register new users with email and hashed password.
- POST /auth/login: Authenticate users and return an access token.
- Middleware to protect routes and verify user tokens.
- Implement the following RESTful API endpoints for authenticated users:
- GET /books: Retrieve a list of books in the user's library, optionally filtered by search query.
- POST /books: Add a new book to the user's library.
- PUT /books/:id: Update details of an existing book.
- DELETE /books/:id: Remove a book from the library.
- GET /reports/activity: Generate a report summarizing the user's reading activity.
- Use MySQL with TypeORM to create database schemas for storing user and book information.
- Implement validations to ensure data integrity, particularly for book details, reading status updates, and user authentication.
Database Requirements:
- Set up a MySQL database and configure a connection using TypeORM.
- Create tables for
Users
andBooks
with appropriate columns and data types:Users
table should store user credentials securely.Books
table should store book details, including reading status and associated user IDs.- Feel free to create more tables that meet the requirements
Acceptance Criteria:
- The React application securely handles user registration and authentication effectively.
- Library management functions are available only to authenticated users, involving adding, updating, and deleting books.
- Reports accurately reflect reading activity, including total books read, categories, and reading time.
- Proper database setup includes
Users
andBooks
tables with accurate, retrievable, and consistent data. - The frontend is responsive and user-friendly, supporting all specified operations efficiently.
- Code should be well-organized, readable, and conform to best practices in TypeScript and security standards.
Expectations:
- Emphasis will be placed on secure authentication, efficient book and category management, and accurate data reporting.
- If there are any gaps or assumptions needed within the task, developers are encouraged to make reasonable assumptions and document these assumptions clearly in their code or accompanying documentation.
- The developer should be able to explain their design and implementation decisions if asked.
Developers are encouraged to reach out for any clarifications during the task.