GoBookshelf is a full-stack web application for managing a personal book collection. Built with Go and React, it provides a simple and efficient way to manage your books with proper ISBN validation and data management.
- RESTful API built with Go
- SQLite database for data persistence
- ISBN-13 validation and formatting
- Request validation and error handling
- Pagination support
- CORS support
- Unit and integration tests
- Modern React application with Vite
- Clean and responsive UI with Tailwind CSS
- Real-time data updates with React Query
- Form validation with proper error handling
- ISBN formatting and validation
- Loading states and error feedback
- Go 1.21+
- SQLite3
- go-playground/validator
- React 18
- Vite
- Tailwind CSS
- React Query
- Axios
- Go 1.21 or higher
- Node.js 18 or higher
- npm or yarn
- Clone the repository:
git clone https://github.com/yourusername/GoBookshelf.git
cd GoBookshelf- Install backend dependencies:
go mod tidy- Install frontend dependencies:
cd frontend
npm install- Navigate to the project root directory
- Run the server:
go run cmd/server/main.goThe server will start on http://localhost:8080
- Navigate to the frontend directory:
cd frontend- Start the development server:
npm run devThe application will be available at http://localhost:5173
-
View Books
- Open the application in your browser
- Books are displayed in a paginated table
- Use the pagination controls at the bottom to navigate
-
Add a Book
- Click the "Add New Book" button
- Fill in the required fields:
- Title (required, max 200 characters)
- Author (required, max 100 characters)
- ISBN-13 (required, must be valid)
- Published Date (required)
- Click "Add Book" to save
-
Edit a Book
- Click the pencil icon next to a book
- Modify the desired fields
- Click "Save" to update or "Cancel" to discard changes
-
Delete a Book
- Click the trash icon next to a book
- Confirm the deletion when prompted
The application expects ISBN-13 format:
- 13 digits (e.g., 978-3-16-148410-0)
- Automatically validates checksum
- Automatically formats with hyphens
GET /books?page=1&page_size=10- List books with paginationGET /books/{id}- Get a specific bookPOST /books- Create a new bookPUT /books/{id}- Update an existing bookDELETE /books/{id}- Delete a book
Backend tests:
go test ./...GoBookshelf/
├── cmd/
│ └── server/ # Application entrypoint
├── configs/ # Configuration files
├── frontend/ # React application
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── utils/ # Utility functions
│ │ └── ...
├── internal/
│ ├── api/ # API handlers
│ ├── errors/ # Error handling
│ ├── models/ # Data models
│ └── storage/ # Database operations
└── migrations/ # Database migrations
This project is licensed under the MIT License