Skip to content

Latest commit

 

History

61 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notes Application

A full-stack web application for creating, managing, and organizing notes with categories. Built as a Single Page Application (SPA) with separate frontend and backend services.

Features

Phase 1 - Core Functionality

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

Phase 2 - Advanced Features

  • ✅ Add/remove categories to notes
  • ✅ Filter notes by category

Authentication

  • ✅ Login screen with JWT authentication
  • ✅ Protected routes and API endpoints
  • ✅ User session management

Technology Stack

Backend

  • Framework: NestJS 11.0.1
  • Language: TypeScript 5.7.3
  • Database: PostgreSQL
  • ORM: TypeORM 0.3.24
  • Authentication: JWT with Passport
  • Password Hashing: bcrypt
  • Architecture: Layered (Controllers, Services, Repositories)

Frontend

  • Framework: React 19.1.0
  • Language: TypeScript 4.9.5
  • UI Library: Material-UI (MUI) 7.1.0
  • HTTP Client: Axios 1.9.0
  • Routing: React Router DOM 7.6.1

Database

  • RDBMS: PostgreSQL
  • Default Configuration: Check environment variables section

System Requirements

  • Node.js: 18.0.0 or higher
  • npm: Latest version (comes with Node.js)
  • PostgreSQL: Latest stable version
  • Operating System: Linux (OK) / macOS (to test)

Default Login Credentials

Username: admin
Password: password

These credentials are automatically created when the application starts for the first time.

Quick Start

Automatic Setup (Recommended)

Run the deployment script that will automatically install dependencies, set up the database, and start both services:

./deploy.sh

This script will:

  1. Check and install system requirements
  2. Set up PostgreSQL database and user
  3. Install backend dependencies
  4. Install frontend dependencies
  5. Start both backend and frontend services

Manual Setup

If you prefer to set up manually:

1. Prerequisites

# Install Node.js 18+ (if not already installed)
# Ubuntu/Debian:
sudo apt-get update
sudo apt-get install -y nodejs

# macOS:
brew install node

# Install PostgreSQL
# Ubuntu/Debian:
sudo apt-get install -y postgresql postgresql-contrib

# macOS:
brew install postgresql

2. Database Setup

# Start PostgreSQL service
# Ubuntu/Debian:
sudo systemctl start postgresql
sudo systemctl enable postgresql

# macOS:
brew services start postgresql

# Create database and user
sudo -u postgres createuser -s postgres
sudo -u postgres psql -c "ALTER USER postgres PASSWORD '1234';"
sudo -u postgres createdb notesdb

3. Backend Setup

cd backend
npm install
npm run start:dev

4. Frontend Setup

# In a new terminal
cd frontend
npm install
npm start

Application URLs

API Endpoints

Notes

  • GET /notes - Get all active notes
  • GET /notes/archived - Get all archived notes
  • POST /notes - Create a new note
  • PUT /notes/:id - Update a note
  • DELETE /notes/:id - Delete a note
  • PATCH /notes/:id/archive - Archive a note
  • PATCH /notes/:id/unarchive - Unarchive a note

Categories

  • GET /categories - Get all categories
  • POST /categories - Create a new category
  • PATCH /categories/:id - Update a category
  • DELETE /categories/:id - Delete a category

API Testing

Postman Collection

A comprehensive Postman collection is available to test all API endpoints:

Collection File: API REST Ensolvers.postman_collection.json

How to Use

  1. Import the Collection:

    • Open Postman
    • Click "Import" button
    • Select the API REST Ensolvers.postman_collection.json file from the project root
    • The collection will be imported with all endpoints ready to use
  2. Set Environment Variables:

    • Set baseUrl to http://localhost:3000
    • Set noteId and categoryId variables as needed for testing specific endpoints
  3. Available Endpoints in Collection:

    • Notes: Create, list active/archived, get by ID, update, archive/unarchive, delete
    • Categories: Create, list all, get by ID, update, delete
    • Advanced: Create notes with categories, update note categories, filter notes by category

Collection Features

  • Pre-configured request bodies with example data
  • Environment variables for easy endpoint testing
  • Complete coverage of all API endpoints
  • Organized by functionality (Notes, Categories, Advanced features)

Development

Running Tests

cd backend

# E2E tests
npm run test:e2e

# Test coverage
npm run test:e2e -- -- coverage

Environment Variables

The backend supports the following environment variables:

DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASS=1234
DB_NAME=notesdb

Troubleshooting

Common Issues

  1. PostgreSQL Connection Error

    • Ensure PostgreSQL is running: sudo systemctl status postgresql
    • Check database credentials in the backend configuration
    • Verify database exists: psql -U postgres -d notesdb
  2. Port Already in Use

    • Backend (3001): lsof -ti:3001 | xargs kill -9
    • Frontend (3000): lsof -ti:3000 | xargs kill -9
  3. Node.js Version Issues

    • Ensure Node.js 18+ is installed: node --version
    • Use nvm to manage Node.js versions if needed
  4. Permission Issues

    • Make deploy.sh executable: chmod +x deploy.sh
    • Run with appropriate permissions for PostgreSQL setup

Architecture

The application follows a clean architecture pattern:

  • Frontend: React SPA with Material-UI components
  • Backend: NestJS with layered architecture (Controllers → Services → Repositories)
  • Database: PostgreSQL with TypeORM for data persistence
  • Communication: RESTful API between frontend and backend

License

This project is private and unlicensed.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages