-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Initialize the backend repository for the Book Store API using Node.js and Express. The project should include development tooling, linting/formatting, SQLite with an ORM, auto-reloading, Swagger docs, and a Dockerfile for deployment.
Goals
Set up a clean, consistent, and production-ready base project.
Tech Decisions
- DB: SQLite (lightweight, file-based)
- ORM: Prisma (modern, beginner-friendly, great DX)
Tasks
- Initialize Node.js project (
npm init)
Core Setup
-
Install core dependencies:
-
express -
@prisma/client
-
-
Install dev dependencies:
-
nodemon -
eslint -
prettier -
eslint-config-prettier -
eslint-plugin-prettier -
lint-staged -
husky -
prisma
-
Express App
- Create basic Express server (
app.jsorserver.js) - Add health route:
-
GET /health
-
Database Setup (SQLite + Prisma)
-
Initialize Prisma:
npx prisma init
-
Configure SQLite in
schema.prisma -
Create
Bookmodel:-
id(Int, primary key) -
name(String) -
author(String or JSON) -
price(Float) -
publisher(String, optional)
-
-
Run migration:
npx prisma migrate dev
-
Generate Prisma client
-
Test DB connection
Linting & Formatting
-
Configure ESLint:
- Initialize config
- Add recommended rules
- Integrate with Prettier
- Add custom rules
- Add
.eslintignore
-
Configure Prettier:
- Add
.prettierrc - Add
.prettierignore
- Add
Staged Linting (Pre-commit)
-
Initialize Husky
-
Add pre-commit hook
-
Configure
lint-staged:- Run ESLint on staged
.jsfiles - Run Prettier on staged files
- Run ESLint on staged
-
Ensure commits fail on lint errors
Dev Experience
- Add
.gitignore - Configure nodemon:
- Add
nodemon.jsonor script
- Add
Swagger Setup
- Install:
-
swagger-ui-express -
swagger-jsdoc
-
- Create Swagger config
- Add
/api-docsroute
Scripts
- Add npm scripts:
-
start -
dev -
lint -
lint:fix -
format -
prisma:migrate -
prisma:generate
-
Docker (App Only)
- Create
Dockerfile - Define:
- Node base image
- Working directory
- Install dependencies
- Copy source code
- Expose port
- Start command
Acceptance Criteria
- App runs:
npm run dev- Server starts without errors
- Swagger available at
/api-docs - SQLite DB connected via Prisma
- Migration runs successfully
- ESLint & Prettier work
- Pre-commit hook blocks bad commits
- Health route works
Definition of Done
- Repo pushed to GitHub
- DB setup working
- Dockerfile builds successfully
- Project runs with:
npm install
npm run devOptional (Nice to Have)
-
Add
dotenv -
Add folder structure:
-
/src/routes -
/src/controllers -
/src/middlewares -
/src/services
-
-
Add README
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
In review