BookBridge π

A peer-to-peer marketplace for Cameroonian students to buy and sell used physical books. Built with Flutter and powered by Supabase, BookBridge connects students locally to simplify the process of finding affordable books and monetizing used collections.
πΈ Screenshots
Here are some screenshots of the BookBridge app:
π Features
Core Functionality
- User Authentication: Secure email/password signup and signin via Supabase
- Browse Listings: Discover available books in a responsive grid layout with infinite scroll pagination
- Smart Search: Full-text search across book titles and authors
- Detailed Listings: View comprehensive information about each book including images, pricing, and seller contact info
- Sell Books: Create listings with custom pricing, condition selection, and images
- Profile Management: Manage your profile and track your listings and sales
- Direct Communication: Contact sellers directly via WhatsApp for seamless transactions
Technical Highlights
- Clean Architecture: 3-layer architecture (Domain, Data, Presentation) with clear separation of concerns
- State Management: Provider pattern with ChangeNotifier for efficient state handling
- Dependency Injection: get_it for service locator pattern
- Navigation: go_router for intuitive routing and deep linking
- Error Handling: Either<Failure, Success> pattern using dartz for robust error management
- UI/UX: Material Design 3 with elegant dark theme optimized for readability
- Responsive Design: Works seamlessly across all screen sizes and orientations
ποΈ Architecture
The application follows Clean Architecture principles with clear separation of concerns:
lib/
βββ core/ # Core functionality shared across features
β βββ error/ # Error handling (Failures, Exceptions)
β βββ theme/ # Application theming
β βββ usecases/ # Base UseCase classes
βββ features/ # Feature modules
β βββ auth/ # Authentication feature
β β βββ domain/ # Business logic (entities, repositories, use cases)
β β βββ data/ # Data sources and repositories (Supabase)
β β βββ presentation/ # UI and state management (screens, view models)
β βββ listings/ # Listings feature
β βββ domain/
β βββ data/
β βββ presentation/
βββ config/ # App-wide configuration (routing, DI)
βββ injection_container.dart # Dependency injection setup
βββ main.dart # App entry point
π Getting Started
Prerequisites
- Flutter SDK (3.0+)
- Dart SDK (included with Flutter)
- A Supabase project account
Installation
- Clone the repository:
git clone https://github.com/yourusername/book-bridge.git
cd book-bridge
- Get dependencies:
flutter pub get
Configure environment variables:
Run the app with environment variables:
flutter run --dart-define=SUPABASE_URL=$(cat .env | grep SUPABASE_URL | cut -d'=' -f2) --dart-define=SUPABASE_ANON_KEY=$(cat .env | grep SUPABASE_ANON_KEY | cut -d'=' -f2)
Alternatively, you can define the environment variables directly when running the app:
SUPABASE_URL=your_url SUPABASE_ANON_KEY=your_key flutter run
Database Schema
profiles table
- id (UUID, primary key)
- email (text)
- full_name (text)
- locality (text, nullable)
- whatsapp_number (text, nullable)
- created_at (timestamp)
listings table
- id (UUID, primary key)
- title (text)
- author (text)
- price_fcfa (integer)
- condition (text: 'new', 'like_new', 'good', 'fair', 'poor')
- image_url (text)
- description (text, nullable)
- seller_id (UUID, foreign key to profiles)
- status (text: 'available', 'sold', 'pending')
- created_at (timestamp)
π§ Navigation
The app uses go_router for navigation with auth state-based redirection:
/: Splash screen (redirects based on auth state)
/sign-in: Sign in screen
/sign-up: Sign up screen
/home: Home feed with listings grid
/listing/:id: Listing details screen
/search: Search listings
/sell: Create new listing
/profile: User profile and listings management
π‘ State Management
The app uses Provider with ChangeNotifier pattern for state management:
- AuthViewModel: Manages authentication state and user session
- HomeViewModel: Manages home feed listings with pagination
- ListingDetailsViewModel: Manages single listing details display
- SellViewModel: Manages listing creation form and validation
- ProfileViewModel: Manages user profile and listings management
- SearchViewModel: Manages search functionality and results
β οΈ Error Handling
Errors are handled using a functional approach with the Either pattern from dartz:
// Example: Either<Failure, Success>
final result = await someUseCase(params);
result.fold(
(failure) => handleError(failure.message),
(success) => handleSuccess(success),
);
Error types:
AuthFailure: Authentication-related errors
ServerFailure: Server and network errors
UnknownFailure: Unexpected errors
NotFoundException: Resource not found
π οΈ Development
Code Quality
The project maintains high code quality standards:
- dart fix --apply: Automated code fixes
- flutter analyze: Linting and analysis (0 issues)
- dart format: Consistent code formatting
Implemented Phases
Phase 1: Project Initialization β
- Flutter project setup with all required dependencies
- Boilerplate cleanup
- Documentation and changelog creation
Phase 2: Core Architecture and Theming β
- Clean Architecture directory structure
- Error handling system with Failure and Exception classes
- Base UseCase classes
- Dependency injection framework with get_it
- Dark theme implementation with Material 3
- App initialization and routing setup
Phase 3: Authentication Feature β
- Domain layer: User entity, AuthRepository interface, authentication use cases
- Data layer: Supabase Auth integration, UserModel DTO, AuthRepositoryImpl
- Presentation layer: AuthViewModel, SignInScreen, SignUpScreen
- go_router configuration with auth state-based redirection
- Automatic navigation based on authentication state
Phase 4: Listings Feature - Browse and View β
- Domain layer: Listing entity, ListingRepository, GetListings and GetListingDetails use cases
- Data layer: Supabase PostgreSQL integration, ListingModel, pagination support
- Presentation layer: HomeViewModel, HomeScreen with GridView, ListingDetailsScreen
- Pagination with 50-item pages and infinite scroll
- Pull-to-refresh functionality
- Navigation integration
Phase 5: Sell and Profile Features β
- Domain layer: CreateListing, DeleteListing, GetUserListings use cases
- Data layer: createListing and deleteListing methods in SupabaseListingsDataSource
- Presentation layer: SellViewModel and SellScreen with form validation
- Profile screen: ProfileViewModel and ProfileScreen for managing user listings
- Delete listings functionality with confirmation dialogs
- Form validation for listing creation (title, author, price, condition, image)
Phase 6: Search and Finalization β
- Domain layer: SearchListingsUseCase for full-text search
- Presentation layer: SearchViewModel, SearchScreen with search results grid
- Full-text search across book titles and authors
- Multiple search states (initial, loading, success, error, empty)
π§ Future Enhancements
Short-term Roadmap
Long-term Vision: The "Amazon for Books" in Cameroon
BookBridge aims to move beyond a peer-to-peer app to become a vital piece of national social infrastructure.
π€ Contributing
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature)
- Make your changes
- Add tests if applicable
- Commit your changes (
git commit -m 'Add some AmazingFeature')
- Push to the branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Flutter and Dart communities
- Supabase for backend infrastructure
- Material Design 3 for design guidelines
- Provider package for state management patterns
- All contributors who help make BookBridge better
For support, questions, or feedback, please:
- Open an issue on the project repository
- Contact the development team directly
- Check our documentation for troubleshooting tips
Made with β€οΈ for Cameroonian students