{"id":18637508,"url":"https://github.com/ahmed-dinar/digital-library","last_synced_at":"2026-04-14T19:33:32.616Z","repository":{"id":220817803,"uuid":"752383876","full_name":"ahmed-dinar/digital-library","owner":"ahmed-dinar","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-11T16:09:29.000Z","size":5223,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-17T13:52:40.645Z","etag":null,"topics":["ant-design","docker","nestjs","nextjs","postgresql","prisma-orm","tailwindcss"],"latest_commit_sha":null,"homepage":"https://lib.dinar.sh","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahmed-dinar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-03T19:15:21.000Z","updated_at":"2024-02-12T00:17:47.000Z","dependencies_parsed_at":"2024-11-07T05:48:57.010Z","dependency_job_id":null,"html_url":"https://github.com/ahmed-dinar/digital-library","commit_stats":null,"previous_names":["ahmed-dinar/digital-library"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ahmed-dinar/digital-library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmed-dinar%2Fdigital-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmed-dinar%2Fdigital-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmed-dinar%2Fdigital-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmed-dinar%2Fdigital-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmed-dinar","download_url":"https://codeload.github.com/ahmed-dinar/digital-library/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmed-dinar%2Fdigital-library/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31812969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ant-design","docker","nestjs","nextjs","postgresql","prisma-orm","tailwindcss"],"created_at":"2024-11-07T05:36:24.482Z","updated_at":"2026-04-14T19:33:32.596Z","avatar_url":"https://github.com/ahmed-dinar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Digital Library\n\n## Live Demo\n\n##### A live demo is available at **[https://lib.dinar.sh](https://lib.dinar.sh)**.\n\nBackend and frontend is hosted on [Vercel](https://vercel.com)\nusing [Github Actions](https://github.com/ahmed-dinar/digital-library/actions).\nDatabase (PostgreSQL) is hosted on [Neon](https://neon.tech). As these are in free tier, demo might be a little bit\nslow.\n\n## Technology Stack\n\n- #### Backend\n    - NestJS\n        - Nest has built-in support for TypeScript and a modular architecture, making it easy to organize and scale\n          large applications.\n        - Nest provides built-in support for dependency injection (DI), validation, microservices, monolith, rate\n          limiter, documentation, etc., which can help maintain code out of the box to production quality.\n    - Prisma (ORM)\n        - Prisma ensures type-safety by generating typings in TypeScript and includes built-in migrations.\n    - Jest (Test)\n\n- #### Frontend\n    - Next.js\n        - React framework supports server-side rendering (SSR), filter-based routing and server\n          components. It simplifies the development process, optimizes performance and enhances SEO.\n    - Ant Design\n    - Tailwind CSS\n        - An easy to use CSS utility helps to design website using predefined building blocks.\n\n- #### Database\n    - PostgreSQL 15\n        - Considering the requirements of the digital library, book records with fixed fields (title, summary, author\n          etc), a SQL database is likely the most suitable choice.\n        - SQL provide transaction support, strong consistency with ACID property which is required for book record\n          integrity.\n        - SQL can perform complex Queries which is required to retrieve data from book, author, genre etc entries.\n\n- #### DevOps\n    - Github Actions (CI/CD)\n    - Docker (local run)\n\n## Running the dockerized app\n\n\u003e [!NOTE]\n\u003e Please ensure that you have [docker](https://www.docker.com/) and [docker compose](https://docs.docker.com/compose/)\n\u003e installed\n\u003e in your machine.\n\u003e Docker compose version should be \u003e= 2.2\n\nTo run the app, three Docker containers are required: one for the backend, one for the frontend, and another for the\ndatabase.\n\n```bash\n# Clone the code to your local machine\n$ git clone https://github.com/ahmed-dinar/digital-library.git\n\n# Go to the app code directory\n$ cd digital-library\n\n# Running backend, frontend and database\n$ docker-compose up -d\n\n# To see the logs\n$ docker-compose logs -f\n```\n\n## Using the app\n\n* [Frontend](http://localhost:8080) is running on port [http://localhost:8080](http://localhost:8080).\n* [Backend](http://localhost:3000) is running on port [http://localhost:3000](http://localhost:3000).\n\n## Seeding the database\n\nTo seed the database with some demo book records:\n\n* Go to [http://localhost:8080/backdoor](http://localhost:8080/backdoor)\n* Click the appropriate button to seed or clear the seed, as shown in the attached screenshot below.\n\n![Seed database](docs/seed.png)\n\n## Performance Consideration\n\n- ### Caching\n    - Implement caching mechanisms to store frequently accessed book records to reduce database load and response time.\n    - Tools like Redis or memcached can be used for caching.\n\n- ### Load Balancing\n    - Add multiple instance of server to balance the growing request.\n    - Add a load balancer to distribute incoming traffic evenly across multiple instances.\n    - This helps in scaling horizontally and handling increased user traffic effectively.\n\n- ### Rate limiting\n    - Add a rate limiter to prevent misuse and denial-of-service (DoS) attacks.\n    - Currently we are allowing all users operation without authentication, we can limit request by user IP address\n      within a specified timeframe.\n\n- ### Containerize Scaling\n    - We can utilize Docker and Kubernetes to achieve horizontal scaling.\n    - By adding and removing containers based on the traffic, our app can handle traffic loads efficiently.\n\n- ### Database Performance\n    - We could reduce and limit some column length, E.g. book title, name etc to a meaningful limit.\n    - We could add indexing on frequent used columns, E.g. book title, book summary (text search), author and genre\n      name (search)\n    - As the request grow, we could have database replicas. E.g. read and write replica\n    - Partition the database into multiple shards as it grows to distribute data across multiple servers and improve\n      query performance.\n    - Utilize database caching to cache frequently accessed book entries, as reads are more common than write\n      operations, to reduce query latency.\n    - If we need to serve media files (book images, audio etc), we could use a object store (E.g. AWS S3).\n    - Database backup can help to recovery of any data loss.\n\n- ### Frontend Optimization\n    - We could implement client-side caching and pagination to reduce the amount of data fetched from the server.\n    - Use CDN to host frontend static assets (CSS, JavaScript) for faster loading times.\n    - Utilize lazy loading for images and components for faster loading.\n\n- ### Monitoring and Logging\n    - Add logging to both server and frontend, we can track any errors and perform troubleshooting in production.\n    - We could use tools like Sentry (error tracker), Hotjar, analytics (Google analytics etc) in frontend to track real\n      time monitoring.\n    - We could use GCP, AWS or other logs service in backend to monitor incident real time.\n\n## Further Improvements\n\n- ### Development improvements\n    - Add more logs in book add/remove/update services to track who/when/what is modifying.\n    - Add more comments on code where necessary.\n    - Add API documentation tool (E.g swagger) to maintain auto document backend APIs.\n    - Generate and share a postman API collection.\n    - Improve UX in modifying author and genres, in search book option by multiple fields, more sort functionalities.\n\n- ### Frontend testing\n    - We should add frontend unit and e2e testing to make the UI UX quality better and consistent.\n    - Framework like Playwright, Cypress can be used to test UI.\n\n- ### Authentication and Authorization\n    - We could introduce authentication before perform any modification (create, update, delete).\n    - We could have authorization to limit perform modification only books that are owned by a user.\n\n- ### Backend error mapping\n    - We could add more meaningful error from backend. E.g. adding error codes to error type can help to debug\n      production errors.\n\n- ### Internalization\n    - We could add support for multiple languages to provide users more better experience.\n    - Next.js has built-in i18n supports we can utilize that.\n\n- ### User specific features\n    - Features like add a book to favourite, track reading progress, add to user collections can help user to find the\n      app more useful.\n    - Suggested books based on user interaction and reading history can improve UX better.\n    - A socializing feature like an user can add other user as a friend and see/share their interests.\n\n- ### Additional features\n    - Information validation based on user votes (genres attached to book, author etc) can help the reliability of\n      contents.\n    - Like, comment, rating on books can improve interest of users.\n    - Introduce audio book supports to listen to the book.\n    - A pdf/ebook reading experience built int in the app.\n    - We could have a home page section with top/popular/new books.\n\n## Current Database Design\n\n- We have four tables. `Book`, `Author`, `Genre` and `Edition`.\n- Books are unique across the system by their title.\n- Authors are unique across the system by their name.\n- Genres are unique across the system by their name.\n- A Book can be associated to multiple Authors and Genres and vice versa.\n- A new edition of book should have have a unique ISBN associated to it.\n\n![database schema](docs/db_schema.png)\n\n## Development\n\n\u003e [!NOTE]\n\u003e Please ensure that you have node \u003e= 18.17.0 or higher installed.\n\n### Please find the development guides in [server](/server) and [client](/client) directory readme.\n\n## License\n\nLicense under MIT please find the file [here](LICENSE).\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmed-dinar%2Fdigital-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmed-dinar%2Fdigital-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmed-dinar%2Fdigital-library/lists"}