Skip to content

A bookstore amangement API. Assesment program for my internship test.

Notifications You must be signed in to change notification settings

nightmare391/Bookstore-API-Zynetic-assessment-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Bookstore API

A RESTful API for a bookstore application built using NestJS, TypeScript, and Prisma ORM.

πŸ“Œ Features

  • πŸ“– CRUD operations for books
  • πŸ‘€ User authentication with JWT
  • πŸ”’ Secure password storage with bcrypt
  • πŸ›‘οΈ Authorization for protected routes
  • 🧱 Prisma integration with PostgreSQL
  • πŸ§ͺ Ready for future testing & extension

πŸ› οΈ Technologies Used

  • NestJS
  • Prisma
  • PostgreSQL
  • JWT
  • bcrypt

πŸ“‚ Project Structure

src/ β”œβ”€β”€ auth/ # Authentication logic (login/signup, JWT) β”œβ”€β”€ books/ # Book module with CRUD APIs β”œβ”€β”€ users/ # User management module β”œβ”€β”€ prisma/ # Prisma database service └── main.ts # App entry point

βš™οΈ Getting Started

  1. Clone the repo

    git clone https://github.com/yourusername/bookstore-api.git cd bookstore-api

  2. Install dependencies

    npm install

  3. Set up your .env

Create a .env file in the root directory and add:

DATABASE_URL="postgresql://your_user:your_password@localhost:5432/bookstore"
JWT_SECRET="your_jwt_secret"
  1. Set up Prisma

    npx prisma init npx prisma migrate dev --name init npx prisma generate

  2. Run the server

    npm run start:dev

πŸ” Authentication

  • Signup: POST /auth/signup
  • Login: POST /auth/login
  • Use the returned JWT in the Authorization header as Bearer

πŸ“« API Endpoints

Method Endpoint Description
GET /books Get all books
POST /books Create a new book
GET /books/:id Get a book by ID
PATCH /books/:id Update a book
DELETE /books/:id Delete a book

πŸ” Routes are protected, requires JWT token.

πŸ‘¨β€πŸ’» Developer

Divyam Singh
Roll No: 2205897
B.Tech CSE, Semester 6
Section: CSE-34

πŸ“ƒ License

This project is open-source and free to use for learning purposes.

About

A bookstore amangement API. Assesment program for my internship test.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published