https://github.com/sid-sg/bookstore
https://github.com/sid-sg/bookstore
docker nestjs typescript
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sid-sg/bookstore
- Owner: sid-sg
- Created: 2025-04-08T19:38:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-09T16:03:13.000Z (about 1 year ago)
- Last Synced: 2025-04-10T05:48:30.825Z (about 1 year ago)
- Topics: docker, nestjs, typescript
- Language: TypeScript
- Homepage:
- Size: 7.89 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bookstore Backend
## Tech Stack
- Typescript
- Node.js
- NestJS
- PostgreSQL
- Prisma
- Docker
- Swagger
## Setup Instructions
1. **Clone the Repository**
```
git clone https://github.com/sid-sg/Bookstore.git
cd Bookstore
```
2. **Create Environment File**
Create a `.env` file in the root directory and add the following variables:
```
DATABASE_URL="your_database_connection_string"
JWT_SECRET="your_jwt_secret"
```
Replace `"your_database_connection_string"` and `"your_jwt_secret"` with your actual database URL and a secure secret key.
3. **Run with Docker Compose**
Ensure Docker is installed and running on your system. Then, execute the following command in the project root:
```
docker-compose up --build
```
## Swagger Documentation
To access the API documentation and interactively test the endpoints, navigate to the following URL in your browser after starting the application:
`http://localhost:3000/api`
## API Endpoints
The following endpoints are available:
- `POST /auth/signup` - User sign up
- `POST /auth/login` - User login
- `GET /books/` - Retrieve a list of all books
- `GET /books/{id}` - Retrieve a specific book by its ID
- `GET /books/search` - Search for books
- `GET /books/sort` - Sort books
- `GET /books/filter` - Filter books
- `POST /books/new` - Add a new book (requires authentication).
- `PATCH /books/{id}` - Update an existing book by ID (requires authentication)
- `DELETE /books/{id}` - Delete a book by ID (requires authentication)
*Please refer to the Swagger documentation available at `http://localhost:3000/api` for sample requests*
## Assumptions
- Prisma migrations are already run before building
- The app listens on port 3000
- .env file has necessary environment variables and are loaded in the Docker container