Rust backendI for SaveCircle — a Stellar-based platform that digitizes community savings circles (Ajo, Chama, Tanda) with on-chain credit scoring and microloans.
# SaveCircle Backend
> **Save Together. Trust the Chain.**
ChainCircle is a Rust backend for Stellar-powered community savings and lending circles. This repository now uses `axum`, `sqlx`, and modern Rust best practices.
---
## Tech Stack
- **Backend:** Rust + Axum
- **Database:** PostgreSQL + SQLx
- **Auth:** JWT
- **Configuration:** dotenv
- **Logging:** tracing
- **Containerization:** Docker + Docker Compose
---
## Project Structure
```
src/
├── auth.rs
├── config.rs
├── db.rs
├── errors.rs
├── main.rs
├── models.rs
└── routes.rs
```
---
## Getting Started
### Prerequisites
- Rust and `cargo`
- PostgreSQL
- Docker (optional)
### Local setup
```bash
git clone
github.com
cd ChainCircle-Backend
cp .env.example .env
# Edit .env with your values
cargo run --release
```
### Running with Docker
```bash
docker-compose up --build
```
The API will be available at `
localhost`.
---
## API Endpoints
| Module | Endpoint | Description |
|---|---|---|
| Auth | `POST /api/v1/auth/register` | Register a new user |
| Auth | `POST /api/v1/auth/login` | Login and get JWT |
| Users | `GET /api/v1/users/me` | Get current user profile |
| Circles | `GET /api/v1/circles` | List sample circles |
| Circles | `POST /api/v1/circles` | Create a new circle |
| Contributions | `POST /api/v1/contributions` | Record a contribution |
| Loans | `POST /api/v1/loans/request` | Request a microloan |
| Payouts | `POST /api/v1/payouts/trigger/:circle_id` | Trigger a payout |
| Credit Score | `GET /api/v1/credit-score` | Retrieve a sample credit score |
---
## Development commands
```bash
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test
```
---
## Contributing
See CONTRIBUTING.md.
---
## License
MIT