Nepak Point API is the backend of Nepak Point's e-commerce personal project.
- Production:
https://nepak-point-api.indahmutiah.com - Local:
http://localhost:3000
Products:
| Endpoint | HTTP | Description |
|---|---|---|
/products |
GET |
Get all products |
/products/:slug |
GET |
Get product by slug |
/products |
POST |
Add new product |
/products/:id |
DELETE |
Delete product by id |
/products/:id |
PUT |
Update product by id |
Auth:
| Endpoint | HTTP | Permission |
|---|---|---|
/users |
GET |
Public |
/users/:username |
GET |
Public |
/auth/register |
POST |
Public |
/auth/login |
POST |
Public |
/auth/me |
GET |
Authenticated |
/auth/logout |
POST |
Authenticated |
/cart |
GET |
Authenticated |
/cart/items |
POST |
Authenticated |
/cart/items/:id |
DELETE |
Authenticated |
/cart/items/:id |
PUT |
Authenticated |
Copy and edit .env file:
cp .env.example .envSetup database:
# Run database only
docker:upInstall dependencies:
bun installMigrate database and generate Prisma Client:
bun db:migrate
# prisma migrate devSeed initial products:
bun db:seed
# prisma db seedRun development server:
bun dev
# bun run --hot src/index.tsOpen http://localhost:3000.
Make sure the DATABASE_URL is configured in .env file for usage with Docker Compose.
If we need to build the Docker image:
bun docker:build
# docker compose up -d --buildIf only run the Docker container:
bun docker:up
# docker compose up -dOpen http://localhost:3000.