flatnotes Documentation
repository·develop·Indexed 25 days ago
https://github.com/dullage/flatnotesA self-hosted, database-less note-taking web application that stores notes as plain markdown files in a flat folder structure. Version 5.5.4 features a mobile-responsive interface, raw/WYSIWYG editor modes, advanced search, tagging, Wikilink support, and a RESTful API for managing notes, tags, and attachments.
What's inside flatnotes
- flatnotes is a self-hosted, database-less note-taking web application. It uses a flat folder of markdown files for storage, ensuring your notes remain portable and accessible via any markdown editor. It features a mobile-responsive interface, raw/WYSIWYG editor modes, advanced search, tagging, Wikilink support, and a RESTful API.
Self-host flatnotes using Docker Run
developTo run flatnotes as a standalone Docker container, use the following command. This example configures password authentication and maps a local
./datadirectory to the container's/datavolume.docker run -d \ -e "PUID=1000" \ -e "PGID=1000" \ -e "FLATNOTES_AUTH_TYPE=password" \ -e "FLATNOTES_USERNAME=user" \ -e 'FLATNOTES_PASSWORD=changeMe!' \ -e "FLATNOTES_SECRET_KEY=aLongRandomSeriesOfCharacters" \ -v "$(pwd)/data:/data" \ -p "8080:8080" \ dullage/flatnotes:latestSelf-host flatnotes using Docker Compose
developFor a persistent deployment, use Docker Compose. This configuration includes environment variables for authentication and volume mapping for your markdown files.
version: "3" services: flatnotes: container_name: flatnotes image: dullage/flatnotes:latest environment: PUID: 1000 PGID: 1000 FLATNOTES_AUTH_TYPE: "password" FLATNOTES_USERNAME: "user" FLATNOTES_PASSWORD: "changeMe!" FLATNOTES_SECRET_KEY: "aLongRandomSeriesOfCharacters" volumes: - "./data:/data" # Optional. Allows you to save the search index in a different location: # - "./index:/data/.flatnotes" ports: - "8080:8080" restart: unless-stoppedConfigure the search index location
developBy default, flatnotes stores its search index within the/datadirectory. You can optionally redirect the search index to a different location by adding a specific volume mapping in your Docker configuration. For example, to save the index in a local./indexfolder, map it to/data/.flatnotesinside the container.Manage attachments
developAttachments can be uploaded and downloaded. If
auth_typeisREAD_ONLY, you can only download files.- Download an attachment:
GET /api/attachments/{filename}orGET /attachments/{filename}. The latter is a secondary route for relative URL usage. - Upload an attachment:
POST /api/attachments. Requires a file upload. Returns 409 if the attachment already exists.
- Download an attachment:
Search notes and retrieve tags
developPerform full-text searches across all notes or retrieve the list of indexed tags.
Search Notes
GET /api/searchterm(string, required): The search query.sort(string, optional): One ofscore,title, orlastModified. Defaults toscore.order(string, optional):ascordesc. Defaults todesc.limit(int, optional): Maximum number of results.
Get Tags
GET /api/tagsReturns a list of all indexed tags as strings.Retrieve and manage notes via the API
developFlatnotes provides endpoints to interact with notes. Note access is subject to the configured
auth_type. Ifauth_typeisREAD_ONLY, onlyGETrequests are permitted.- Get a note:
GET /api/notes/{title}. Returns aNoteobject. Returns 404 if not found. - Create a note:
POST /api/notes. Requires aNoteCreatepayload. Returns 409 if the note already exists. - Update a note:
PATCH /api/notes/{title}. Requires aNoteUpdatepayload. Returns 404 if not found or 409 if there is a conflict. - Delete a note:
DELETE /api/notes/{title}. Returns 404 if not found.
- Get a note:
Authenticate with the Flatnotes API
developIf authentication is enabled (auth_typeis notNONEorREAD_ONLY), you must obtain a token to access protected endpoints. Use the/api/tokenendpoint with aLoginpayload. Once authenticated, subsequent requests should include the token (typically via headers, though the specific header name is handled by theauthimplementation).Check server health and authentication status
developUse these lightweight endpoints for monitoring and verifying connectivity:
- Healthcheck:
GET /health. ReturnsOKif the server is running. - Auth Check:
GET /api/auth-check. ReturnsOKif the request is successfully authenticated. This endpoint requires valid authentication dependencies.
- Healthcheck:
Retrieve server configuration
developThe/api/configendpoint returns the server-side configuration required for the UI to function correctly. This includes authentication status and quick access settings.