mnemo_cards/mnemo_cards_backend/project_config.md
2025-11-16 14:25:27 +03:00

102 lines
No EOL
3.3 KiB
Markdown

# Mnemo Cards Backend - Project Configuration
## Project Overview
- **Name**: mnemo_cards_backend
- **Type**: Flutter/Dart backend server using Shelf framework
- **Purpose**: Backend API server for Mnemo Cards application
- **Architecture**: Clean architecture with dependency injection
## Tech Stack
- **Language**: Dart 3.0+
- **Framework**: Shelf (HTTP server)
- **Database**: Isar (local database)
- **Dependency Injection**: GetIt + Injectable
- **Code Generation**: Build Runner
- **Testing**: Dart Test + Mockito
- **Authentication**: JWT tokens, Google APIs
- **Payment**: YooKassa integration
## Project Structure
- `lib/` - Main source code
- `test/` - Unit tests
- `certs/` - SSL certificates for HTTPS
- `backup/` - Database backups
- `python_folder/` - Python utilities
- `target_folder/` - Build artifacts
## Key Dependencies
- `mnemo_cards_common` - Shared common code
- `mnemo_cards_common_backend` - Backend-specific common code
- `isar` - Database
- `shelf_*` - HTTP server components
- `get_it` + `injectable` - Dependency injection
- `googleapis` - Google services integration
- `yookassa_client` - Payment processing
## Commands
```bash
# Development
./run_dev.sh # Start development server
./restart_dev.sh # Restart development server
# Production
./run_http_production.sh # HTTP production server
./run_https_production.sh # HTTPS production server
# Code Generation
./codegen.sh # Run build_runner
flutter pub run build_runner build --delete-conflicting-outputs
# Testing
flutter test # Run all tests
flutter test test/ # Run specific test directory
# Database
# Backup files are in backup/ directory
# Database files are in isar/ directory
# SSL Certificates
./certs/generate_server.sh # Generate server certificates
./certs/generate_domain_cert.sh # Generate domain certificates
```
## Environment Variables
- SSL certificates in `certs/` directory
- Database files in `isar/` directory
- Backup files in `backup/` directory
## Architecture Guidelines
- Use `yx_state` and `yx_scope` for state management
- Follow clean architecture principles
- Reference `../mnemo_cards` app for design/features (don't copy architecture)
- Use dependency injection with GetIt/Injectable
- Implement proper error handling and validation
## Testing Requirements
- Write unit tests for all functionalities
- Use Mockito for mocking dependencies
- Test coverage for business logic
- Integration tests for API endpoints
## Acceptance Criteria
- [ ] Builds successfully (`flutter build`)
- [ ] All linters pass (`dart analyze`)
- [ ] All existing tests pass (`flutter test`)
- [ ] New tests cover new functionality
- [ ] Code generation runs without errors (`./codegen.sh`)
- [ ] Server starts and responds to requests
- [ ] SSL certificates are valid
- [ ] Database operations work correctly
## File Maintenance
- Update `PROGESS.md` after completing major steps
- Update `TODO.md` with current tasks and priorities
- Maintain `workflow_state.md` for autonomous operation state
- Keep backup files organized in `backup/` directory
## Safety Constraints
- Never run destructive commands without explicit approval
- Always backup database before migrations
- Use HTTPS in production environments
- Validate all user inputs
- Implement proper error handling for external API calls