Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joozef315/donornest-api
an API for Donations app with NestJs
https://github.com/joozef315/donornest-api
api docker-compose donations multer nestjs nodejs prisma sqlite stripe typescript
Last synced: 1 day ago
JSON representation
an API for Donations app with NestJs
- Host: GitHub
- URL: https://github.com/joozef315/donornest-api
- Owner: JooZef315
- License: mit
- Created: 2024-06-10T15:58:05.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-21T13:12:09.000Z (5 months ago)
- Last Synced: 2024-06-22T11:58:41.618Z (5 months ago)
- Topics: api, docker-compose, donations, multer, nestjs, nodejs, prisma, sqlite, stripe, typescript
- Language: TypeScript
- Homepage:
- Size: 442 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Donor Nest
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
A progressive Node.js framework for building efficient and scalable server-side applications.
## Description
Welcome to Donor Nest, a robust platform designed to connect generous donors with meaningful campaigns. Our system enables users to easily create, manage, and donate to campaigns, ensuring that every cause gets the support it deserves. With secure authentication, seamless Stripe integration for payments, and comprehensive campaign management features, Donor Nest is your go-to solution for crowdfunding and donations.
## Features
- **User Authentication**: Secure login and registration using email and password.
- **JWT and Refresh Tokens**: Enhanced security with JWT for access tokens and refresh tokens for session management.
- **Admin Verification**: Campaign creation is gated by admin verification to ensure legitimacy.
- **Campaign Management**: Create, view, update, and delete campaigns with ease.
- **Donation Management**: Facilitate donations with detailed tracking and status updates.
- **Stripe Integration**: Seamlessly handle payments and transactions.
- **File Uploads**: Upload and manage official IDs using Multer and Uploadcare.
- **Role-Based Access Control**: Fine-grained access control using roles and permissions.
- **Automatic Status Updates**: Campaign status updates automatically when funding goals are met.## Technologies Used
- **NestJS**: A progressive Node.js framework for building efficient, reliable, and scalable server-side applications.
- **NestJS Modules**: Modular structure for organizing the application.
- **NestJS Controllers**: Handle incoming requests and return responses.
- **NestJS Services**: Business logic and data handling.
- **NestJS Guards**: Role-based access control.
- **NestJS Pipes**: Input validation and transformation.
- **NestJS Decorators**: Custom decorators for cleaner code.
- **SQLite**: A lightweight database engine.
- **Prisma**: ORM for database interactions.
- **Stripe**: Payment processing platform.
- **Multer**: Middleware for handling multipart/form-data.
- **Uploadcare**: Service for handling file uploads.
- **PassportJS**: Authentication middleware for Node.js.
- **JWT**: JSON Web Tokens for securing APIs.
- **Docker**: Containerization platform for development and deployment.## Configuration
Create a `.env` file in the root of your project with the following variables:
```env
PORT=3001
DATABASE_URL="your-db-url"
STRIPE_SECRET_KEY="your-stripe-secret-key"
STRIPE_WEBHOOK_SECRET="your-stripe-webhook-secret"
UPLOADCARE_PUBLIC_KEY="your-uploadcare-public-key"
UPLOADCARE_SECRET_KEY="your-uploadcare-secret-key"
JWT_SECRET="your-jwt-secret"
```## Installation and Usage
### Manual Installation
1. **Clone the repository**:
```bash
git clone https://github.com/your-username/donor-nest.git
cd donor-nest
```2. **Install dependencies**:
```bash
npm install
```3. **Set up Prisma**:
```bash
npm run db:push
```4. **Start the application**:
```bash
npm run start:dev
```### Using Docker Compose
1. **Clone the repository**:
```bash
git clone https://github.com/your-username/donor-nest.git
cd donor-nest
```2. **Start services with Docker Compose**:
```bash
docker-compose up
```## API Endpoints
### Authentication
1. **Register a new user**
- **Description**: Register a new user.
- **Method**: POST
- **Route**: /api/v1/users/
- **Access**: Public
- **Output**: Success message2. **Authenticate a user**
- **Description**: Authenticate a user and get JWT token.
- **Method**: POST
- **Route**: /api/v1/auth/login
- **Access**: Public
- **Output**: JWT token3. **Logout a user**
- **Description**: Logout a user.
- **Method**: POST
- **Route**: /api/v1/auth/logout
- **Access**: Private
- **Output**: Success message4. **Refresh the access token**
- **Description**: Refresh the access token.
- **Method**: GET
- **Route**: /api/v1/auth/refresh
- **Access**: Private
- **Output**: Access token### Users
1. **Get all Users**
- **Description**: get all users.
- **Method**: GET
- **Route**: /api/v1/users
- **Access**: Private (admins)
- **Output**: users2. **Get a user**
- **Description**: get a user.
- **Method**: GET
- **Route**: /api/v1/users/:id
- **Access**: Private
- **Parameters**:
- id (string): User ID.
- **Output**: user3. **Update a user**
- **Description**: update a user.
- **Method**: PUT
- **Route**: /api/v1/users/:id
- **Access**: Private
- **Parameters**:
- id (string): User ID.
- **Output**: user4. **Delete a user**
- **Description**: Delete a user.
- **Method**: DELETE
- **Route**: /api/v1/users/:id
- **Access**: Private
- **Parameters**:
- id (string): User ID.
- **Output**: Success message5. **Verfiy a user**
- **Description**: Verfiy a user by his official ID.
- **Method**: PUT
- **Route**: /api/v1/users/:id/verfiy
- **Access**: Private
- **Parameters**:
- id (string): User ID.
- **Output**: Success message### Campaigns
1. **Get all Campaigns**
- **Description**: get all Campaigns.
- **Method**: GET
- **Route**: /api/v1/campaigns
- **Access**: Public
- **Query Parameters**:
- full (number): page. Optional. for pagination.Defaul 1.
- purpose (string): Optional. to filter by Campaign purpose.
- search (string): Optional. to by Campaign name.
- **Output**: Campaigns2. **Add a Campaign**
- **Description**: Add a Campaign.
- **Method**: POST
- **Route**: /api/v1/campaigns/:id
- **Access**: Private
- **Parameters**:
- id (string): Campaign ID.
- **Output**: campaign3. **Get a Campaign**
- **Description**: get a Campaign.
- **Method**: GET
- **Route**: /api/v1/campaigns/:id
- **Access**: Public
- **Parameters**:
- id (string): Campaign ID.
- **Output**: campaign4. **Update a Campaign**
- **Description**: update a Campaign.
- **Method**: PUT
- **Route**: /api/v1/campaigns/:id
- **Access**: Private
- **Parameters**:
- id (string): Campaign ID.
- **Output**: Campaign5. **Delete a Campaign**
- **Description**: Delete a campaign.
- **Method**: DELETE
- **Route**: /api/v1/campaigns/:id
- **Access**: Private
- **Parameters**:
- id (string): Campaign ID.
- **Output**: Success message### Donations
2. **Donate**
- **Description**: Create a new donation for a campaign.
- **Method**: POST
- **Route**: /api/v1/campaigns/:id/donations
- **Access**: Public
- **Parameters**:
- id (string): Campaign ID.
- **Output**: donation3. **Get Donations**
- **Description**: Get all donations for a campaign.
- **Method**: GET
- **Route**: /api/v1/campaigns/:id/donations
- **Access**: Private
- **Parameters**:
- id (string): Campaign ID.
- **Output**: donations## License
This project is licensed under the [MIT licensed](LICENSE).