This repository contains the backend and database setup for the Embedded gaming platform. Content:
- PostgreSQL database running locally via Docker
- Node.js + Express backend + Prisma for schema modeling and database access (Typescript)
embedded-backend/
├── backend/ # Express backend + Prisma client
│ ├── prisma/ # Prisma schema
│ ├── src/routes/ # API routes
│ └── .env # Environment variables
│
└── database/ # Local PostgreSQL setup (Docker)
│ └── docker-compose.yml
│
└── EmbeddedAPI/ # C# DLL to safely call the backend through Unity
- Node.js (>= 18)
- Docker + Docker Compose
- PostgreSQL Client (optional for CLI/GUI)
- Prisma CLI (npx prisma)
From the root of the project:
cd database
docker compose up -dThis will start PostgreSQL locally with:
- User: embedded
- Password: dev
- Database: embedded_dev
- Port: 5432
Accessible at: postgresql://embedded:dev@localhost:5432/embedded_dev
cd ../backend
npm installThen configure your environment:
.env
DATABASE_URL="postgresql://embedded:dev@localhost:5432/embedded_dev"
npx prisma generate
npx prisma migrate dev --name initOptional: view your data with Prisma Studio:
npx prisma studionpm run devAccessible at: http://localhost:3000/api/
Copy EmbeddedAPI/EmbeddedAPI.cs into your Unity project:
Assets/Plugins/EmbeddedAPI.csIn Unity scripts, use it like this:
using UnityEngine;
using EmbeddedAPI;
public class MatchExample : MonoBehaviour
{
async void Start()
{
string wallet = "test_wallet_123";
string tx = "fake_tx_abc";
string matchId = await API.RegisterPlayerAsync(wallet, tx);
Debug.Log("Match ID: " + matchId);
await API.ReportMatchResultAsync(matchId, wallet, "test_wallet_456");
}
}MIT – Copyright © Embedded