This project is a simple Todo application built with NestJS, Prisma ORM, and SQLite. It demonstrates basic CRUD operations, error handling using the neverthrow library, and includes unit and E2E tests.
- Create, Read, Update, and Delete Todo items
- SQLite database integration using Prisma ORM
- Error handling with neverthrow
- Unit and E2E tests
- Code formatting with Prettier
- Node.js (v18 or later)
- npm (v10 or later)
- Clone the repository:
git clone https://github.com/shinshin86/nestjs-todo-app.git
cd nestjs-todo-app
- Install dependencies:
npm install
- Set up the database:
npm run db:migrate
- (Optional) Seed the database:
npm run db:seed
# development
npm run start
# watch mode
npm run start:dev
# or
npm run dev
# production mode
npm run start:prod
# unit tests
npm run test
# e2e tests
npm run test:e2e
# test coverage
npm run test:cov
GET /todos
: Get all todosGET /todos/:id
: Get a specific todoPOST /todos
: Create a new todoPUT /todos/:id
: Update a todoDELETE /todos/:id
: Delete a todo
- The main application logic is in the
src/todo
directory. - Database schema is defined in
prisma/schema.prisma
. - API endpoints are defined in
src/todo/todo.controller.ts
. - Business logic is implemented in
src/todo/todo.service.ts
.
This project uses GitHub Actions for continuous integration. The CI pipeline runs on every push to the main
branch and on every pull request. It performs the following checks:
- Installs dependencies
- Builds the project
- Runs linting
- Generates Prisma client
- Runs Prisma migrations
- Executes unit tests
- Runs E2E tests
The CI is configured to run on Node.js versions 18.x and 20.x. You can see the details of the CI configuration in the .github/workflows/ci.yml
file.
This project uses Prettier for code formatting. To format your code, run:
npm run format
To automatically fix linting issues where possible:
npm run lint
This project is MIT licensed.