A comprehensive harm reduction desktop application built with Kotlin Multiplatform and Compose Desktop, featuring the complete PsychonautWiki substance database.
This application provides evidence-based harm reduction information for psychoactive substances, helping users make informed decisions about substance use through comprehensive data on dosing, duration, interactions, and safety information.
- π Complete PsychonautWiki Database: Access to 289 psychoactive substances with comprehensive harm reduction data
- π Detailed Substance Information:
- Dosing guidelines for different routes of administration
- Duration data (onset, peak, offset, total duration)
- Bioavailability information
- Interaction warnings and contraindications
- Tolerance and addiction potential information
- π Advanced Search & Filtering: Search by substance name, common names, categories, or effects
- β‘ Fast Performance: Optimized database loading with health monitoring and metrics
- π₯οΈ Modern Desktop UI: Clean, responsive interface built with Compose Desktop
- π‘οΈ Robust Error Handling: Graceful fallbacks and comprehensive error reporting
- Kotlin Multiplatform: Cross-platform development
- Compose Desktop: Modern declarative UI framework
- kotlinx.serialization: JSON parsing and data serialization
- SQLDelight: Database management with coroutines support
- Koin: Dependency injection
- NixOS: Reproducible development environment
- Nix with flakes enabled (recommended for reproducible builds)
- Java 17+ (if not using Nix)
- Gradle 7.6+ (if not using Nix)
-
Clone the repository:
git clone https://github.com/shift/psychonautwiki-journal.git cd psychonautwiki-journal -
Enter the development environment:
nix develop
-
Build and run the application:
cd psychonautwiki-journal-desktop gradle run
-
Clone the repository:
git clone https://github.com/shift/psychonautwiki-journal.git cd psychonautwiki-journal/psychonautwiki-journal-desktop -
Build and run:
./gradlew run
The application successfully loads the complete PsychonautWiki database:
- 289 substances with comprehensive harm reduction data
- 12 substances with bioavailability information
- Multiple routes of administration per substance
- Interaction warnings for dangerous combinations
- Category-based organization (psychedelics, stimulants, depressants, etc.)
- Progress Tracking: Real-time loading progress with metrics
- Health Monitoring: Database integrity checks and load time tracking
- Graceful Fallbacks: Fallback to essential substances if full database fails
- Error Recovery: Robust handling of malformed JSON entries
Expected console output on successful load:
π Loading PsychonautWiki substance database...
π JSON file loaded: 458192 characters
β
Successfully loaded PsychonautWiki database in ~500ms
π Database metrics:
β’ 289 substances
β’ 15 categories
β’ 180+ substances with dosing/duration data
β’ 12 substances with bioavailability data
β’ 150+ substances with interaction warnings
β’ 400+ total routes of administration
- PsychonautWikiDatabase: Singleton database manager with JSON parsing
- SubstanceRepository: Repository pattern for data access
- SubstanceLoader: Service layer for substance loading operations
- SubstanceInfo: Complete substance information
- RouteOfAdministration: Dosing and route-specific data
- BioavailabilityRange: Bioavailability percentage ranges
- DurationRange: Time-based effect duration data
- InteractionData: Substance interaction warnings
- Compose Desktop: Modern declarative UI
- MVVM Pattern: ViewModels for state management
- Responsive Design: Adaptive layouts for different screen sizes
In the NixOS development environment:
# Build the application
gradle build
# Run the application
gradle run
# Run tests
gradle test
# Run all checks (including BDD tests)
gradle check
# Build distribution package
gradle distZipThe project includes comprehensive testing:
- Unit Tests: Core functionality and data models
- Integration Tests: Database loading and parsing
- BDD Tests: Cucumber-based behavior testing
- Kotest: Modern Kotlin testing framework
psychonautwiki-journal/
βββ psychonautwiki-journal-desktop/ # Desktop application
β βββ src/commonMain/kotlin/ # Shared Kotlin code
β β βββ data/ # Data layer (repositories, models)
β β βββ ui/ # UI layer (screens, viewmodels)
β β βββ navigation/ # Navigation logic
β βββ src/commonMain/resources/ # Resources (database JSON)
β βββ src/commonTest/kotlin/ # Shared tests
β βββ src/desktopMain/kotlin/ # Desktop-specific code
βββ psychonautwiki-journal-android/ # Android application (legacy)
βββ flake.nix # NixOS development environment
βββ README.md # This file
- Fixed bioavailability parsing: Created
BioavailabilityRangeto handle complex JSON structures - Fixed duration range parsing: Made
minfield optional for partial data - Enhanced error handling: Robust parsing with graceful fallbacks
- Loading metrics: Comprehensive health monitoring and performance tracking
- Progress indicators: Real-time feedback during database loading
- Error recovery: Partial loading support for malformed entries
- Bioavailability display: Shows bioavailability ranges in substance listings
- Enhanced search: Full-text search across complete database
- Performance optimization: Efficient rendering of large substance lists
This project focuses on harm reduction and evidence-based information. Contributions are welcome for:
- UI/UX improvements
- Additional harm reduction features
- Database optimization
- Testing and documentation
- Accessibility enhancements
- Educational Purpose: This application is for educational and harm reduction purposes only
- Not Medical Advice: Information provided is not medical advice; consult healthcare professionals
- Substance Safety: Promotes responsible use and harm reduction practices
- Data Source: Information sourced from PsychonautWiki, a collaborative harm reduction resource
[License information to be added]
- PsychonautWiki: For providing the comprehensive substance database
- Harm Reduction Community: For evidence-based safety information
- Kotlin & Compose Teams: For excellent development tools
- NixOS Community: For reproducible development environments
π‘οΈ Remember: The safest use is no use. If you choose to use substances, please prioritize harm reduction, start with low doses, test substances when possible, and never use alone.