Backend API server for the ACBU (African Currency Basket Unit) platform.
- Runtime: Node.js 20+ with TypeScript
- Framework: Express.js
- Database: Prisma Accelerate (managed PostgreSQL; no local PostgreSQL)
- Cache: MongoDB Atlas (managed; no local MongoDB)
- Message Queue: RabbitMQ
- Testing: Jest
- Logging: Winston
- Development: Nodemon
- Node.js 20 or higher
- Docker and Docker Compose
- npm or yarn
cd backend
npm installCopy the example environment file and configure it:
cp .env.example .envEdit .env and configure:
- Prisma Accelerate URL (
PRISMA_ACCELERATE_URL) as the runtime database connection;DATABASE_URLfor migrations if your setup uses it - MongoDB Atlas connection string (
MONGODB_URI), e.g.mongodb+srv://... - RabbitMQ URL (or use a managed queue)
- API keys for fintech partners (Flutterwave, etc.)
- JWT secrets
- Other service configurations
The app uses Prisma Accelerate and MongoDB Atlas; it does not require local PostgreSQL or MongoDB. You need a RabbitMQ instance (e.g. from Docker or a managed provider).
To run only RabbitMQ via Docker:
docker-compose up -d rabbitmqRabbitMQ will be on port 5672 (Management UI: http://localhost:15672).
The same docker-compose.yml can start local PostgreSQL and MongoDB for migrations or local dev; use those services only if you need them.
Initialize Prisma and run migrations:
# Generate Prisma Client
npm run prisma:generate
# Run database migrations
npm run prisma:migrate
# (Optional) Seed database
npm run prisma:seednpm run devThe server will start on http://localhost:3000 (or the port specified in .env).
Nodemon will automatically restart the server when you make changes to the code.
npm run dev- Start development server with hot reloadingnpm run build- Build TypeScript to JavaScriptnpm start- Start production servernpm test- Run testsnpm run test:watch- Run tests in watch modenpm run test:coverage- Run tests with coverage reportnpm run lint- Run ESLintnpm run lint:fix- Fix ESLint errorsnpm run format- Format code with Prettiernpm run format:check- Check code formattingnpm run prisma:generate- Generate Prisma Clientnpm run prisma:migrate- Run database migrationsnpm run prisma:studio- Open Prisma Studionpm run prisma:seed- Seed database with initial data
backend/
├── src/
│ ├── config/ # Configuration files
│ ├── controllers/ # Route controllers
│ ├── services/ # Business logic services
│ ├── models/ # Data models
│ ├── routes/ # API routes
│ ├── middleware/ # Express middleware
│ ├── utils/ # Utility functions
│ └── types/ # TypeScript type definitions
├── tests/ # Test files
├── prisma/ # Prisma schema and migrations
├── scripts/ # Utility scripts
├── docker-compose.yml # Docker services configuration
└── package.json
Once the server is running, API documentation is available at:
- Swagger UI:
http://localhost:3000/api-docs
Segment routes (require API key with segment scope): /v1/p2p, /v1/sme, /v1/international, /v1/salary, /v1/enterprise, /v1/savings, /v1/lending, /v1/gateway, /v1/bills. For a full list of routes and smart contracts, see the repo docs: API and Contracts Reference.
View and edit database data using Prisma Studio:
npm run prisma:studioCreate a new migration:
npm run prisma:migrateRun all tests:
npm testRun tests with coverage:
npm run test:coverageFull list: See ENV_VARS.md. No mock data; all values must be real or explicitly empty.
Required: DATABASE_URL (migrations / fallback), MONGODB_URI (MongoDB Atlas), RABBITMQ_URL, JWT_SECRET. Runtime DB: Prisma Accelerate via PRISMA_ACCELERATE_URL (see ENV_VARS.md).
Fintech: Flutterwave (FLUTTERWAVE_SECRET_KEY, etc.), Paystack (PAYSTACK_SECRET_KEY), MTN MoMo (MTN_MOMO_SUBSCRIPTION_KEY, MTN_MOMO_API_USER_ID, MTN_MOMO_API_KEY). Optional: FINTECH_CURRENCY_PROVIDERS.
Stellar: STELLAR_NETWORK, STELLAR_SECRET_KEY, and after deploy: CONTRACT_ORACLE, CONTRACT_RESERVE_TRACKER, CONTRACT_MINTING, CONTRACT_BURNING. Optional for segment features: CONTRACT_SAVINGS_VAULT, CONTRACT_LENDING_POOL, CONTRACT_ESCROW.
With Prisma Accelerate and MongoDB Atlas, the app does not use local PostgreSQL or MongoDB. Only RabbitMQ is required from Docker (or use a managed RabbitMQ). The compose file also defines optional postgres and mongodb services for migrations or local development.
- RabbitMQ Management UI:
http://localhost:15672(username: acbu, password: acbu_password) - Optional local Postgres:
localhost:5432(if runningdocker-compose up -d postgres) - Optional local MongoDB:
localhost:27017(if runningdocker-compose up -d mongodb)
docker-compose downdocker-compose logs -fGitHub Actions CI pipeline runs on:
- Push to
mainordevelopbranches - Pull requests to
mainordevelop
The CI pipeline:
- Runs linter and formatter checks
- Runs all tests
- Builds the project
- Validates database migrations
- Create a feature branch
- Make your changes
- Run tests and linter:
npm test && npm run lint - Commit and push
- Create a pull request
Apache License 2.0