A note-taking application built with TypeScript, Express.js, and PostgreSQL.
- User Management: User authentication with role-based access control
- Note Management: Create, read, update, and delete notes with visibility controls (public/private)
- Tagging System: Organize notes with tags for better categorization
- Database: PostgreSQL with Drizzle ORM for type-safe database operations
- Development Tools: Pre-configured with ESLint, Prettier, Husky, and automated releases
- Backend: Node.js, Express.js, TypeScript
- Database: PostgreSQL with Drizzle ORM
- Development: Docker Compose for local development
- Code Quality: ESLint, Prettier, Husky for git hooks
- CI/CD: GitHub Actions for automated releases with semantic-release
The application uses the following main entities:
- Users: User accounts with role-based permissions
- Roles: User roles and permissions
- Notes: User notes with visibility controls
- Tags: Note categorization system
- NoteTags: Many-to-many relationship between notes and tags
- Node.js (v20 or higher)
- Docker and Docker Compose
- npm
git clone <repository-url>
cd mnemonicnpm installCopy the sample environment file and configure your settings:
cp .sample.env .envEdit the .env file with your preferred database credentials:
POSTGRES_DB=mnemonic_db
POSTGRES_USER=mnemonic_user
POSTGRES_PASSWORD=secure_password
PGADMIN_DEFAULT_EMAIL=[email protected]
PGADMIN_DEFAULT_PASSWORD=admin_passwordUsing Docker Compose:
npm run docker-up
# or
make upThis will start:
- PostgreSQL database on port 5432
- pgAdmin on port 5433 (accessible at http://localhost:5433)
The pgAdmin interface is automatically configured to connect to your PostgreSQL instance. Access it at:
- URL: http://localhost:5433
- Email: (from your .env file)
- Password: (from your .env file)
npm run docker-up- Start database servicesnpm run docker-down- Stop database servicesnpm run docker-logs- View container logsnpm run docker-restart- Restart database services
make up- Start services using Makefilemake down- Stop services using Makefilemake restart- Restart services using Makefile
npm run lint- Run ESLintnpm run lint:fix- Fix ESLint issues automatically
npm run version:patch- Bump patch versionnpm run version:minor- Bump minor versionnpm run version:major- Bump major versionnpm run semantic-release- Run semantic release
src/
├── config/ # Configuration files
├── controllers/ # Route controllers
├── db/ # Database schema and models
│ ├── Users.ts # User model and relations
│ ├── Roles.ts # Role model
│ ├── Notes.ts # Note model and relations
│ ├── Tags.ts # Tag model
│ ├── NoteTags.ts # Note-tag junction table
│ └── VisibilityEnum.ts # Note visibility enum
├── routes/ # API routes
├── services/ # Business logic services
└── index.ts # Application entry point
- User authentication and profile information
- Linked to roles for permission management
- Indexed on username and role combinations
- User-created notes with title and content
- Visibility controls (public/private)
- Indexed for efficient querying by user, date, and title
- Flexible tagging system for note organization
- Many-to-many relationship with notes via NoteTags junction table
This project uses conventional commits and automated releases:
-
Commit Format: Follow conventional commit format (enforced by commitlint)
feat: add new note creation endpoint fix: resolve user authentication issue docs: update API documentation
-
Git Hooks: Husky automatically runs:
- Lint-staged on pre-commit (linting and formatting)
- Commitlint on commit-msg (commit message validation)
-
Automated Releases: GitHub Actions automatically creates releases based on conventional commits
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes using conventional commit format
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License.
The docker-compose.yaml includes:
- PostgreSQL: Main database service
- pgAdmin: Database administration interface with auto-configuration
Both services are connected via a custom bridge network for secure communication.