Giter VIP home page Giter VIP logo

books_cat's Introduction

BooksCat BooksCat

Description

This is a proof of concept web app for managing books in a library.
It would be improved by implementing some interesting features in the nearest future (search by title, category, author or by ISBN).

The project consists of two main parts:

  • Backend: Elixir/Phoenix API + PostgreSQL
  • Frontend: Svelte

A simple Books REST API with database persistence using PostgreSQL.
The requirements are to have a single endpoint on /api/books that allows CRUD operations over the books resource with the following fields:

  • id - This is the table Primary Key (UUID type)
  • title - String containing the book title
  • authors - String containing a comma-separated list of authors
  • isbn - Book ISBN
  • description - Text specifying the book description or abstract
  • category - String containing a comma-separated list of tags
  • cover - String containing an image url for displaying the cover
  • inserted_at - Datetime defining when the record was created
  • updated_at - Datetime defining when the record was updated

Book Entity

The endpoints for the Books resource are listed here:

BookCat REST API

To create a book you need to complete a post request with the following parameters: Post request sample

Installation

Prerequisites

While developing the following stack was used:

Technology Version
Elixir 1.12.2-otp-24
Phoenix 1.6.2
Node JS 14.15.4
PostgreSQL 14.1
docker-compose 1.26.0
Svelte 3.0.0
Rollup JS 2.3.4

Steps to start the project locally:

  1. Execute mix deps.get to install Phoenix dependencies.
  2. You need a postgresql database to proceed.
    You can use docker: docker-compose -f docker/docker-compose.yml up -d to get up the database.
    If this command fails then you're using PostgreSQL locally. Stop it: sudo service postgresql stop and repeat docker-compose command.
  3. When the database is up and running:
    • mix ecto.create and then
    • mix ecto.migrate
  4. Start Phoenix: mix phx.server
  5. Now we need to launch frontend. Enter /assets directory from another tab of your terminal and run: npm i or yarn if you prefer it over npm.
  6. Execute npm run dev and navigate to http://localhost:5000

Running Svelte

At beginning there's no book data. You can use some mock data from /assets/src/mockups/booksMock file and use Postman for testing

Testing

Run mix test for API tests

app_tests

You could also visit endpoint in the browser http://localhost:4000/api/books and investigate api responses.

api_response

The BooksCat now looks like this, but there are a lot of ideas worth mentioning

The_BooksCat

Ideas / Improvements

With the next iterations I'd like to add:

  • The most important feature searcher with filters
  • Authorization/authentication for backend (different roles for DB) and frontend (sign in new users, user roles).
  • Add more fields for Book Entity like 'pages', 'subtitle', 'publisher'.
  • More validation cases (pop up for errores, etc.)
  • More tests
  • Extra integration -> add bar code ISBN scanner for faster adding new books to the library.

BookCatalogue

books_cat's People

Contributors

maxie7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.