flatnotes Documentation

repository·develop·Indexed 25 days ago

https://github.com/dullage/flatnotes

A 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.

Tokens
1.2K
Snippets
2
Records
10
Agent score
35%

What's inside flatnotes

  1. Overview of flatnotes

    develop
    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.
  2. Self-host flatnotes using Docker Run

    develop

    To run flatnotes as a standalone Docker container, use the following command. This example configures password authentication and maps a local ./data directory to the container's /data volume.

    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:latest
  3. Self-host flatnotes using Docker Compose

    develop

    For 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-stopped
  4. Configure the search index location

    develop
    By default, flatnotes stores its search index within the /data directory. 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 ./index folder, map it to /data/.flatnotes inside the container.
  5. Manage attachments

    develop

    Attachments can be uploaded and downloaded. If auth_type is READ_ONLY, you can only download files.

    • Download an attachment: GET /api/attachments/{filename} or GET /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.
  6. Search notes and retrieve tags

    develop

    Perform full-text searches across all notes or retrieve the list of indexed tags.

    Search Notes GET /api/search

    • term (string, required): The search query.
    • sort (string, optional): One of score, title, or lastModified. Defaults to score.
    • order (string, optional): asc or desc. Defaults to desc.
    • limit (int, optional): Maximum number of results.

    Get Tags GET /api/tags Returns a list of all indexed tags as strings.

  7. Retrieve and manage notes via the API

    develop

    Flatnotes provides endpoints to interact with notes. Note access is subject to the configured auth_type. If auth_type is READ_ONLY, only GET requests are permitted.

    • Get a note: GET /api/notes/{title}. Returns a Note object. Returns 404 if not found.
    • Create a note: POST /api/notes. Requires a NoteCreate payload. Returns 409 if the note already exists.
    • Update a note: PATCH /api/notes/{title}. Requires a NoteUpdate payload. Returns 404 if not found or 409 if there is a conflict.
    • Delete a note: DELETE /api/notes/{title}. Returns 404 if not found.
  8. Authenticate with the Flatnotes API

    develop
    If authentication is enabled (auth_type is not NONE or READ_ONLY), you must obtain a token to access protected endpoints. Use the /api/token endpoint with a Login payload. Once authenticated, subsequent requests should include the token (typically via headers, though the specific header name is handled by the auth implementation).
  9. Check server health and authentication status

    develop

    Use these lightweight endpoints for monitoring and verifying connectivity:

    • Healthcheck: GET /health. Returns OK if the server is running.
    • Auth Check: GET /api/auth-check. Returns OK if the request is successfully authenticated. This endpoint requires valid authentication dependencies.