API and milestone engine for Disciplr: programmable time-locked capital vaults on Stellar.
- Health:
GET /api/health— service status and timestamp. - Vaults:
GET /api/vaults— list all vaults (in-memory placeholder).POST /api/vaults— create a vault (body:creator,amount,endTimestamp,successDestination,failureDestination).GET /api/vaults/:id— get a vault by id.
Data is stored in memory for now. Production would use PostgreSQL, a Horizon listener for on-chain events, and a proper milestone/verification engine.
- Node.js + TypeScript
- Express for HTTP API
- Helmet and CORS for security and cross-origin
- Node.js 18+
- npm or yarn
# From repo root
cd disciplr-backend
npm install
npm run devAPI runs at http://localhost:3000. Frontend dev server can proxy /api to this port.
| Command | Description |
|---|---|
npm run dev |
Run with tsx watch (hot reload) |
npm run build |
Compile TypeScript to dist/ |
npm run start |
Run compiled dist/index.js |
npm run lint |
Run ESLint on src |
curl -X POST http://localhost:3000/api/vaults \
-H "Content-Type: application/json" \
-d '{
"creator": "G...",
"amount": "1000",
"endTimestamp": "2025-12-31T23:59:59Z",
"successDestination": "G...",
"failureDestination": "G..."
}'disciplr-backend/
├── src/
│ ├── routes/
│ │ ├── health.ts
│ │ └── vaults.ts
│ └── index.ts
├── package.json
├── tsconfig.json
└── README.md
This directory is a separate git repo. To push to your own remote:
cd disciplr-backend
git remote add origin <your-disciplr-backend-repo-url>
git push -u origin mainReplace <your-disciplr-backend-repo-url> with your actual repository URL.