Skip to content

wuyilingwei/Vault

Repository files navigation

πŸ” AetherVault

Version 1.1.0 (Zephyr)

A personal lightweight SaaS database with complex permission management, designed for high-performance credential distribution and configuration sharing.

Dashboard Screenshot

Built on the robust Cloudflare ecosystem: Workers + KV + D1.

Demo on Cloudflare

URL: https://aethervault-service-demo.yigeyigeren.workers.dev

username:admin password:123456

Disclaimer: This environment is for AetherVault feature demonstration purposes only. Because login credentials are publicly available, uploading any real sensitive data (such as production environment keys, personal privacy information, etc.) is strictly prohibited. All data is publicly visible, and the author reserves the right to delete the database at any time without prior notice. By using this demo, you agree that the author will not be held legally responsible for any data loss or disclosure.


✨ Features

  • πŸ›‘οΈ Data Security: UUID-based module-level permission control.
  • πŸ’Ύ Reliable Storage: Configuration items persisted in Cloudflare D1.
  • πŸ“¦ Batch Operations: Supports atomic batch read/write operations to reduce network round-trips.
  • πŸ–₯️ Enhanced Frontend: Includes a Vue-based frontend for token management, complete database viewing (custom separators, Base64 support), and limited editing capabilities.

πŸš€ Deployment

Prerequisites

  • Node.js and npm installed.
  • Cloudflare account.
  • Wrangler CLI installed (npm install -g wrangler).

Installation Steps

  1. Clone the repository

    git clone https://github.com/wuyilingwei/Vault.git
    cd Vault
  2. Configure Wrangler

    Create a copy of the configuration file:

    cp wrangler.example.toml wrangler.toml
  3. Create Resources

    Create the KV namespace for authentication:

    npx wrangler kv namespace create aethervault-access

    Create the D1 database for data storage:

    npx wrangler d1 create aethervault-service

    ⚠️ Important: Update your wrangler.toml file with the id (for KV) and database_id (for D1) returned by the commands above.

  4. Configure Admin Access

    Set the administrator password used for the frontend management interface:

    npx wrangler secret put ADMIN_PASSWORD

    ⚠️ Security Note: If ADMIN_PASSWORD is not set, all admin authorization attempts will be blocked for security.

    You can optionally configure the username by setting ADMIN_USERNAME in wrangler.toml. It defaults to admin if not specified.

  5. Initialize Database

    Initialize the D1 database schema using the provided SQL file:

    npx wrangler d1 execute aethervault-service --remote --file=./init.sql
  6. Deploy

    Deploy the worker to Cloudflare:

    npx wrangler deploy

πŸ“– Usage

Once deployed, you can access the frontend at your worker's URL (e.g., https://aethervault-service.<your-subdomain>.workers.dev).

Use your configured ADMIN_USERNAME (default: admin) and ADMIN_PASSWORD to log in. The frontend provides:

  • Token Management: Create and manage access tokens.
  • Database Viewer: View all data with support for custom separators and Base64 decoding/encoding.
  • Data Editor: Limited editing functionality for database items.

⚠️ Note: While the frontend supports data editing and includes compatibility checks, it is not recommended to perform large-scale or complex data changes directly through the UI.

πŸ“š API Documentation

Authentication

All API requests must include the UUID (Device/App Identifier) in the Authorization header using the Bearer scheme:

Authorization: Bearer <YOUR_UUID_TOKEN>

Endpoint

POST /api/data

Operations

The API supports batch operations via the ops array. Operations are executed sequentially in the exact order they appear in the JSON array to prevent data conflicts.

Note: The server does not sort operations by id or any other field. The execution order is strictly determined by the array index.

Each operation object can contain:

  • id (optional): Custom identifier to track the operation in the response.

    Recommendation: Use unique IDs that reflect the execution order (e.g., task_01, task_02) to avoid confusion, although the API does not strictly enforce uniqueness.

  • type (required): Operation type (write, append, read, list).
  • module (required): Target module name.
  • key (optional): Target key (required for write, append, read).
  • value (optional): Data to write or append.
  • separator (optional): Delimiter definition (only valid for write operations).

Operation Types

  • write: Overwrite value (can define separator).
  • append: Append value using the pre-defined separator.
  • read: Retrieve a specific key's value.
  • list: List all keys and values within the specified module (scope).

Example Request

{
    "ops": [
        { "id": "req1", "type": "write", "module": "config", "key": "theme", "value": "dark" },
        { "id": "req2", "type": "write", "module": "logs", "key": "access", "value": "init", "separator": "\n" },
        { "id": "req3", "type": "append", "module": "logs", "key": "access", "value": "user_login" },
        { "id": "req4", "type": "read", "module": "config", "key": "theme" },
        { "id": "req5", "type": "list", "module": "config" }
    ]
}

Example Response

[
    { "id": "req1", "status": 200, "data": { "last_update": "2025-12-23T01:56:56.653Z" } },
    { "id": "req2", "status": 200, "data": { "last_update": "2025-12-23T01:56:58.123Z" } },
    { "id": "req3", "status": 200, "data": { "last_update": "2025-12-23T01:56:59.704Z" } },
    { "id": "req4", "status": 200, "data": { "content": "dark", "last_update": "2025-12-23T01:56:59.704Z" } },
    { "id": "req5", "status": 200, "data": { "items": { "theme": "dark", "lang": "en" } } }
]

About

Simple Cloudflare KV+D1 Vault SaaS

Resources

License

Stars

Watchers

Forks

Contributors

Generated from wuyilingwei/template