Webstore Backend (Laxer + CQRS + Prisma)
Educational Node.js backend for frontend students.
Structure
backend/
prisma/
schema.prisma
seed.js
public/
images/
scripts/
extract-images-from-build.bat
src/
Api/
Controller/
Router/
Middleware/
app.js
server.js
Application/
User/
Command/
command.js
commandhandler.js
Querry/
query.js
queryhandler.js
Services/
DTO/
Domain/
IRepository/
Models/
Infrastructure/
Repository/
config/
env.js
prisma.js
Run with Docker Compose
docker compose up --build
This starts PostgreSQL and API, runs Prisma generate/db push/seed automatically.
Auth (JWT in Cookie)
POST /api/users/registerPOST /api/users/loginGET /api/users/me(requires cookie)POST /api/users/logout(requires cookie)
Cookie is HTTP-only and set with sameSite=lax.
Shop endpoints
GET /api/healthGET /api/shop/categoriesGET /api/shop/productsPOST /api/shop/orders
Order payload:
{
"customer_name": "Jane Doe",
"customer_email": "jane@example.com",
"items": [
{ "product_id": 1, "quantity": 2 }
]
}
Image extraction batch
scripts\extract-images-from-build.bat "..\build" ".\public\images"
Defaults (if arguments omitted):
- Source:
..\build - Target:
.\public\images