NestJS backend for a home music library management app.
- Node.js
- NestJS
- PostgreSQL
- Prisma ORM
- Docker
-
Authentication and authorization (JWT access and refresh tokens)
-
Custom logging service (writing to process.stdout and file with file rotation)
- in .env you can set up logging level and max file size
-
CRUD operations for:
- Users
- Tracks
- Artists
- Albums
- Favorites
git clone https://github.com/uv95/home-library.git
cd home-librarynpm installmv .env.example .envnpm run start:devnpm run build
npm startThe server will start on http://localhost:3000 by default.
-
Prisma schema defined in
prisma/schema.prisma -
Environment variables loaded from
.env -
Apply migrations:
npx prisma migrate deploy
To run the full environment:
docker compose up --build| Method | Endpoint | Description |
|---|---|---|
| GET | /user |
Get all users |
| GET | /user/:id |
Get user by ID |
| POST | /user |
Create new user |
| PUT | /user/:id |
Update user |
| DELETE | /user/:id |
Delete user |
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/signup |
Sign up |
| POST | /auth/login |
Log in |
| POST | /auth/refresh |
Send refresh token |
| Method | Endpoint | Description |
|---|---|---|
| GET | /track |
Get all tracks |
| GET | /track/:id |
Get track by ID |
| POST | /track |
Create new track |
| PUT | /track/:id |
Update track |
| DELETE | /track/:id |
Delete track |
| Method | Endpoint | Description |
|---|---|---|
| GET | /artist |
Get all artists |
| GET | /artist/:id |
Get artist by ID |
| POST | /artist |
Create new artist |
| PUT | /artist/:id |
Update artist |
| DELETE | /artist/:id |
Delete artist |
| Method | Endpoint | Description |
|---|---|---|
| GET | /album |
Get all albums |
| GET | /album/:id |
Get album by ID |
| POST | /album |
Create new album |
| PUT | /album/:id |
Update album |
| DELETE | /album/:id |
Delete album |
| Method | Endpoint | Description |
|---|---|---|
| GET | /favs |
Get all favorites |
| POST | /favs/track/:id |
Add track to favorites |
| DELETE | /favs/track/:id |
Remove track from favorites |
| POST | /favs/artist/:id |
Add artist to favorites |
| DELETE | /favs/artist/:id |
Remove artist from favorites |
| POST | /favs/album/:id |
Add album to favorites |
| DELETE | /favs/album/:id |
Remove album from favorites |