A modern, scalable note-taking application built with microservices architecture using Node.js, TypeScript, and PostgreSQL.
NotesVerb follows a microservices architecture pattern with the following services:
Each service has its own PostgreSQL database following the database-per-service pattern.
git clone https://www.fiston.dev/code/notesverb.git
cd notesverb-yt
Copy the environment example files and configure them:
# Root environment file
cp .env.example .env
# API Gateway
cp api-gateway/.env.example api-gateway/.env
# Services
cp services/auth-service/.env.example services/auth-service/.env
cp services/user-service/.env.example services/user-service/.env
cp services/notes-service/.env.example services/notes-service/.env
cp services/tags-service/.env.example services/tags-service/.env
Edit the .env files and update the following critical values:
JWT_SECRET - Use a strong, random secret (minimum 256 bits)JWT_REFRESH_SECRET - Use a different strong, random secretGenerate secure secrets:
# Generate JWT secrets
openssl rand -base64 32
docker-compose up postgres -d
# Install dependencies for all services
npm install
# Or install individually
cd api-gateway && npm install
cd ../services/auth-service && npm install
cd ../user-service && npm install
cd ../notes-service && npm install
cd ../tags-service && npm install
cd ../shared && npm install
Run Prisma migrations for each service:
# Auth Service
cd services/auth-service
npx prisma migrate dev
npx prisma generate
# User Service
cd ../user-service
npx prisma migrate dev
npx prisma generate
# Notes Service
cd ../notes-service
npx prisma migrate dev
npx prisma generate
# Tags Service
cd ../tags-service
npx prisma migrate dev
npx prisma generate
Start each service in development mode:
# Terminal 1 - Auth Service
cd services/auth-service
npm run dev
# Terminal 2 - User Service
cd services/user-service
npm run dev
# Terminal 3 - Notes Service
cd services/notes-service
npm run dev
# Terminal 4 - Tags Service
cd services/tags-service
npm run dev
# Terminal 5 - API Gateway
cd api-gateway
npm run dev
POST /api/auth/register - User registrationPOST /api/auth/login - User loginPOST /api/auth/refresh - Refresh tokensPOST /api/auth/logout - User logoutGET /api/users/profile - Get user profilePUT /api/users/profile - Update user profilePOST /api/notes - Create a noteGET /api/notes - Get user's notesGET /api/notes/:id - Get specific notePOST /api/tags - Create a tagGET /api/tags - Get user's tagsRun tests for each service:
# Auth Service
cd services/auth-service
npm test
# User Service
cd services/user-service
npm test
# Notes Service
cd services/notes-service
npm test
# Build and start all services
docker-compose up --build
# Start in detached mode
docker-compose up -d
# Stop all services
docker-compose down
.env files to version controlnotesverb/
├── api-gateway/ # API Gateway service
├── services/
│ ├── auth-service/ # Authentication service
│ ├── user-service/ # User management service
│ ├── notes-service/ # Notes management service
│ └── tags-service/ # Tags management service
├── shared/ # Shared utilities and types
├── docker-compose.yml # Docker services configuration
├── init-database.sql # Database initialization
└── README.md
This project is licensed under the MIT License.
Each service provides a health check endpoint:
http://localhost:8080/healthhttp://localhost:3001/healthhttp://localhost:3002/healthhttp://localhost:3003/healthhttp://localhost:3004/health