A Full-Stack Decentralized savings circle application built on the Stellar Network. Enables groups of people to pool money, take turns receiving lump sums, vote on governance decisions, and manage contributions with full transparency through Smart Contracts.
Ajo (or Esusu in West African cultures) is a traditional savings circle where members pool money and take turns receiving the total amount. Stellar Ajo brings this ancient concept to Web3 using:
.
├── app/
│ ├── api/ # Next.js API routes
│ │ ├── auth/ # Authentication endpoints
│ │ └── circles/ # Circle management APIs
│ ├── auth/ # Authentication pages
│ │ ├── login/
│ │ └── register/
│ ├── circles/ # Circle pages
│ │ ├── create/
│ │ └── [id]/
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/
│ ├── ui/ # shadcn/ui components
│ └── wallet-button.tsx # Wallet connection component
├── contracts/
│ └── ajo-circle/ # Soroban smart contract
│ ├── src/
│ │ └── lib.rs # Contract implementation
│ └── Cargo.toml
├── lib/
│ ├── auth.ts # Authentication utilities
│ ├── prisma.ts # Prisma client
│ ├── stellar-config.ts # Stellar SDK configuration
│ └── wallet-context.tsx # Wallet context provider
├── prisma/
│ └── schema.prisma # Database schema
├── public/ # Static assets
└── scripts/ # Utility scripts
# Install dependencies
pnpm install
# Set up environment variables
cp .env.example .env.local
Edit .env.local with your configuration:
# Stellar Network (use testnet for development)
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org
NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
# Soroban RPC
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
NEXT_PUBLIC_AJO_CONTRACT_ADDRESS=<your-contract-address>
# Database
DATABASE_URL=file:./dev.db
# JWT Secret (change for production!)
JWT_SECRET=your-super-secret-jwt-key-change-this
# API
NEXT_PUBLIC_API_URL=http://localhost:3000/api
# Generate Prisma client
pnpm prisma generate
# Create database and run migrations
pnpm prisma migrate dev
# Seed database (optional)
pnpm prisma db seed
# Install Soroban CLI
# See: https://developers.stellar.org/docs/smart-contracts/getting-started/setup
# Build the contract
cd contracts/ajo-circle
cargo build --target wasm32-unknown-unknown --release
# Deploy to testnet (requires Stellar account with XLM)
# Follow Soroban deployment guide with the compiled WASM
# Update NEXT_PUBLIC_AJO_CONTRACT_ADDRESS in .env.local
pnpm dev
Open http://localhost:3000 to view the app.
POST /api/auth/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "SecurePassword123!",
"firstName": "John",
"lastName": "Doe"
}
POST /api/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "SecurePassword123!"
}
POST /api/circles
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Office Savings Circle",
"description": "Monthly savings circle for office team",
"contributionAmount": 100.50,
"contributionFrequencyDays": 7,
"maxRounds": 12
}
GET /api/circles
Authorization: Bearer <token>
GET /api/circles/:id
Authorization: Bearer <token>
POST /api/circles/:id/contribute
Authorization: Bearer <token>
Content-Type: application/json
{
"amount": 100.50
}
The Soroban smart contract (contracts/ajo-circle/src/lib.rs) implements:
initialize_circle() - Create a new circleadd_member() - Add member to circlecontribute() - Record member contributionclaim_payout() - Claim payout when it’s member’s turnpartial_withdraw() - Withdraw portion with penaltyget_circle_state() - Query current circle statusget_member_balance() - Query member detailsget_members() - List all memberscd contracts/ajo-circle
# Build WASM
cargo build --target wasm32-unknown-unknown --release
# The compiled WASM will be in:
# target/wasm32-unknown-unknown/release/ajo_circle.wasm
git add .
git commit -m "Initial commit"
git push origin main
Test SDF Network ; September 2015https://horizon-testnet.stellar.orghttps://soroban-testnet.stellar.orgPublic Global Stellar Network ; September 2015https://horizon.stellar.orghttps://soroban.stellar.orgBefore mainnet deployment:
The application uses Prisma ORM with the following main tables:
See prisma/schema.prisma for complete schema details.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
For issues, questions, or suggestions, please open an issue on GitHub.
Built with ❤️ for communities saving together.