Skip to content

jitrodriguez/notes-app-fullstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notes App — Full Stack Implementation

A simple full stack web application to create, archive, and filter notes.
Developed as a technical exercise following the provided specifications.


🚀 Tech Stack

  • Frontend: React + Vite (Node.js 20.x, npm 10.x)
  • Backend: NestJS + Prisma (Node.js 20.x)
  • Database: PostgreSQL 16
  • ORM: Prisma
  • Containerization: Docker 24+, Docker Compose

📂 Repository Structure

.
├── backend/               # NestJS app (controllers, services, repositories)
│   ├── prisma/            # schema.prisma and migrations
│   └── Dockerfile
├── frontend/              # React + Vite SPA
│   └── Dockerfile
├── docker-compose.yml
├── run.sh                 # one-command runner
└── README.md

▶️ Running the Application

One Command

chmod +x run.sh
./run.sh

The script will:

  • Create a default .env file if missing.
  • Start PostgreSQL and wait until it is healthy.
  • Apply Prisma migrations automatically.
  • Start the backend API and the frontend SPA.
  • Open the app in your browser at http://localhost:8080.
  • Stream logs (press Ctrl+C to stop, which also shuts down the stack).

⚙️ Environment Variables

Defaults are created by run.sh:

POSTGRES_USER=notes_user
POSTGRES_PASSWORD=notes_pass
POSTGRES_DB=notes_db

API_PORT=4000
WEB_PORT=8080
  • Backend connects to:
    postgresql://notes_user:notes_pass@db:5432/notes_db?schema=public
  • Frontend is built with:
    VITE_API_BASE=http://localhost:4000/api

✅ Healthchecks

  • DB: pg_isready
  • API: GET /health200 { "status": "ok" }
  • Frontend: responds on port 80 inside container (mapped to 8080)

📖 Features

Phase 1

  • Create, edit, and delete notes.
  • Archive and unarchive notes.
  • List active notes.
  • List archived notes.

Phase 2

  • Add/remove categories (tags) to notes.
  • Filter notes by category.

🔌 API Endpoints

Base URL: http://localhost:4000/api

Phase 1:

  • POST /notes → create a note
  • GET /notes → list notes (?archived=true|false optional)
  • PATCH /notes/:id → update a note
  • DELETE /notes/:id → delete a note
  • PATCH /notes/:id/archive → archive
  • PATCH /notes/:id/unarchive → unarchive

Phase 2:

  • POST /categories → create category
  • GET /categories → list categories
  • POST /notes/:id/categories/:categoryId → add category to note
  • DELETE /notes/:id/categories/:categoryId → remove category from note
  • GET /notes?categoryIds=1,2 → filter notes by categories

🗄️ Database & ORM

  • Prisma manages the schema and migrations.
  • Migrations are automatically applied at container startup (prisma migrate deploy).
  • For local development (without Docker):
    cd backend
    npm install
    npx prisma generate
    npx prisma migrate dev
    npm run start:dev

✅ Challenge Checklist

  • SPA separated in frontend/
  • Backend REST API in backend/ with layered architecture
  • Persistence with relational DB and ORM (Postgres + Prisma)
  • One-command runner (./run.sh)
  • README with runtimes and versions
  • Phase 1: notes CRUD + archive/unarchive
  • Phase 2: categories and filtering
  • Optional login documented
  • Optional live deployment

About

A simple notes app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •