Skip to content

kn9w/pars_en_cours

Repository files navigation

Pars en Cours - Student Transportation App

A React Native Expo TypeScript app for connecting students in need of transportation with those who can help, featuring Nostr integration, location-based posts, and real-time messaging.

πŸš€ Project Overview

Pars en Cours (French for "Go To Class") is a decentralized student transportation assistance app that enables students to request help and allows anyone to offer assistance. The app features a Nostr protocol integration, privacy-preserving location sharing, real-time messaging, and full internationalization support.

✨ Features

Core Features

  • Multi-User Type Support - Students can both ask for help and offer assistance; non-students can only offer help
  • Interactive Map Interface - Mapbox-powered map with real-time location services and privacy controls
  • Comprehensive Onboarding - 3-step onboarding process with Nostr key generation/import
  • Floating Action Button - Context-aware expandable button with different options based on user type
  • Nostr Integration - Full decentralized identity and data management using Nostr protocol
  • Real-time Messaging - NIP-04 encrypted direct messages with conversation management
  • Location-Based Posts - Privacy-preserving geohash implementation for approximate location sharing
  • Post Management - Create, view, and manage transportation requests and offers (NIP-99 classified listings)
  • Internationalization - Complete English and French language support with automatic device detection
  • Theme System - Light, dark, and auto theme modes with system preference detection

Technical Features

  • TypeScript - Full type safety with comprehensive interfaces
  • React Navigation - Bottom tabs and stack navigation
  • Mapbox Integration - Professional mapping with custom styling
  • Nostr Protocol - Decentralized identity and data management with custom RelayManager
  • Location Services - GPS with privacy controls and geohash
  • State Management - Context + useReducer for complex state
  • Custom Hooks - Reusable logic for auth, location, Nostr, messaging, and listings
  • Form Validation - Complete validation system
  • AsyncStorage - Local data persistence with caching
  • Real-time Subscriptions - Live updates for messages

πŸ“ Project Structure

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ AppContent.tsx       # Main app wrapper with status bar
β”‚   └── common/              # Reusable UI components
β”‚       β”œβ”€β”€ Button.tsx       # Multi-variant button with loading states
β”‚       β”œβ”€β”€ Input.tsx        # Form input with validation
β”‚       β”œβ”€β”€ CustomAlert.tsx  # Custom alert modal system
β”‚       β”œβ”€β”€ Dropdown.tsx     # Dropdown selection component
β”‚       β”œβ”€β”€ FloatingActionButton.tsx # Context-aware expandable FAB
β”‚       β”œβ”€β”€ QRCodeModal.tsx  # QR code display for Nostr keys
β”‚       └── index.ts         # Component exports
β”œβ”€β”€ screens/
β”‚   β”œβ”€β”€ OnboardingScreen.tsx # 3-step onboarding with Nostr setup
β”‚   β”œβ”€β”€ MapScreen.tsx        # Mapbox-powered interactive map
β”‚   β”œβ”€β”€ MessagesScreen.tsx   # Messages interface (placeholder)
β”‚   β”œβ”€β”€ ProfileScreen.tsx    # User profile with QR code
β”‚   β”œβ”€β”€ ProfileEditScreen.tsx # Profile editing interface
β”‚   └── SettingsScreen.tsx   # App settings and preferences
β”œβ”€β”€ navigation/
β”‚   β”œβ”€β”€ RootNavigator.tsx    # Root navigation with auth flow
β”‚   β”œβ”€β”€ MainStackNavigator.tsx # Main app stack navigation
β”‚   └── BottomTabNavigator.tsx # Bottom tab navigation
β”œβ”€β”€ context/
β”‚   β”œβ”€β”€ AppContext.tsx       # Global state with useReducer
β”‚   └── ThemeContext.tsx     # Theme management (light/dark/auto)
β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ useAuth.ts           # Authentication and user management
β”‚   β”œβ”€β”€ useLocation.ts       # Location services and permissions
β”‚   β”œβ”€β”€ useNostrProfile.ts   # Nostr profile management
β”‚   β”œβ”€β”€ useRelays.ts         # Nostr relay management
β”‚   β”œβ”€β”€ useCustomAlert.ts    # Custom alert system
β”‚   β”œβ”€β”€ useMessages.ts       # NIP-04 direct messaging with real-time subscriptions
β”‚   β”œβ”€β”€ useListings.ts       # NIP-99 classified listings management
β”‚   β”œβ”€β”€ useBookmarks.ts      # Bookmark management
β”‚   └── index.ts             # Hook exports
β”œβ”€β”€ i18n/
β”‚   β”œβ”€β”€ index.ts             # i18next configuration with device detection
β”‚   β”œβ”€β”€ hooks.ts             # Translation hooks
β”‚   β”œβ”€β”€ locales/
β”‚   β”‚   β”œβ”€β”€ en.json          # English translations
β”‚   β”‚   └── fr.json          # French translations
β”‚   └── README.md            # Localization documentation
β”œβ”€β”€ services/
β”‚   └── RelayManager.ts      # Centralized Nostr relay connection management
β”œβ”€β”€ types/
β”‚   └── index.ts             # Comprehensive TypeScript definitions
└── utils/
    β”œβ”€β”€ nostr.ts             # Nostr key generation and validation
    β”œβ”€β”€ nip04.ts             # NIP-04 encryption/decryption for direct messages
    β”œβ”€β”€ giftwrap.ts          # NIP-59 gift wrap implementation (future)
    β”œβ”€β”€ encryption.ts        # Additional encryption utilities
    β”œβ”€β”€ geohash.ts           # Privacy-preserving location utilities
    β”œβ”€β”€ validation.ts        # Form validation helpers
    β”œβ”€β”€ time.ts              # Time formatting utilities
    β”œβ”€β”€ deletion.ts          # Post deletion utilities (NIP-09)
    β”œβ”€β”€ dmRelays.ts          # Direct message relay management
    └── index.ts             # Utility exports

πŸ›  Tech Stack

  • React Native + Expo + TypeScript
  • Mapbox + Nostr Protocol + i18next

πŸš€ Getting Started

Prerequisites

  • Node.js (v20.11.1 or higher)
  • npm or yarn
  • Expo CLI
  • iOS Simulator or Android Emulator (or Expo Go app)

Installation

  1. Clone the repository

    git clone https://github.com/kn9w/pars_en_cours.git
    cd pars_en_cours
  2. Set up environment variables

    cp env.example .env
    # Edit .env with your Mapbox tokens (get them from https://account.mapbox.com/access-tokens/)
  3. Install dependencies

    npm install
  4. Start the development server

    npm start
    # or
    expo start
  5. Run on device/simulator

    • iOS: npm run ios or scan QR code with Camera app
    • Android: npm run android or scan QR code with Expo Go
    • Web: npm run web

Alternative: Development Without Mapbox

For faster development without Mapbox dependencies:

npm run start:no-mapbox

πŸ“± App Screens

Onboarding

3-step process for user type selection, feature introduction, and Nostr key generation/import with smooth animations.

Map

Interactive Mapbox map with real-time location, color-coded markers for posts, geohash privacy, and tap-to-create functionality.

Messages & Conversations

NIP-04 encrypted direct messaging with real-time updates, conversation threads, and automatic profile loading.

Create Post

Form for creating "Ask" or "Give" posts with category selection, location services, configurable geohash precision, and image support.

Post Detail

Full post view with author profile, image carousel, action buttons (contact, bookmark, share), and delete option for post owners.

Profile

User's own Nostr profile with QR code sharing, settings access, and profile editing capabilities.

User Profile

View other users' public profiles with bio, recent posts, and quick contact button.

Bookmarks

Manage saved posts with pull-to-refresh and easy removal.

Settings

Relay management, theme selection (light/dark/auto), language switching, and account settings.

πŸ”§ Key Components

UI Components

  • FloatingActionButton - Context-aware expandable button (Ask/Give options)
  • Button - Multi-variant button with loading states and icons
  • CustomAlert - Themed modal system replacing native alerts
  • QRCodeModal - Nostr key sharing with copy functionality
  • PostCard - Listing display component with image support
  • ProfileName - Reusable profile name display with caching
  • SkeletonLoader - Loading state components
  • Input - Form input with validation
  • Dropdown - Dropdown selection component
  • AppIcon - Custom app icon component

Custom Hooks

  • useAuth - Authentication and user management
  • useMessages - NIP-04 direct messaging with real-time subscriptions
  • useListings - NIP-99 classified listings management
  • useRelays - Nostr relay configuration management
  • useLocation - Location services and permissions
  • useNostrProfile - User's own Nostr profile management
  • useUserProfile - Other users' profiles with smart caching
  • useBookmarks - Bookmark management with AsyncStorage
  • useCustomAlert - Custom alert system

Services

  • RelayManager - Centralized WebSocket connection management for Nostr relays with automatic reconnection

πŸ”’ Privacy Features

  • Geohash Location: Truncated coordinates for approximate location sharing
  • Optional Location: Users control when and how location is shared
  • Nostr Decentralization: No central authority controls user data
  • Key Management: Users control their own cryptographic keys
  • NIP-04 Encryption: End-to-end encrypted direct messages
  • No Data Collection: App doesn't collect personal data centrally
  • Local Storage: Messages and profiles cached locally with AsyncStorage

Completed Features βœ…

  • Nostr Integration: Complete Nostr protocol implementation with custom RelayManager
  • User Authentication: Nostr key-based authentication system with AsyncStorage persistence
  • Onboarding Flow: Comprehensive 3-step onboarding process with key generation/import
  • Real-time Messaging: NIP-04 encrypted direct messages with live subscriptions
  • Post Management: NIP-99 classified listings with create, view, delete, and filter functionality
  • Theme System: Light, dark, and auto theme modes with system preference detection
  • Internationalization: Complete English and French language support with i18next
  • Location Services: GPS integration with privacy controls and geohash implementation
  • Mapbox Integration: Professional mapping solution with custom markers and clustering
  • Custom UI Components: Comprehensive component library with loading states
  • Form Validation: Complete validation system for all user inputs
  • State Management: Context-based state management with useReducer
  • Profile Management: Nostr profile loading, caching, and display with QR codes
  • Relay Management: Add, remove, and test Nostr relays with connection status
  • Bookmark System: Save and manage favorite posts locally

🀝 Contributing

We welcome contributions from the community! Here's how you can help make Pars en Cours better:

πŸš€ Quick Start for Contributors

  1. Fork the repository on GitHub
  2. Clone your fork locally:
    git clone https://github.com/kn9w/pars_en_cours.git
    cd pars_en_cours
  3. Set up environment variables:
    cp env.example .env
    # Edit .env with your Mapbox tokens
  4. Install dependencies:
    npm install
  5. Start development:
    npm start

πŸ› Reporting Issues

  • Use the Issues tab to report bugs
  • Search existing issues before creating new ones
  • Include steps to reproduce, expected behavior, and screenshots if applicable
  • Use issue templates when available

πŸ’‘ Suggesting Features

  • Open a Feature Request issue
  • Describe the feature and its use case
  • Explain how it aligns with the project's goals

Pull Request Process

  1. Create a feature branch: git checkout -b feature/your-feature-name
  2. Make your changes with clear, focused commits
  3. Test thoroughly on both Android and iOS if possible
  4. Update documentation if needed
  5. Submit a pull request with:
    • Clear description of changes
    • Screenshots/videos for UI changes
    • Reference to related issues

🌍 Translation Contributions

Help make the app accessible worldwide! See our Translation Guide for details.

πŸ“„ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.


Connecting students in need of transportation with those who can help

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors