FundSecure is a fundraising platform that allows users to create projects, receive donations/tips securely using the Interledger Protocol (ILP), and leverages OpenAI's DALL·E 3 for image generation. The platform ensures secure transactions and seamless integration between the frontend and backend services.
Click the image to view the video
FundSecure enables users to create fundraising projects and receive donations through a secure and efficient process:
- User Interaction: Users access the platform to create or view fundraising projects.
- Project Creation: Users can create projects, providing details and using DALL·E 3 to generate images.
- Donations: Donors can tip or donate to projects securely via ILP.
- Payment Processing: Payments are processed through the ILP Express server, ensuring fast and secure transactions.
- Data Management: All project and transaction data are managed using Prisma ORM with a MSSQL database.
FundSecure integrates with OpenAI's DALL·E 3 to allow users to generate unique images for their fundraising projects. This feature enhances project presentations and helps attract more donors.
graph LR
A[User] -- Access --> B[Frontend NextJS]
B -- API Calls --> C[Backend ExpressJS]
C -- ORM --> D[Prisma]
D -- Database --> E[MSSQL]
C -- Payments --> F[ILP Express Server]
F -- Payments --> H[Rafiki Wallet]
C -- OpenAI API --> I[DALL·E 3]
sequenceDiagram
participant User
participant Frontend as Frontend NextJS
participant Backend as Backend ExpressJS
participant Prisma as PRISMA ORM
participant MSSQL as MSSQL DB
participant ILPServer as ILP Express Server
participant TigerBeetleDB as TigerBeetleDB Ledger
participant RafikiWallet as Rafiki Wallet Payments
participant OpenAI as OpenAI DALL·E 3
User->>Frontend: Access fundraising platform
Frontend->>Backend: Submit donation/tip
Backend->>Prisma: Save transaction request
Prisma->>MSSQL: Store transaction details
Backend->>ILPServer: Initiate payment processing
ILPServer->>RafikiWallet: Process payment via Interledger
RafikiWallet->>ILPServer: Confirm payment
ILPServer->>Backend: Payment status update
Backend->>Frontend: Notify User of success
User->>Frontend: Requests image generation
Frontend->>OpenAI: Generate image with DALL·E 3
OpenAI->>Frontend: Return generated image
Frontend->>User: Display generated image
Ensure you have the following installed:
- Node.js (v16 or higher)
- Docker (for microservices)
- MSSQL (locally or via a cloud database)
- Prisma (ORM)
- npm (Node Package Manager)
-
Clone the repository:
git clone https://github.com/ADGSTUDIOS/InterledgerHackathon cd InterledgerHackathon
-
Install dependencies:
npm install cd ilp && npm install
-
Configure environment variables:
Create a
.env
file in the root directory and set your environment variables.Example
.env
file:GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret NEXTAUTH_SECRET=your_nextauth_secret NEXTAUTH_URL=http://localhost:3000 OPENAI_API_KEY=your_openai_api_key
Note: Replace the placeholders with your actual credentials.
-
Set up the database:
Run Prisma migrations to set up the MSSQL database schema:
npx prisma db push
-
Run Docker (for microservices):
Start the Docker containers using Docker Compose:
docker-compose up
-
Start the development server:
Launch the app in development mode:
npm run dev
-
Access the app:
Visit http://localhost:3000 in your browser to access the app.
Run the following command to build the app for production:
npm run build
Start the app in production mode:
npm start
The project uses npm scripts defined in the package.json
file to streamline development and production tasks, utilizing concurrently
to run multiple commands at once.
"scripts": {
"dev": "prisma generate && concurrently \"next dev\" \"node ilp/server.js\"",
"build": "prisma generate && prisma db push && next build",
"format:write": "prettier --write \"**/*.{css,js,json,jsx,ts,tsx}\"",
"format": "prettier \"**/*.{css,js,json,jsx,ts,tsx}\"",
"start": "npm run build && concurrently \"next start\" \"node ilp/server.js\"",
"lint": "next lint"
}
- dev: Generates Prisma client and runs both the Next.js development server and the ILP Express server concurrently.
- build: Generates Prisma client, pushes the Prisma schema to the database, and builds the Next.js app.
- format:write: Formats the codebase using Prettier and writes changes.
- format: Checks code formatting without making changes.
- start: Runs the build script and then starts both the Next.js server and ILP Express server concurrently in production mode.
- lint: Runs Next.js's linting tool.
The app uses Prisma as an ORM to interact with a MSSQL database. Below is an overview of the main models:
datasource db {
provider = "sqlserver"
url = "your_database_connection_string"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
name String?
email String? @unique
projects Project[]
accounts Account[]
sessions Session[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Project {
id Int @id @default(autoincrement())
userId Int
title String
description String
bannerImage String
markDownCode String
tips Tip[]
goal String
deadline String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
}
model Tip {
id Int @id @default(autoincrement())
projectId Int
amount Float
timeStamp String
hash String @unique
interactRef String
createdAt DateTime @default(now())
project Project @relation(fields: [projectId], references: [id])
}
The ILP Express server handles payment processing via the Interledger Protocol. It communicates with the Rafiki Wallet for payment settlements and records transactions in TigerBeetleDB.
Key Functions:
/create-payment
Endpoint: Initiates a new payment process.- Grant Management: Handles grant requests and responses for secure payment authorization.
- Error Handling: Logs and returns appropriate error messages.
Note: Ensure that you have the necessary environment variables and configuration set up for the ILP server to function correctly.
Feel free to contribute to the project or raise issues if you encounter any problems. Happy fundraising!