https://github.com/crabstechnologies/notes-api
π§ Simple Notes API built with NestJS, TypeORM, SQLite, and Swagger β a clean CRUD backend for learning and portfolio projects.
https://github.com/crabstechnologies/notes-api
api backend crud learning-project nestjs nodejs sqlite swagger typeorm typescript
Last synced: about 2 months ago
JSON representation
π§ Simple Notes API built with NestJS, TypeORM, SQLite, and Swagger β a clean CRUD backend for learning and portfolio projects.
- Host: GitHub
- URL: https://github.com/crabstechnologies/notes-api
- Owner: crabstechnologies
- License: mit
- Created: 2025-10-20T15:16:42.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-10-23T16:03:38.000Z (8 months ago)
- Last Synced: 2025-11-04T10:11:35.778Z (8 months ago)
- Topics: api, backend, crud, learning-project, nestjs, nodejs, sqlite, swagger, typeorm, typescript
- Language: TypeScript
- Homepage: http://localhost:3000/docs
- Size: 139 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README





[](LICENSE)
# π§ Notes API β NestJS + TypeORM + SQLite
A clean, production-ready **REST API** built with **NestJS**, demonstrating how to design a modular, well-documented backend service using **TypeORM**, **SQLite**, and **Swagger**.
This project is beginner-friendly but follows industry best practices β perfect for learning or showcasing your backend skills.
---
## π Features
β
**CRUD Operations** β Create, Read, Update, Delete notes
β
**Validation** β Strong input validation using `class-validator`
β
**Auto Docs** β Built-in Swagger UI (`/docs`)
β
**TypeORM Integration** β SQLite for simplicity (zero setup)
β
**Seed Script** β Preloads demo data for quick testing
β
**Unit Tests** β Example service test with Jest
β
**Clean Architecture** β Organized modules, DTOs, and entities
---
## π§° Tech Stack
| Layer | Technology |
|-------------------|--------------------------------------|
| Framework | [NestJS](https://nestjs.com/) |
| ORM | [TypeORM](https://typeorm.io/) |
| Database | SQLite |
| Validation | class-validator / class-transformer |
| Documentation | Swagger (OpenAPI) |
| Testing | Jest |
| Package Manager | Yarn |
---
## π¦ Installation
Clone and install dependencies:
```bash
git clone https://github.com//notes-api.git
cd notes-api
yarn install
```
---
## βοΈ Running the App
# Development mode (auto-reloads)
```bash
yarn start:dev
```
# Production build
```bash
yarn build
yarn start:prod
```
### Database schema sync (TypeORM)
TypeORM's automatic schema sync is controlled via the `TYPEORM_SYNC` environment
variable:
```bash
# .env (local development)
TYPEORM_SYNC=true
```
For production deployments the flag **must** be set to `false` to protect data
migrations. The provided `yarn start:prod` script already enforces this by
running `TYPEORM_SYNC=false node dist/main`. If you use a different process
manager, make sure to export the variable yourself (for Windows PowerShell use
`$env:TYPEORM_SYNC = 'false'`).
---
## π± Seeding Sample Data
You can prefill the database with example notes:
```bash
yarn seed
```
This will insert two demo notes:
βWelcomeβ β first seeded note β¨
βSecondβ β edit or delete it in Thunder Client!
---
## π API Endpoints Overview
| Method | Endpoint | Description |
|---------|-------------|---------------------|
| POST | /notes | Create a new note |
| GET | /notes | Get all notes |
| GET | /notes/:id | Get a specific note |
| PATCH | /notes/:id | Update a note |
| DELETE | /notes/:id | Delete a note |
---
## π§ͺ Testing
```bash
yarn test
```
Youβll find example tests under src/notes/notes.service.spec.ts.
---
## π§© Project Structure
```bash
src
βββ app.module.ts # Root module
βββ main.ts # Entry point + Swagger setup
βββ notes
βββ dto # Data transfer objects (validation)
βββ entities # TypeORM entities
βββ notes.controller.ts
βββ notes.module.ts
βββ notes.service.ts
```
---
## π§ Learning Objectives
This project demonstrates:
- Clean modular design in NestJS
- DTO + validation + transformation flow
- Database persistence with TypeORM
- Swagger documentation automation
- Dependency injection and testing with Jest
---
## β If you like this project, consider giving it a star on GitHub, it helps others discover learning-friendly NestJS examples!
---
## π License
This project is licensed under the [MIT License](LICENSE).