Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Stellar Tags is a payment platform that combines a Soroban smart contract, a Nod

## Architecture Map

The following diagram maps exactly how data flows between the user, Vercel, Railway, and the Stellar network.
The following diagram maps exactly how data flows between the user, Render, and the Stellar network.

```text
[ User / Browser ]
Expand All @@ -29,7 +29,7 @@ The following diagram maps exactly how data flows between the user, Vercel, Rail
| HTTP API Calls (via VITE_API_BASE)
v
[ stellar-payment-platform ] <---> [ PostgreSQL Database ]
(server.js: Server router on Railway) (via Prisma ORM: User/payment layout)
(server.js: Server router on Render) (via Prisma ORM: User/payment layout)
|
| Stellar Network / RPC
v
Expand Down Expand Up @@ -127,6 +127,12 @@ Useful Prisma commands (run from `stellar-payment-platform/`):
> `.env` is gitignored — never commit real credentials. Each contributor keeps
> their own local `DATABASE_URL`.

### Render deployment

The repository includes a [render.yaml](render.yaml) blueprint for the backend API and its PostgreSQL database. When you deploy from Render, import the blueprint or create the service from the repo so `DATABASE_URL` is injected automatically from the managed database.

If you deploy the backend without the blueprint, make sure the web service has a PostgreSQL `DATABASE_URL` secret configured before startup. The container runs Prisma migrations on boot, so the variable must already exist.

### Smart contract (Soroban)

```bash
Expand Down Expand Up @@ -167,6 +173,8 @@ To ensure a seamless local developer installation requiring zero guesswork, plea
- `LOG_MAX_SIZE` - (Optional) Size at which the active log file rotates. Defaults to `20m`.
- `LOG_MAX_FILES` - (Optional) Retention for rotated files, as a count (`30`) or an age (`14d`). Defaults to `14d`.

For Render deployments, make sure the web service has `DATABASE_URL` set in its environment or linked from a Render PostgreSQL instance before startup. The container runs `prisma migrate deploy` during boot, so the variable must be available at runtime.

## Logging

The server logs through a shared [Winston](https://github.com/winstonjs/winston) logger
Expand Down
24 changes: 24 additions & 0 deletions render.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
databases:
- name: stellar-tags-db
databaseName: stellar_tags
user: stellar_tags
plan: basic-256mb

services:
- type: web
name: stellar-tags-api
runtime: docker
dockerfilePath: ./Dockerfile-backend
dockerContext: .
autoDeployTrigger: commit
plan: starter
healthCheckPath: /health
envVars:
- key: NODE_ENV
value: production
- key: LOG_DIR
value: /app/logs
- key: DATABASE_URL
fromDatabase:
name: stellar-tags-db
property: connectionString
7 changes: 7 additions & 0 deletions stellar-payment-platform/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ set -e
# this schema (`url` in the datasource block, the "metrics" preview feature).
PRISMA="./node_modules/.bin/prisma"

if [ -z "${DATABASE_URL:-}" ]; then
echo "ERROR: DATABASE_URL is not set." >&2
echo "Render must provide a PostgreSQL connection string to this service before startup." >&2
echo "Link a Render PostgreSQL instance or set DATABASE_URL in the service environment." >&2
exit 1
fi

if [ ! -x "$PRISMA" ]; then
echo "ERROR: Prisma CLI not found at $PRISMA." >&2
echo "It must be a production dependency so it survives 'npm prune --omit=dev'." >&2
Expand Down
Loading