StellarKraal enables livestock-backed loans on the Stellar network. Animals are registered as collateral and borrowers can request loans against their appraised value, with on-chain loan lifecycle management and liquidation protection.
flowchart LR
subgraph Frontend
F[Next.js frontend] -->|HTTP| B[Backend API]
end
subgraph Backend
B -->|SQL| DB[(SQLite database)]
B -->|RPC| S[Soroban smart contract]
end
subgraph Contracts
S -->|WASM| W[(Stellar contract)]
end
- Frontend: React + Next.js 14 with Tailwind CSS.
- Backend: Node.js + TypeScript + Express.
- Smart contract: Rust using the Soroban SDK.
- Infrastructure: Docker, Docker Compose, local SQLite database.
- Node.js 20+
- npm
- Docker & Docker Compose (for containerized setup)
- Rust toolchain and
stellar-clifor contract work - Freighter browser extension for wallet integration
git clone https://github.com/<your-username>/StellarKraal-.git
cd StellarKraal-
cp .env.example .envCreate a .env file in the project root containing:
| Variable | Description | Example |
|---|---|---|
NEXT_PUBLIC_NETWORK |
Stellar network to use | testnet |
RPC_URL |
Soroban JSON-RPC endpoint | https://soroban-testnet.stellar.org |
CONTRACT_ID |
Deployed Soroban contract ID | G... |
PORT |
Backend service port | 3001 |
NEXT_PUBLIC_API_URL |
Frontend API base URL | http://localhost:3001 |
docker-compose up --buildAccess:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:3001
cd backend
npm install
npm run build
npm startcd frontend
npm install
npm run devcd contracts/stellarkraal
cargo testPORT already in use: stop the process using the port or changePORTin.env.Cannot connect to RPC_URL: verify network and RPC endpoint reachability.npm testfailures: ensure dependencies are installed and the correct Node.js version is active.Docker builderrors: rebuild after clearing caches withdocker-compose build --no-cache.
This repository uses a documented contribution workflow. See CONTRIBUTING.md for branch naming, commit style, PR template, and code review expectations.
- Branch created from latest
main - Commit messages follow Conventional Commits
- Tests run successfully locally
- Documentation updated when necessary
Run the following from the repository root:
npm run test:contract
npm run test:backend
npm run test:frontend| Document | Description |
|---|---|
| Liquidation Mechanism | Health factor formula, liquidation threshold, partial liquidation examples |
Key design decisions are documented as ADRs in docs/adr/.
| ADR | Title | Status |
|---|---|---|
| ADR-001 | Use Soroban for On-Chain Loan Lifecycle Management | Accepted |
| ADR-002 | JWT-Based Authentication Strategy | Accepted |
| ADR-003 | SQLite as the Off-Chain Database | Accepted |
| ADR-004 | Next.js 14 + Tailwind CSS for the Frontend | Accepted |
To add a new ADR, copy docs/adr/template.md, increment the number, fill in all sections, and add a row to the table above.
MIT Β© StellarKraal