Get the Stellar Micro-Donation API running locally in under 10 minutes.
- Node.js v20 or higher (
node --versionmust printv20.x.xor later) - npm v10 or higher
- Git
- SQLite3 (usually pre-installed on macOS and most Linux distributions)
Verify your Node version:
node --version # must be ≥ v20.0.0 npm --version # must be ≥ v10.0.0
git clone https://github.com/Manuel1234477/Stellar-Micro-Donation-API.git
cd Stellar-Micro-Donation-API
npm installThe API requires a 64-character hex encryption key for memo encryption and sensitive data at rest.
npm run generate-keyCopy the printed value — you will need it in the next step.
cp .env.example .envOpen .env and set at minimum:
PORT=3000
STELLAR_NETWORK=testnet
MOCK_STELLAR=true
API_KEYS=dev_key_123
ENCRYPTION_KEY=<paste the 64-char hex value from step 2 here>MOCK_STELLAR=true skips all real blockchain calls — no Stellar account or funded wallet is needed for local development.
Initialize (creates the database file and base tables):
npm run init-dbRun migrations (applies all incremental schema changes):
npm run migrateBoth commands are idempotent — safe to re-run.
npm startThe API is now available at http://localhost:3000.
Expected output:
Server running on port 3000
Mock Stellar mode: enabled
For development with auto-reload on file changes, use
npm run devinstead.
curl http://localhost:3000/healthExpected response:
{ "status": "ok" }curl -s -X POST http://localhost:3000/donations \
-H "Content-Type: application/json" \
-H "X-API-Key: dev_key_123" \
-d '{
"senderPublicKey": "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN",
"recipientPublicKey": "GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H",
"amount": "10.00"
}' | jq .A successful response returns HTTP 201 with the created donation object:
{
"id": 1,
"senderPublicKey": "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN",
"recipientPublicKey": "GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H",
"amount": 10,
"status": "completed",
...
}Note: The base path for the API is
/(no/api/v1prefix). Use/donations,/wallets,/health, etc.
npm testAll tests use an isolated in-memory SQLite database — no cleanup needed between runs.
- API Reference — all endpoints with request/response examples
- API Examples — copy-paste curl commands for every flow
- Authentication Guide — API key setup and RBAC
- Architecture Overview — how the system fits together
- SEP Compliance — SEP-10 web auth and federation
- Database Schema — ER diagram and per-table column reference
- Stellar Concepts — blockchain background for new contributors
- Deployment Guide — Docker, bare metal, and cloud
| Problem | Fix |
|---|---|
node: version must be ≥ 20 |
Install Node.js 20+ from https://nodejs.org |
| Port in use | Set PORT=3001 in .env |
API_KEYS missing error |
Add API_KEYS=dev_key_123 to .env |
ENCRYPTION_KEY is required |
Run npm run generate-key and add the value to .env |
SQLITE_ERROR: no such table |
Run npm run init-db && npm run migrate |
| Stellar network errors | Set MOCK_STELLAR=true in .env |
| Dependency issues | rm -rf node_modules && npm install |
npm start exits immediately |
Run npm run validate-env to see which variables are missing |
For a comprehensive troubleshooting guide, see docs/DEVELOPER_TROUBLESHOOTING_GUIDE.md.