A modern, self-hosted note-taking application built with performance, security, and clean architecture in mind.
- Authentication: Secure user registration and login.
- Note Management: Create, edit, pin, archive, and delete notes.
- Rich Text: Markdown support for note content.
- Version History: Track changes, view history, note diffs, download versions, and restore previous states.
- Organization: Tagging system for easy filtering.
- Smart Features: Semantic search and automatically generated related notes using local embeddings.
- Theme: Dark and Light mode support.
- Responsive: Mobile-friendly UI built with Tailwind CSS.
- Architecture:
- Backend: Hexagonal Architecture (Domain, Infra, API layers) in Rust.
- Infrastructure: Configurable database backends (SQLite, Postgres).
- Frontend: Modern React with TypeScript and Vite.
- Deployment: Full Docker support with
compose.yml.
- Language: Rust
- Framework: Axum
- Database: SQLite (Default) or Postgres (Supported via feature flag)
- Vector Database: Qdrant (for Smart Features)
- Dependency Injection: Manual wiring for clear boundaries
- Framework: React + Vite
- Language: TypeScript
- Styling: Tailwind CSS + Shadcn UI
- State Management: TanStack Query (React Query)
Run the entire stack with a single command:
docker compose up -d --build- Frontend: http://localhost:8080
- Backend: http://localhost:3000
The frontend is automatically configured to talk to the backend.
- Navigate to the
notes-apidirectory (or root). - Set up the environment variables (see
.env.example). - Run the server:
cargo run -p notes-apiBy default, this uses the SQLite backend.
The application is configured via environment variables (or .env file):
ALLOW_REGISTRATION: Set tofalseto disable new user registration (default:true).DATABASE_URL: Connection string for the database.SESSION_SECRET: Secret key for session encryption.CORS_ALLOWED_ORIGINS: Comma-separated list of allowed origins.
Running with Postgres:
To use PostgreSQL, build with the postgres feature:
cargo run -p notes-api --no-default-features --features notes-infra/postgresNote: Ensure your DATABASE_URL is set to a valid Postgres connection string.
Feature Flags (Smart Features):
The application includes "Smart Features" (semantic search, related notes) enabled by default. These require fastembed, qdrant-client, and async-nats.
To build/run without smart features (for faster compilation or lighter deployment):
cargo run -p notes-api --no-default-features --features sqlite- Navigate to
k-notes-frontend. - Install dependencies:
bun install- Run the dev server:
bun devThe backend follows a Hexagonal Architecture (Ports and Adapters). The notes-domain crate defines the repository capabilities (Ports), and notes-infra implements them (Adapters).
- SQLite: Fully implemented (default). Ideal for single-instance, self-hosted deployments.
- Postgres: Structure is in place (via feature flag), ready for implementation.
To add a new database (e.g., MySQL), follow these steps:
- Dependencies: Add the driver to
notes-infra/Cargo.toml(e.g.,sqlxwithmysqlfeature) and create a feature flag. - Configuration: Update
DatabaseConfiginnotes-infra/src/db.rsto handle the new connection URL scheme and connection logic increate_pool. - Repository Implementation:
- Implement
NoteRepository,TagRepository, andUserRepositorytraits for the new database innotes-infra.
- Implement
- Factory Integration:
- Update
notes-infra/src/factory.rsto include a builder for the new repositories. - Update
build_database_pooland repositorybuild_*functions to support the new database type match arm.
- Update
- Migrations:
- Add migration files in
migrations/<db_type>. - Update
run_migrationsindb.rsto execute them.
- Add migration files in
This design ensures the notes-api layer remains completely agnostic to the underlying database technology.
├── notes-api # API Interface (Axum, HTTP routes)
├── notes-domain # Core Business Logic (Entities, Services, Ports)
├── notes-infra # Infrastructure (Database adapters, Repositories)
├── k-notes-frontend # React Frontend Application
├── migrations # SQLx Database Migrations
└── compose.yml # Docker Composition
MIT
