Skip to content

blockful-io/trustful-stellar-backend

Repository files navigation

Trustful Stellar Backend

Prerequisites

Before you begin, ensure you have the following installed:

  • Docker and Docker Compose (latest version)
  • Node.js (v20.18.1 or higher)

Environment Setup

For development, create .env:

DATABASE_URL="postgresql://postgres:123@postgres:5432/nest"

Running the Application

The application uses Docker for consistent development environments. Follow these steps to get it running:

  1. Build and start the containers:
docker compose up -d

This command will:

  • Set up a PostgreSQL database
  • Create necessary database tables
  • Start the NestJS application
  • Watch for file changes during development
  1. Wait for the initialization to complete. You should see logs indicating the server is running.

The API will be available at http://localhost:3000.

Database Management

When running the application for the first time or after schema changes:

  1. Generate Prisma client:
npx prisma generate
  1. Run migrations:
npx prisma migrate dev
  1. Seed the database (if needed):
npm run prisma:seed
  1. To view your database using Prisma Studio:
npx prisma studio

API Documentation

Available Endpoints

To access the Swagger documentation, enter the link with the application running:

http://localhost:3000/api
  1. Get All Communities
GET /communities

Returns a list of all visible communities.

  1. Get Specific Community
GET /communities/:contractAddress

Returns detailed information for a specific community.

  1. Update Community Visibility
PATCH /communities/:contractAddress/visibility

Updates the visibility status of a community. request body:

{
  "isHidden": true
}

Example Requests

curl http://localhost:3000/communities

Updating community visibility:

curl -X PATCH http://localhost:3000/communities/[contract-address]/visibility \
  -H "Content-Type: application/json" \
  -d '{"isHidden": true}'

Testing

The application includes comprehensive test coverage. Here's how to run different types of tests:

  1. Unit Tests:
npm run test
  1. E2E Tests:
npm run test:e2e
  1. Test Coverage:
npm run test:cov

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published