This README provides instructions for setting up the Civkit API needed to run a full censorship resistant marketplace.
- c-lightning
- daywalker hold invoice plugin
- nostr relay. nostr-rs-relay preferred
- a domain
- a server to deploy on
Install Prisma CLI:
npm install -g prismaInitialize Prisma in your project:
prisma initUpdate the
schema.prismafile with your model definitions.Generate Prisma client:
prisma generateApply migrations:
prisma migrate dev
Navigate to the frontend directory:
cd path/to/frontendInstall dependencies:
npm installBuild the application:
npm run buildStart development server:
npm run devUpdate the
.envfile with necessary variables (e.g., API URL).
Navigate to the API directory:
cd path/to/apiInstall dependencies:
npm installBuild the application:
npm run buildStart development server:
npm run devGenerate JWT token:
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"Update the
.envfile with the JWT token and other necessary variables.
Navigate to the chat application directory:
cd path/to/chatRun the build script:
./build.shStart the chat application:
./run.sh
Install Nginx:
sudo apt update sudo apt install nginxCreate a new Nginx configuration file:
sudo nano /etc/nginx/sites-available/civkit-frontend-apiAdd the following configuration:
server{listen80;server_name frontend.civkit.africa;location / {proxy_passhttp://127.0.0.1:3001;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection 'upgrade';proxy_set_header Host $host;proxy_cache_bypass$http_upgrade;}}server{listen80;server_name api.civkit.africa;location / {proxy_passhttp://127.0.0.1:3000;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection 'upgrade';proxy_set_header Host $host;proxy_cache_bypass$http_upgrade;}}server{listen80;server_name chat.civkit.africa;location / {proxy_passhttp://127.0.0.1:3456;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection 'upgrade';proxy_set_header Host $host;proxy_cache_bypass$http_upgrade;}}
Enable the configuration:
sudo ln -s /etc/nginx/sites-available/civkit-frontend-api /etc/nginx/sites-enabled/Test Nginx configuration:
sudo nginx -tReload Nginx:
sudo systemctl reload nginxInstall Certbot for SSL:
sudo apt install certbot python3-certbot-nginxObtain SSL certificates:
sudo certbot --nginx -d frontend.civkit.africa -d api.civkit.africa -d chat.civkit.africaFollow the prompts to complete SSL setup.
Remember to replace placeholder values (like port numbers and domain names) with your actual values. This README provides a quick overview of the setup process for each component of the Civkit Africa application. These are the endpoints being consumed by FE:
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/register | Register a new user |
| POST | /api/login | Authenticate a user |
| GET | /api/orders | Fetch all orders |
| POST | /api/orders/take | Take an existing order |
| POST | /api/check-and-create-chatroom | Check and create a chatroom for an order |
| GET | /api/orders/:orderId | Fetch details of a specific order |
| GET | /api/invoice/:orderId | Fetch invoice for a specific order |
| POST | /api/holdinvoicelookup | Check the status of a hold invoice |
| PUT | /api/orders/:orderId | Update a specific order |
| POST | /api/get-invoice | Get or create an invoice |
| POST | /api/taker-invoice/${orderId} | Create a taker invoice for an order |
| POST | /api/payouts | Submit a payout |
| POST | /api/taker-full-invoice/${orderId} | Create a full invoice for a taker |
| GET | /api/full-invoice/${orderId} | Fetch full invoice for an order |
| GET | /api/order/${orderId}/latest-chat-details | Fetch latest chat details for an order |
| GET | /api/currencies.json | Fetch available currencies |
Endpoints not consumed:
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/check-accepted-invoices | Check and update accepted invoices |
| POST | /api/update-accept-offer-url | Update accept-offer URL |
| POST | /api/settle/settle-hold-invoices | Settle hold invoices for an order |
| POST | /api/orders/settle-holdinvoices-by-order | Settle hold invoices by order ID |
| POST | /api/submitToMainstay | Submit data to Mainstay |