This is the core shared library component of the Namma Yatri project. It provides essential functionality, types, and interfaces that are used across various services in the Namma Yatri ecosystem.
The shared kernel library serves as the foundation for the Namma Yatri platform, providing:
-
Database Layer (
src/Kernel/Beam/
)- PostgreSQL connection management
- Redis integration
- Beam ORM utilities and types
- Common database functions and queries
-
External Service Integrations (
src/Kernel/External/
)- Payment processing
- Communication services (SMS, WhatsApp, Call)
- Maps and location services
- Verification services (Aadhaar, Background checks)
- Multi-modal transportation integration
- Incident reporting
- Notification systems
-
Core Utilities (
src/Kernel/Utils/
)- Common data types and interfaces
- Error handling and logging
- Configuration management
- Encryption utilities
- Serviceability checks
-
Internal APIs (
src/Kernel/InternalAPI/
)- Shared API types and interfaces
- Common API utilities
-
Storage Layer (
src/Kernel/Storage/
)- Clickhouse integration (both V1 and V2)
- Redis integration via Hedis
- SQL query building with Esqueleto
- Beam ORM integration
- Common storage queries and utilities
src/
└── Kernel/
├── Beam/ # Database operations and ORM
├── External/ # External service integrations
│ ├── Payment/ # Payment gateway integrations
│ ├── SMS/ # SMS service integrations
│ ├── Maps/ # Maps and location services
│ └── Verification/# Verification services
├── InternalAPI/ # Internal API definitions
├── Storage/ # Storage utilities
├── Types/ # Common type definitions
├── Utils/ # Utility functions
└── Prelude.hs # Custom prelude with common imports
- Type-safe database queries using Beam ORM
- Connection pooling and management
- Redis caching utilities
- Common database functions and utilities
- Payment gateway integrations
- Communication services (SMS, WhatsApp, Voice calls)
- Maps and location services
- Verification services (Aadhaar, Background checks)
- Multi-modal transportation integration
- Incident reporting system
- Notification delivery system
- Common data types and interfaces
- Error handling and logging
- Configuration management
- Encryption utilities
- Serviceability checks
- Randomization utilities
- Nix (version 2.4 or later)
- Haskell (managed via Nix)
- direnv (optional)
- PostgreSQL (for local development)
- Redis (for local development)
-
Clone the Namma Yatri repository:
git clone https://github.com/nammayatri/nammayatri.git cd nammayatri/Backend/shared-kernel
-
Set up the development environment:
nix develop
-
Configure environment variables:
direnv allow
-
Build the library:
# Choose one of the following commands: cabal build # or nix build # or cabal repl all
-
Run tests:
cabal test
- Place new database types in
src/Kernel/Beam/Types/
- Add external service integrations in
src/Kernel/External/
- Put utility functions in
src/Kernel/Utils/
- Define common types in
src/Kernel/Types/
The project uses:
- ormolu for code formatting
- hlint for linting
- Pre-commit hooks for automated checks
Please read the Namma Yatri Contributing Guidelines before submitting changes.
Key points:
- Follow the existing code style
- Add tests for new functionality
- Update documentation
- Ensure all tests pass
- Update CHANGELOG.md for significant changes
This project is licensed under the AGPL License - see the LICENSE.md file for details.
For support:
- Check the Namma Yatri documentation
- Search existing issues
- Create a new issue if needed