Obsidian Manager API is a service that provides file management operations for Obsidian vaults through a RESTful API. It allows reading, writing, moving, and deleting files within a specified work folder.
If it is file management api using REST why Obsidian Manager? Because i use it mainly for managing my obsidian vault.
- Read file content and extract variables
- Write or append to files, with optional template and variable replacement
- Move files
- Delete files and empty parent folders
- Swagger UI for API documentation and testing
- Node.js (v14 or later)
- npm (v6 or later)
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone https://github.com/your-username/obsidian-manager.git cd obsidian-manager -
Install dependencies:
npm install
Create a .env file in the project root with the following content:
PORT=3000
WORK_FOLDER=/path/to/your/obsidian/vault
Adjust the PORT and WORK_FOLDER values as needed.
To run the service in development mode with hot reloading:
npm run dev
To compile the TypeScript code to JavaScript:
npm run build
To start the service in production mode:
npm start
To run the test suite:
npm test
For test coverage:
npm run test:coverage
To build and run the service using Docker:
-
Build the Docker image:
docker build -t obsidian-manager . -
Run the container:
docker run -p 3000:3000 -v /path/to/your/obsidian/vault:/app/data -e WORK_FOLDER=/app/data obsidian-manager
Replace /path/to/your/obsidian/vault with the actual path to your Obsidian vault.
Once the service is running, you can access the Swagger UI documentation at:
http://localhost:3000/documentation
This provides an interactive interface to explore and test the API endpoints.
GET /api/file: Read file contentPOST /api/file: Write or append to a filePUT /api/file: Move a fileDELETE /api/file: Delete a file
For detailed information on request/response formats, refer to the Swagger documentation.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the ISC License.