# ๐Ÿ“š Bookmann A self-hosted ebook management system built with Go, PostgreSQL, and Svelte (integrated into a single service) featuring a beautiful Tokyo Night dark theme. ## โœจ Features - **๐Ÿ”’ Multi-User Authentication**: Complete user system with registration/login, JWT-based sessions, and bcrypt password hashing - **โœ… Server-Side Validation**: Comprehensive input validation with detailed error messages - **๐Ÿ”” Toast Notifications**: Real-time error feedback with beautiful toast popups - **๐ŸŒ™ Tokyo Night Theme**: Stunning dark theme with smooth animations and modern UI - **๐Ÿ“– Reading Progress**: User-specific reading progress tracking - **๐Ÿ”ง RESTful API**: Clean API endpoints with JWT authentication - **๐Ÿณ Docker Ready**: Single-container deployment with PostgreSQL - **๐Ÿงช API Testing**: Complete Bruno collection for testing all endpoints - **๐Ÿ“ฑ Responsive Design**: Mobile-first responsive interface ## Quick Start ### Prerequisites - Docker and Docker Compose ### Running the Application 1. Clone the repository 2. Run the application: ```bash docker-compose up --build ``` 3. Access the application at http://localhost:8765 ### Database PostgreSQL runs on port 5432 with default credentials: - Database: ebookdb - User: postgres - Password: password ## Development ### Backend ```bash cd backend go mod tidy go run github.com/sqlc-dev/sqlc/cmd/sqlc@latest generate go run cmd/server/main.go ``` ### Frontend For development, run the frontend separately: ```bash cd frontend npm install npm run dev ``` **โœจ Enhanced Features:** - **Authentication**: Login/Register forms with Tokyo Night styling at `/login` and `/register` - **JWT Management**: Secure token storage with localStorage and session persistence - **Protected Routes**: Automatic redirects with reactive auth state management - **Toast Notifications**: Real-time error feedback for all API operations - **Input Validation**: Client-side and server-side validation with detailed error messages - **Tokyo Night Theme**: Beautiful dark theme with smooth animations and modern UI components - **Responsive Design**: Mobile-first approach with optimized layouts for all screen sizes **Note**: For production, the frontend is built to static files and served by the Go backend. ## API Endpoints ### Auth (Public) - `POST /api/auth/register` - Register new user - `POST /api/auth/login` - Login user (email or username) - `GET /api/auth/profile` - Get user profile (requires JWT) ### Ebooks (Protected) - `GET /api/ebooks` - List ebooks - `GET /api/ebooks/:id` - Get specific ebook - `POST /api/ebooks` - Create new ebook - `PUT /api/ebooks/:id` - Update ebook - `DELETE /api/ebooks/:id` - Delete ebook ### Reading Progress (Protected) - `GET /api/ebooks/:id/progress` - Get reading progress - `PUT /api/ebooks/:id/progress` - Update reading progress ## API Testing Use the included Bruno collection in the `bruno/` directory for testing the API: 1. Install [Bruno](https://www.usebruno.com/) 2. Import the `bruno/` folder as a collection 3. Select the "localhost" environment 4. Run the application and test the endpoints ## Project Structure ``` . โ”œโ”€โ”€ backend/ โ”‚ โ”œโ”€โ”€ cmd/server/ # Application entry point โ”‚ โ”œโ”€โ”€ internal/ โ”‚ โ”‚ โ”œโ”€โ”€ config/ # Configuration management โ”‚ โ”‚ โ”œโ”€โ”€ database/ # Database connection and queries โ”‚ โ”‚ โ””โ”€โ”€ handlers/ # HTTP handlers (auth + ebooks) โ”‚ โ”œโ”€โ”€ migrations/ # Database migrations โ”‚ โ””โ”€โ”€ sqlc.yaml # sqlc configuration โ”œโ”€โ”€ frontend/ โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ lib/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ api.ts # API client with auth & toast notifications โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ auth.ts # Auth state management โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ toast.ts # Toast notification utilities โ”‚ โ”‚ โ””โ”€โ”€ routes/ โ”‚ โ”‚ โ”œโ”€โ”€ login/ # Login page (Tokyo Night theme) โ”‚ โ”‚ โ”œโ”€โ”€ register/ # Registration page (Tokyo Night theme) โ”‚ โ”‚ โ””โ”€โ”€ ... # Other routes (Tokyo Night theme) โ”‚ โ”œโ”€โ”€ app.css # Global styles with Tokyo Night theme โ”‚ โ””โ”€โ”€ package.json # Build dependencies with toast library โ”œโ”€โ”€ bruno/ # Bruno API testing collection โ”œโ”€โ”€ docker-compose.yml โ””โ”€โ”€ README.md ``` ## ๐ŸŽจ Recent Enhancements ### Backend Improvements - **Server-Side Validation**: Added comprehensive input validation using `go-playground/validator/v10` - **Enhanced Security**: All API endpoints now validate requests before processing - **Better Error Handling**: Detailed validation error messages for improved debugging ### Frontend Redesign - **Tokyo Night Theme**: Complete UI overhaul with beautiful dark theme colors - **Toast Notifications**: Real-time error feedback using `@zerodevx/svelte-toast` - **Modern UI Components**: Card-based layouts, smooth animations, and responsive design - **Enhanced UX**: Loading states, form validation, and improved user feedback ### Technical Updates - **Dependencies**: Added validation and toast libraries - **Typography**: Inter font family for improved readability - **Animations**: Custom fade-in and slide-in animations - **Performance**: Optimized CSS compilation and build process ## License GPL-3.0