{"id":21429583,"url":"https://github.com/mayank-02/bookman","last_synced_at":"2025-06-24T15:06:33.258Z","repository":{"id":246497129,"uuid":"820656536","full_name":"mayank-02/bookman","owner":"mayank-02","description":"Book management software","archived":false,"fork":false,"pushed_at":"2024-06-30T20:29:00.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T21:48:38.848Z","etag":null,"topics":["book-management","cli","golang","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","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/mayank-02.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-06-26T23:14:03.000Z","updated_at":"2025-02-12T19:20:28.000Z","dependencies_parsed_at":"2024-06-28T10:12:27.537Z","dependency_job_id":"1aaf2def-d05b-470b-9eee-cbae4dfc6ceb","html_url":"https://github.com/mayank-02/bookman","commit_stats":null,"previous_names":["mayank-02/bookman"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mayank-02/bookman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayank-02%2Fbookman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayank-02%2Fbookman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayank-02%2Fbookman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayank-02%2Fbookman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mayank-02","download_url":"https://codeload.github.com/mayank-02/bookman/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayank-02%2Fbookman/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261700468,"owners_count":23196501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["book-management","cli","golang","rest-api"],"created_at":"2024-11-22T22:18:22.943Z","updated_at":"2025-06-24T15:06:33.234Z","avatar_url":"https://github.com/mayank-02.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bookman\n\nBookman is a simple book management software designed to provide users with an efficient way to manage their book collections. The software offers a robust REST API, utilizes a relational database (SQLite) for data storage, and includes a command-line interface (CLI) for easy interaction.\n\n## Features\n\nAs a user, you can:\n- Add and manage books into the system, including some basic information about those books (title, author, published date, edition, description, genre, ...)\n- Create and manage collections of books\n- Easily list all books, all collections, and filter book lists by author, genre, or a range of publication dates\n\n## Setup\n\nPre-requisites: Go 1.22 or higher, SQLite and Git\n\nSteps to run the application:\n```bash\n# Clone the Repository\ngit clone https://github.com/mayank-02/bookman.git\n\n# Change the working directory\ncd bookman\n\n# Install dependencies\ngo mod download\n\n# Create the SQLite database\nsqlite3 bookman.db \u003c sql/schema.sql\n\n# Ensure tests pass\ngo test ./...\n\n# Build and run the server\ngo build -o bin/server cmd/server/main.go\n./bin/server # The server will start on `http://localhost:8080`.\n\n# Build and run the CLI\ngo build -o bin/bookman cmd/cli/*\n./bin/bookman \n```\n\n## Usage\n\nBelow is a comprehensive guide to using the CLI, detailing all available commands, their options, and examples of user interactions.\n\n```bash\nbookman - Book Management CLI\n\nUsage:\n  bookman [command]\n\nAvailable Commands:\n  book        Manage books\n  collection  Manage book collections\n  help        Help about any command\n  version     Print the version number of bookman\n\nBook Commands:\n  book add         Add a new book\n  book delete      Delete a book\n  book get         Get details of a specific book\n  book list        List all books\n  book update      Update a book's information\n\nCollection Commands:\n  collection add-book       Add a book to a collection\n  collection create         Create a new collection\n  collection delete         Delete a collection\n  collection get            Get details of a specific collection\n  collection list           List all collections\n  collection remove-book    Remove a book from a collection\n  collection update         Update a collection\n\nFlags:\n  -h, --help      Help for bookman\n\nUse \"bookman [command] --help\" for more information about a command.\n```\n\nBook-related commands:\n```bash\n# Adding a book\n$ bookman book add --title \"The Go Programming Language\" --author \"Alan A. A. Donovan, Brian W. Kernighan\" --published \"2015-10-26\" --genre \"Programming\" --description \"An authoritative resource for Go programming language\"\n\n# Getting details of a book\n$ bookman book get --id 1\n\n# Listing books\n$ bookman book list\n$ bookman book list --author \"Alan A. A. Donovan, Brian W. Kernighan\"\n$ bookman book list --genre \"Programming\"\n$ bookman book list --from \"2010-01-01\" --to \"2020-12-31\"\n\n# Updating a book\n$ bookman book update --id 1 --title \"The Go Programming Language (2nd Edition)\" --author \"Mayank Jain\" --published \"2024-06-28\"\n\n# Deleting a book\n$ bookman book delete --id 1\n```\n\nCollection-related commands:\n```bash\n# Creating a collection\n$ bookman collection create --name \"My Favorite Programming Books\"\n\n# Adding a book to a collection\n$ bookman collection add-book --collection-id 1 --book-id 1\n\n# Listing collections\n$ bookman collection list\n\n# Getting details of a collection\n$ bookman collection get --id 1\n\n# Removing a book from a collection\n$ bookman collection remove-book --collection-id 1 --book-id 1\n```\n## REST API\n\n### Models\n\n#### Book\n\n```json\n{\n  \"id\": 1,\n  \"title\": \"string\",\n  \"author\": \"string\",\n  \"published_date\": \"YYYY-MM-DD\",\n  \"edition\": \"string\",\n  \"description\": \"string\",\n  \"genre\": \"string\",\n  \"created_at\": \"timestamp\",\n  \"updated_at\": \"timestamp\"\n}\n```\n\n#### Collection\n\n```json\n{\n  \"id\": 1,\n  \"name\": \"string\",\n  \"books\": [\n    {\n      \"id\": 1,\n      \"title\": \"string\",\n      \"author\": \"string\",\n      \"published_date\": \"YYYY-MM-DD\",\n      \"edition\": \"string\",\n      \"description\": \"string\",\n      \"genre\": \"string\",\n      \"created_at\": \"timestamp\",\n      \"updated_at\": \"timestamp\"\n    }\n  ]\n}\n```\n\n### Books API\n\n| Method | Endpoint           | Description              | Request Body                                                                                                                                 | Query Parameters                                                            | Response Code | Response Body |\n| ------ | ------------------ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ------------- | ------------- |\n| GET    | /api/v1/books      | Retrieve all books       | N/A                                                                                                                                          | `author` (optional), `genre` (optional), `from` (optional), `to` (optional) | 200           | List\\\u003cBook\\\u003e  |\n| POST   | /api/v1/books      | Create a new book        | `{ \"title\": \"string\", \"author\": \"string\", \"published_date\": \"YYYY-MM-DD\", \"edition\": \"string\", \"description\": \"string\", \"genre\": \"string\" }` | N/A                                                                         | 201           | Book          |\n| GET    | /api/v1/books/{id} | Retrieve a specific book | N/A                                                                                                                                          | N/A                                                                         | 200           | Book          |\n| PUT    | /api/v1/books/{id} | Update a specific book   | `{ \"title\": \"string\", \"author\": \"string\", \"published_date\": \"YYYY-MM-DD\", \"edition\": \"string\", \"description\": \"string\", \"genre\": \"string\" }` | N/A                                                                         | 200           | Book          |\n| DELETE | /api/v1/books/{id} | Delete a specific book   | N/A                                                                                                                                          | N/A                                                                         | 204           | N/A           |\n\n### Collections API\n\n| Method | Endpoint                                | Description                              | Request Body           | Response Code | Response Body                                |\n| ------ | --------------------------------------- | ---------------------------------------- | ---------------------- | ------------- | -------------------------------------------- |\n| GET    | /api/v1/collections                     | Retrieve all collections                 | N/A                    | 200           | List\\\u003cCollection\\\u003e                           |\n| POST   | /api/v1/collections                     | Create a new collection                  | `{ \"name\": \"string\" }` | 201           | `{ \"id\": 1, \"name\": \"string\", \"books\": [] }` |\n| GET    | /api/v1/collections/{id}                | Retrieve a specific collection           | N/A                    | 200           | Collection                                   |\n| PUT    | /api/v1/collections/{id}                | Update a specific collection             | `{ \"name\": \"string\" }` | 200           | Collection                                   |\n| DELETE | /api/v1/collections/{id}                | Delete a specific collection             | N/A                    | 204           | N/A                                          |\n| POST   | /api/v1/collections/{id}/books/{bookId} | Add a book to a specific collection      | N/A                    | 204           | N/A                                          |\n| DELETE | /api/v1/collections/{id}/books/{bookId} | Remove a book from a specific collection | N/A                    | 204           | N/A                                          |\n\n\n### Error Handling\n\nAll endpoints return appropriate HTTP status codes and error messages in the following cases:\n\n- 400 Bad Request: Invalid input or missing required fields\n- 404 Not Found: Resource not found\n- 409 Conflict: Conflict in the request, e.g., adding a book that is already in the collection\n- 500 Internal Server Error: Internal server error\n\n\n## Database Schema\n\nThis should include all the tables you expect to use to store this data, for each table, all its\nexpected columns, column types, relations, constraints and any index you’d like to add.\nYou may write this directly in SQL or use tables or text as an alternative way to describe what\nyou’re going for.\n\n```text\n+-------------------+             +--------------------------+             +-------------------+\n|    books          |             |     collection_books     |             |    collections    |\n+-------------------+             +--------------------------+             +-------------------+\n| - id (PK)         |\u003c-----┐      | - collection_id (FK, PK) |\u003c-----------\u003e| - id (PK)         |\n| - title           |      └-----\u003e| - book_id (FK, PK)       |             | - name            |\n| - author          |             | - added_at               |             +-------------------+\n| - published_date  |             +--------------------------+\n| - edition         |\n| - description     |\n| - genre           |\n| - created_at      |\n| - updated_at      |\n+-------------------+\n\nIndexes: On author, genre, published_date in books table and on collection_id, book_id in collection_books table.\n```\n\n## Directory Structure\n\n```\nbookman\n├── LICENSE\n├── README.md                     # Overview and usage instructions\n├── cmd\n│   ├── cli                       # CLI related commands\n│   │   ├── book.go\n│   │   ├── collection.go\n│   │   └── main.go               # Entry point for the CLI application\n│   └── server                    # Server related commands\n│       └── main.go               # Entry point for the server application\n├── go.mod\n├── go.sum\n├── internal\n│   ├── api\n│   │   ├── handlers.go           # API endpoint handlers\n│   │   └── handlers_test.go      # Tests for API handlers\n│   ├── db\n│   │   ├── db.go                 # Database initialization and operations\n│   │   └── db_test.go            # Tests for database operations\n│   └── models                    # Data models\n│       ├── book.go\n│       └── collection.go\n├── pkg\n│   └── client                    # Client package for interacting with the server\n│       └── client.go\n└── sql\n    └── schema.sql                # SQL schema for setting up the database\n```\n\n\n\n## Possible Enhancements\n\n1. Secure the API with user authentication and authorization\n2. Add pagination support for book listings\n3. Implement advanced search capabilities and multi-criteria filtering\n4. Integrate with external APIs like Google Books for additional information\n5. Optimize database queries and indexing for large datasets\n\n## Resources\n\n1. Golang Documentation: [golang.org/doc](https://golang.org/doc/)\n2. SQLite Documentation: [sqlite.org/docs](https://www.sqlite.org/docs.html)\n3. Gorilla Mux: [github.com/gorilla/mux](https://github.com/gorilla/mux)\n4. Cobra CLI: [github.com/spf13/cobra](https://github.com/spf13/cobra)\n5. Testing in Go: [golang.org/pkg/testing](https://golang.org/pkg/testing/), [golang.org/pkg/net/http/httptest](https://golang.org/pkg/net/http/httptest/) and [stretchr/testify](https://github.com/stretchr/testify)\n\n## Author\n\n[Mayank Jain](https://jainmayank.me/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayank-02%2Fbookman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmayank-02%2Fbookman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayank-02%2Fbookman/lists"}