Before you begin, ensure you have the following installed:
- Docker and Docker Compose (latest version)
- Node.js (v20.18.1 or higher)
For development, create .env:
DATABASE_URL="postgresql://postgres:123@postgres:5432/nest"
The application uses Docker for consistent development environments. Follow these steps to get it running:
- Build and start the containers:
docker compose up -dThis command will:
- Set up a PostgreSQL database
- Create necessary database tables
- Start the NestJS application
- Watch for file changes during development
- Wait for the initialization to complete. You should see logs indicating the server is running.
The API will be available at http://localhost:3000.
When running the application for the first time or after schema changes:
- Generate Prisma client:
npx prisma generate- Run migrations:
npx prisma migrate dev- Seed the database (if needed):
npm run prisma:seed- To view your database using Prisma Studio:
npx prisma studioTo access the Swagger documentation, enter the link with the application running:
http://localhost:3000/api- Get All Communities
GET /communitiesReturns a list of all visible communities.
- Get Specific Community
GET /communities/:contractAddressReturns detailed information for a specific community.
- Update Community Visibility
PATCH /communities/:contractAddress/visibilityUpdates the visibility status of a community. request body:
{
"isHidden": true
}curl http://localhost:3000/communitiesUpdating community visibility:
curl -X PATCH http://localhost:3000/communities/[contract-address]/visibility \
-H "Content-Type: application/json" \
-d '{"isHidden": true}'The application includes comprehensive test coverage. Here's how to run different types of tests:
- Unit Tests:
npm run test- E2E Tests:
npm run test:e2e- Test Coverage:
npm run test:cov