PesaNest API is a Go-powered backend for managing SACCO and Chama operations, built with DuckDB for lightweight data storage and BetterAuth for secure authentication. It supports member and group management, contribution and loan tracking, MPesa integration for payments, and SMS notifications via Africa’s Talking.
# PesaNest Backend
MVP API for PesaNest (SACCO/Chama management). Backend in Go, DB SQLite, Auth via JWT.
## Features
- User registration and authentication (JWT)
- Group management (SACCO/Chama)
- Member management
- Contribution tracking
- Loan management and repayments
- SMS notifications via Africa's Talking
- MPesa payment webhooks
## Quick Setup
Run the setup script:
```bash
setup.bat
```
Or manually:
1. Install dependencies:
```bash
go mod tidy
```
2. Create `.env` file:
```
PORT=8080
JWT_SECRET=your-secret-key
AFRICASTALKING_USERNAME=your-username
AFRICASTALKING_API_KEY=your-api-key
MPESA_CONSUMER_KEY=your-consumer-key
MPESA_CONSUMER_SECRET=your-consumer-secret
DATABASE_PATH=./pesanest.db
```
3. Run the application:
```bash
go run main.go
```
## API Documentation
The API follows the OpenAPI 3.0 specification defined in `openapi-pesanest.yaml`.
## Project Structure
```
.
├── internal/
│ ├── auth/ # JWT authentication
│ ├── config/ # Configuration management
│ ├── database/ # Database connection & migrations
│ ├── handlers/ # HTTP request handlers
│ ├── middleware/ # Auth & CORS middleware
│ ├── models/ # Data models & DTOs
│ └── services/ # Business logic services
├── main.go # Application entry point
├── setup.bat # Windows setup script
├── Makefile # Build & development tasks
├── .env.example # Environment variables template
├── go.mod # Go module dependencies
└── README.md # This file
```
"# api.pesanest"
"# api.pesanest"