A community-based lending platform with blockchain integration for transparent and secure loan management in African communities.
Chamaa.API is an open-source platform enabling community-driven savings groups (chamas) with transparent ledger systems, blockchain-secured transactions, and mobile-first access. The project implements a full-stack monorepo with a Spring Boot backend and Android mobile application.
- User Management - Registration, authentication, and profile management
- Group Management - Create and manage community lending groups (chamas)
- Loan System - Request, approve, and track loans within groups
- Wallet & Transactions - Deposit, withdraw, and transaction history
- Blockchain Integration - Polygon network integration for transparent transactions
- Android Mobile App - Native Android application with offline support
- Payment Integration - M-Pesa, Airtel Money, PayPal support (planned)
chamaa.api/
βββ apps/
β βββ backend/ # Spring Boot REST API
β β βββ src/main/java/com/chamaa/
β β β βββ blockchain/ # Blockchain integration (Web3j)
β β β βββ common/ # Shared utilities & exceptions
β β β βββ config/ # Configuration classes
β β β βββ controllers/ # REST API endpoints
β β β βββ entities/ # JPA entities
β β β βββ repositories/ # Data access layer
β β β βββ services/ # Business logic
β β βββ pom.xml
β β
β βββ android/
β βββ ChamaApp/ # Android mobile app
β βββ app/
β βββ src/main/java/com/example/chama/
β βββ network/ # Retrofit + OkHttp client
β βββ models/ # Data models
β βββ ui/ # Jetpack Compose screens
β
βββ docs/ # Documentation
β βββ api-spec.md # API specification
β βββ architecture.md # Architecture overview
β βββ blockchain.md # Blockchain integration guide
β βββ DATABASE_SETUP.md # Database configuration
β βββ DOCKER_GUIDE.md # Docker deployment guide
β βββ CI_CD_PIPELINE.md # CI/CD documentation
β
βββ infra/ # Infrastructure configurations
βββ .github/ # GitHub Actions workflows
βββ README.md # This file
βββ ROADMAP.md # Project roadmap
βββ CONTRIBUTING.md # Contribution guidelines
βββ LICENSE # MIT License
| Component | Technology |
|---|---|
| Framework | Spring Boot 3.2 |
| Language | Java 17+ |
| Database | PostgreSQL (prod), H2 (dev) |
| ORM | Spring Data JPA / Hibernate |
| Security | Spring Security + Firebase Auth |
| Blockchain | Web3j (Polygon) |
| Build Tool | Maven |
| Component | Technology |
|---|---|
| Language | Kotlin |
| UI Framework | Jetpack Compose |
| Architecture | MVVM |
| Networking | Retrofit 2 + OkHttp |
| Local Database | Room |
| DI | Hilt (planned) |
| Build Tool | Gradle (Kotlin DSL) |
| Tool | Version | Notes |
|---|---|---|
| Java | 17+ | Required for backend |
| Maven | 3.8+ | For backend build |
| Android Studio | Ladybug+ | For Android development |
| JDK | 11+ | For Android build |
| Git | 2.0+ | Version control |
| Docker | 24+ | Optional, for containerized deployment |
-
Clone the repository
git clone https://github.com/flow-pie/chamaa.api.git cd chamaa.api -
Configure environment variables
cp .env.example .env # Edit .env with your configuration -
Run the backend
cd apps/backend ./mvnw spring-boot:runThe API will be available at
http://localhost:8080/api -
Run tests
cd apps/backend ./mvnw clean test
-
Open in Android Studio
apps/android/ChamaApp -
Build the debug APK
cd apps/android/ChamaApp ./gradlew assembleDebug -
Install on emulator/device
./gradlew installDebug
Note: For emulator, the app connects to host machine at
10.0.2.2:8080
# Backend only with H2 (development)
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
# Full stack with PostgreSQL
docker-compose upSee DOCKER_GUIDE.md for detailed Docker configuration.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/users |
Create new user |
| GET | /api/users/{id} |
Get user by ID |
| GET | /api/users |
List all users |
| PUT | /api/users/{id} |
Update user |
| DELETE | /api/users/{id} |
Delete user |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/groups |
Create new group |
| GET | /api/groups/{id} |
Get group by ID |
| GET | /api/groups |
List all groups |
| PUT | /api/groups/{id} |
Update group |
| DELETE | /api/groups/{id} |
Delete group |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/loans |
Request loan |
| GET | /api/loans/{id} |
Get loan by ID |
| GET | /api/loans |
List all loans |
| PUT | /api/loans/{id}/approve |
Approve loan |
| PUT | /api/loans/{id}/reject |
Reject loan |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/wallets/{userId} |
Get wallet balance |
| POST | /api/wallets/{userId}/deposit |
Deposit funds |
| POST | /api/wallets/{userId}/withdraw |
Withdraw funds |
| GET | /api/wallets/{userId}/transactions |
Transaction history |
# Create a user
curl -X POST http://localhost:8080/api/users \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+254712345678"
}'
# Create a group
curl -X POST http://localhost:8080/api/groups \
-H "Content-Type: application/json" \
-d '{
"name": "Community Savings",
"description": "Monthly savings group",
"creatorId": 1,
"targetAmount": 10000.0
}'
# Request a loan
curl -X POST http://localhost:8080/api/loans \
-H "Content-Type: application/json" \
-d '{
"borrowerId": 1,
"groupId": 1,
"amount": 5000.0,
"durationInMonths": 12,
"purpose": "Business expansion"
}'| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 8080 |
DB_URL |
PostgreSQL connection URL | - |
DB_USERNAME |
Database username | - |
DB_PASSWORD |
Database password | - |
JPA_DDL_AUTO |
JPA schema strategy | create-drop |
POLYGON_RPC_URL |
Polygon RPC endpoint | - |
POLYGON_CHAIN_ID |
Polygon chain ID | 80001 |
LOG_LEVEL_ROOT |
Root logging level | INFO |
# Development (H2 in-memory)
./mvnw spring-boot:run
# Production (PostgreSQL)
SPRING_PROFILES_ACTIVE=prod ./mvnw spring-boot:runSee .env.example for all available configuration options.
- Backend: Follows Spring Boot conventions, Google Java Style
- Android: Kotlin coding conventions, Jetpack Compose guidelines
# Backend unit tests
cd apps/backend
./mvnw test
# Backend tests with coverage report
./mvnw clean test jacoco:report
# Run specific test class
./mvnw test -Dtest=UserServiceTest
# Run specific test method
./mvnw test -Dtest=UserServiceTest#testCreateUserThe application uses the following core entities:
- User - User accounts with authentication
- Group - Community lending groups
- Loan - Loan records within groups
- Wallet - User wallet with balance tracking
- Transaction - Transaction history
See DATABASE_SETUP.md for detailed schema documentation.
We welcome contributions! Please read our Contributing Guidelines before submitting PRs.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run tests and ensure code quality
- Commit with conventional commits:
git commit -m "feat: add new feature" - Push and create a Pull Request
| Label | Description |
|---|---|
good first issue |
Beginner-friendly tasks |
help wanted |
Community assistance needed |
backend |
Backend/API work |
android |
Android app development |
blockchain |
Blockchain integration |
documentation |
Docs improvements |
We follow Conventional Commits:
<type>(<scope>): <description>
Types: feat, fix, docs, style, refactor, test, chore
Example:
feat(wallet): add transaction history endpoint
fix(api): resolve user authentication bug
docs(readme): update setup instructions
The project is organized into 8 phases. See ROADMAP.md for detailed progress and future plans.
| Phase | Focus | Status |
|---|---|---|
| 1 | Project Setup | Complete |
| 2 | Infrastructure | In Progress |
| 3 | Core API Features | Planned |
| 4 | Blockchain Layer | Planned |
| 5 | Governance & Voting | Planned |
| 6 | Mobile App (Android) | In Progress |
| 7 | DevOps & Scaling | Planned |
| 8 | Long-term Goals | Planned |
- π API Documentation
- ποΈ Architecture Guide
- βοΈ Blockchain Integration
- π³ Docker Guide
- π Database Setup
- π CI/CD Pipeline
- π¬ Discord
- π» GitHub Discussions
- π Issue Tracker
This project is licensed under the MIT License - see LICENSE for details.
- Spring Boot
- Jetpack Compose
- Web3j
- All contributors and community members
Built with β€οΈ by the Chamaa community