This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Install dependencies
flutter pub get
# Run the app
flutter run
# Run with specific device
flutter run -d <device_id>
# Analyze code for issues
flutter analyze
# Run all tests
flutter test
# Run a single test file
flutter test test/core/validators/validation_test.dart
# Run tests with coverage
flutter test --coverage
# Build APK
flutter build apk
# Build iOS
flutter build ios- Copy
.env.exampleto.env - Add Supabase credentials:
SUPABASE_URL=your_supabase_url_here SUPABASE_ANON_KEY=your_supabase_anon_key_here
- Credentials are loaded via
flutter_dotenvinAppSecrets
Blogify is a Flutter blogging app using Clean Architecture with BLoC pattern for state management and Supabase as the backend.
Each feature follows a three-layer architecture:
features/<feature_name>/
├── data/
│ ├── datasources/ # Remote/local data sources (Supabase calls)
│ ├── models/ # Data models (JSON serialization)
│ └── repositories/ # Repository implementations
├── domain/
│ ├── entities/ # Business entities
│ ├── repositories/ # Repository interfaces (contracts)
│ └── usecases/ # Business logic operations
└── presentation/
├── bloc/ # BLoC (events, states, bloc)
├── pages/ # UI screens
└── widgets/ # Reusable UI components
- common/cubits/: App-wide state (
AppUserCubitfor user session) - common/entities/: Shared entities across features
- common/widgets/: Reusable widgets (
GradientButton,Loader,ChoiceChipWidget) - constants/: App constants including blog
topicslist - error/:
FailureandServerExceptionclasses for error handling - network/:
ConnectionCheckerfor internet connectivity - secrets/:
AppSecrets- loads Supabase credentials from.env - theme/:
AppPalletefor colors,AppThemefor light/dark themes - usecase/: Base
UseCase<SuccessType, Params>interface usingEither<Failure, SuccessType> - utils/: Utilities (
showSnackbar,pickImage,formatDate,calculateReadingTime) - validators/: Input validation logic
Uses GetIt (serviceLocator) initialized in init_dependencies.dart with part file init_dependencies.main.dart:
_initAuth(): Registers auth data sources, repository, usecases, andAuthBloc_initBlog(): Registers blog data sources, repository, usecases, andBlogBloc_initProfile(): Registers profile data sources, repository, usecases, andProfileBloc
- BLoC for feature-specific state (
AuthBloc,BlogBloc,ProfileBloc) - Cubit for app-wide state (
AppUserCubit) - All provided via
MultiBlocProviderinmain.dart
- UI dispatches Event to BLoC
- BLoC calls UseCase
- UseCase calls Repository (interface)
- Repository implementation calls DataSource
- DataSource interacts with Supabase
- Result flows back as
Either<Failure, SuccessType> - BLoC emits new State
Tests use mocktail for mocking. Structure mirrors lib/:
test/
├── core/
│ ├── utils/ # Unit tests for utilities
│ └── validators/ # Validation tests
└── features/
├── auth/domain/usecases/
└── blog/domain/usecases/
Database tables: profiles, blogs
Storage bucket: blog_images
Key RLS policies ensure users can only modify their own content.
Follow Conventional Commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changestest:- Adding/updating testsrefactor:- Code refactoringchore:- Maintenance tasks