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:
- API Gateway (Port 8080) - Central entry point, routing, and authentication
- Auth Service (Port 3001) - User authentication and JWT token management
- User Service (Port 3002) - User profile management
- Notes Service (Port 3003) - Note creation, retrieval, and management
- Tags Service (Port 3004) - Tag management and organization
Each service has its own PostgreSQL database following the database-per-service pattern.
- Runtime: Node.js with TypeScript
- Framework: Express.js
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT tokens
- Containerization: Docker & Docker Compose
- Testing: Jest
- Security: Helmet, CORS, bcrypt
- Node.js (v18 or higher)
- Docker and Docker Compose
- PostgreSQL (if running without Docker)
- Git
git clone https://github.com/fiston-user/notesverb-yt.git
cd notesverb-ytCopy 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/.envEdit 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 secret- Database passwords (if not using default Docker setup)
Generate secure secrets:
# Generate JWT secrets
openssl rand -base64 32docker-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 installRun 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 generateStart 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 devPOST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/refresh- Refresh tokensPOST /api/auth/logout- User logout
GET /api/users/profile- Get user profilePUT /api/users/profile- Update user profile
POST /api/notes- Create a noteGET /api/notes- Get user's notesGET /api/notes/:id- Get specific note
POST /api/tags- Create a tagGET /api/tags- Get user's tags
Run 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- Environment Variables: Never commit
.envfiles to version control - JWT Secrets: Use strong, unique secrets in production
- Database Credentials: Use secure passwords and restrict access
- CORS: Configure appropriate origins for your frontend
- HTTPS: Use HTTPS in production environments
notesverb/
βββ 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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License.
- Port conflicts: Ensure ports 3001-3004 and 8080 are available
- Database connection: Verify PostgreSQL is running and credentials are correct
- JWT errors: Ensure JWT_SECRET is consistent across all services
- CORS issues: Check CORS_ORIGIN configuration matches your frontend URL
Each service provides a health check endpoint:
- API Gateway:
http://localhost:8080/health - Auth Service:
http://localhost:3001/health - User Service:
http://localhost:3002/health - Notes Service:
http://localhost:3003/health - Tags Service:
http://localhost:3004/health