mirror of
https://github.com/isdenmois/fb-search.git
synced 2026-07-01 18:47:28 +03:00
No description
- Go 52.5%
- TypeScript 36.2%
- Vue 7.3%
- CSS 2.3%
- Dockerfile 0.9%
- Other 0.8%
| .vscode | ||
| e2e | ||
| server | ||
| web | ||
| .editorconfig | ||
| .gitignore | ||
| AGENTS.md | ||
| biome.json | ||
| bun.lock | ||
| bunfig.toml | ||
| CHECKS | ||
| docker-compose.yml | ||
| Dockerfile | ||
| env.d.ts | ||
| justfile | ||
| lefthook.yml | ||
| package.json | ||
| playwright.config.ts | ||
| README.md | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| tsconfig.vitest.json | ||
| tsconfig.web.json | ||
| uno.config.ts | ||
| vite.config.ts | ||
FB Search
A book search application for the Flibusta library, enabling search and download of FB2 books via a modern web interface. The project uses a hybrid Go/TypeScript architecture with PostgreSQL for data storage.
Architecture
Dual-Stack Architecture:
-
Backend (Go): REST API server using Gin framework
- Entry point:
main.go - Dependency injection via
sarulabs/di - PostgreSQL database via
pgx/v5 - HTTP controllers in
views/controllers/
- Entry point:
-
Frontend (Vue 3): SPA using Vite + UnoCSS
- Entry point:
web/app/main.ts - Vue Router for client-side routing
- HTTP API client via
wretch
- Entry point:
Data Flow
User Browser (Vue SPA)
↓
Vite Dev Server / HTTP API
↓
PostgreSQL Database (books index)
↓
Flat Files (ZIP archives in files/)
Tech Stack
- Backend: Go 1.25+ (Gin framework, pgx/v5, sarulabs/di)
- Frontend: Vue 3 + TypeScript + Vite 7.3.1 + UnoCSS 66.6.2
- Database: PostgreSQL
- Build Tools: Bun, Go modules
- Testing: Playwright (E2E), Vitest (unit), testcontainers-go (integration)
Project Structure
.
├── app/ # Business logic (INP parser)
├── domain/ # Domain entities (Book, ParseProgress)
├── infra/ # Infrastructure layer
│ ├── db/ # Database connection, migrations
│ └── repositories/ # Data access layer
├── migrations/ # PostgreSQL schema migrations
├── parser/ # Book parsing logic
├── views/ # HTTP layer
│ ├── controllers/ # API endpoints
│ ├── di.go # Dependency injection setup
│ └── views.go # HTTP server initialization
├── tests/ # Go integration tests
│ ├── integration/ # Controller and repository tests
│ ├── testhelpers/ # Test infrastructure
│ ├── fixtures/ # Test data
│ └── mocks/ # Mock implementations
├── scripts/ # Build and migration scripts
├── web/ # Vue frontend
│ ├── app/ # Vue entry point, App.vue
│ ├── pages/ # Page components
│ ├── entities/ # API types and functions
│ └── shared/ # Shared utilities
├── playwright/ # E2E test suite
├── files/ # Book archives (ZIP, INPX)
└── public/ # Built frontend assets
Getting Started
Prerequisites
- Go 1.25+
- PostgreSQL
- Bun
Setup
- Clone the repository
- Configure environment variables:
cp .env.example .env
# Edit .env with your database credentials
- Run database migrations:
# Frontend
bun run schema
# Backend
go run main.go
Development
# Frontend (with hot reload)
bun run web
# Backend
go run main.go
# Or via just (if installed)
just run
just build
Importing Books
Place your Flibusta files in the files/ directory:
flibusta_fb2_local.inpx- Index file*.zip- Book archives
Parse the books into the database:
# From frontend
bun run parse
# Or via API
curl -X POST http://localhost:8080/api/parse
Testing
Go Integration Tests
go test ./tests/integration/... -v
Unit Tests (Vitest)
bun run test
E2E Tests (Playwright)
bun run playwright
API Endpoints
GET /api/search?q=<query>- Search booksGET /dl/:file/:path- Download book filePOST /api/parse- Rebuild database from INPX files
Docker Deployment
docker-compose up -d # Starts PostgreSQL
License
MIT